
Ask a simple question, get a simple answer
Re: Ask a simple question, get a simple answer
It doesn't matter to the game what the lock_picks are called, so long as it's a valid name; especially if you are rolling your own lock picking mechanics. 

Re: Ask a simple question, get a simple answer
following situation:
Every time a button is pressed it needs to activate the model of the next gem in the row
I would like some help creating a script for it
that doesn't involve using 8 seperate counters connected to the button 
Every time a button is pressed it needs to activate the model of the next gem in the row
Code: Select all
function bluegem1
blue_gem_1.model:enable()
function bluegem2
blue_gem_2.model:enable()
etc...
all the way upto 8 gems that are activated


- Zo Kath Ra
- Posts: 940
- Joined: Sat Apr 21, 2012 9:57 am
- Location: Germany
Re: Ask a simple question, get a simple answer
Pompidom wrote: ↑Fri Oct 19, 2018 4:16 pm following situation:
Every time a button is pressed it needs to activate the model of the next gem in the row
I would like some help creating a script for itCode: Select all
function bluegem1 blue_gem_1.model:enable() function bluegem2 blue_gem_2.model:enable() etc... all the way upto 8 gems that are activated
that doesn't involve using 8 seperate counters connected to the button
![]()
Code: Select all
function activateGems()
local gem_ids = {"blue_gem_1", "blue_gem_2", "blue_gem_3"}
for i = 1, #gem_ids do
local gem_entity = findEntity(gem_ids[i])
if gem_entity and gem_entity.model and (gem_entity.model:isEnabled() == false) then
gem_entity.model:enable()
return
end
end
end
Re: Ask a simple question, get a simple answer
https://youtu.be/UUvvBXQvvz0
So the entire puzzle works fine. Reset button works fine.
The platforms reset to their original starter positions. However if I then continue throwing rocks in it, the platform goes instantly to the last dropped position.
This script is activated for the duration of 1 second when a rock is inserted which drops the platform a little bit.
And this script is activated when the reset button is activated. The platform goes back to the original starter position.
However is dropped all the way back where I left it when I start throwing rocks again.
mine_counterweight_platform_3 is placed on the same square as script_entity_98.
Help !
So the entire puzzle works fine. Reset button works fine.
The platforms reset to their original starter positions. However if I then continue throwing rocks in it, the platform goes instantly to the last dropped position.
Code: Select all
startHeight = 1
dir = 1
posY = 0
function mineweightdown1()
local spinner = findEntity("mine_counterweight_platform_3")
if posY < startHeight then
posY = posY - 0.001
spinner:setPosition(script_entity_98.x, script_entity_98.y, dir, posY, script_entity_98.level)
end
end
Code: Select all
function resetplatform
mine_counterweight_platform_3:setPosition(4,8,1,0,13)
However is dropped all the way back where I left it when I start throwing rocks again.
mine_counterweight_platform_3 is placed on the same square as script_entity_98.
Help !

Re: Ask a simple question, get a simple answer
If these functions are in separate script entities, then you need a 'setter' function in the first script, that can be called from the resetplatform function.
If these functions are both in the same script, then just set posY = 0 in the resetplatform function.
If these functions are both in the same script, then just set posY = 0 in the resetplatform function.
Code: Select all
--setter
function resetY()
posY = 0
end
Code: Select all
function resetplatform()
mine_counterweight_platform_3:setPosition(4,8,1,0,13)
posY = 0
end
Re: Ask a simple question, get a simple answer
I wasted 2 hours today on disabling minimal savestates on many objects, as my mod is basically the motherload of setWorldPositions
https://ibb.co/inw030
This is the only thing that's left.
I have bodies and skeletons set with WorldPositions so that they properly fit on tables, beds, chairs, graves and caskets, hanging from hooks and chains. You name it. It's a massacre everywhere you go
The "hurt" human archer model based on Skeleton_trooper1 is the only thing left I can't get a fix on.
I disabled the animation so that he appears as a dead human with some worldRotation shizzle.
After a reload, his animation is back "on" in his "hurt" sitting animation on the ground.
Is there any way to get around it?
https://ibb.co/inw030
This is the only thing that's left.
I have bodies and skeletons set with WorldPositions so that they properly fit on tables, beds, chairs, graves and caskets, hanging from hooks and chains. You name it. It's a massacre everywhere you go

The "hurt" human archer model based on Skeleton_trooper1 is the only thing left I can't get a fix on.
I disabled the animation so that he appears as a dead human with some worldRotation shizzle.
After a reload, his animation is back "on" in his "hurt" sitting animation on the ground.
Is there any way to get around it?
Re: Ask a simple question, get a simple answer
https://youtu.be/c-Q_m9DNHDw
I made a jackpot slot machine in the tavern I'm currently building.
Currently it already has an "idle" mode displaying some stuff like a real jackpot would in "insert coin" mode.
I already have an idea to give it a fixed outcome. That's pretty easy to implement.
Are there any randomizing scripts I can learn from?
My current idea is to make the symbols appear and change really fast and then when the coin is inserted, all symbols are halted.
And then a delayed call is done to read out the outcome and then pay out when a winning combination is displayed. Which is more or less semi random.
Not really expecting an answer here, but maybe someone is interested in sharing some RNG scripts that can help me out here.
I made a jackpot slot machine in the tavern I'm currently building.
Currently it already has an "idle" mode displaying some stuff like a real jackpot would in "insert coin" mode.
I already have an idea to give it a fixed outcome. That's pretty easy to implement.
Are there any randomizing scripts I can learn from?
My current idea is to make the symbols appear and change really fast and then when the coin is inserted, all symbols are halted.
And then a delayed call is done to read out the outcome and then pay out when a winning combination is displayed. Which is more or less semi random.
Not really expecting an answer here, but maybe someone is interested in sharing some RNG scripts that can help me out here.
Re: Ask a simple question, get a simple answer
Hi everyone
Is it possible to create an "onIdle" function as a party hook?
I tried to use "isIdle" as a hook in my init.lua file but then I have an error message (invalid component party).
Basically, I'm looking for a way to check the state of the party (moving/not moving). I could use a timer with a very short timer interval (say 0.1s), but I was wondering if there was another way to do it, since timers seem to act strangely when not in the same level of the party...
Thanks
Khollik
Is it possible to create an "onIdle" function as a party hook?
I tried to use "isIdle" as a hook in my init.lua file but then I have an error message (invalid component party).
Basically, I'm looking for a way to check the state of the party (moving/not moving). I could use a timer with a very short timer interval (say 0.1s), but I was wondering if there was another way to do it, since timers seem to act strangely when not in the same level of the party...
Thanks
Khollik
Re: Ask a simple question, get a simple answer
The party object has functions that tell if it is moving, is idle, is falling, is resting; they return a boolean value when called.
Example:
Code: Select all
print("The Party is moving:",party.party:isMoving())
print("The Party is moving:",party.party:isIdle())
Also you can use the party hook onMove(). This hook is called —every time they try to move. It is gives the direction as well.
Code: Select all
--place in the party component
onMove = function(self, dir) local compass = {'North', 'East', 'South', 'West'} hudPrint("the Party takes a Step "..compass[dir+1]) end
Alternatively:
Code: Select all
--place in a script_entity
party.party:addConnector('onMove', self.go.id, "partyIsMoving")
function partyIsMoving(self, dir)
local compass = {'North', 'East', 'South', 'West'} hudPrint("the Party takes a Step "..compass[dir+1])
end
______________________
It is possible to use both at once:
Code: Select all
--place in the party component
onMove = function(...) return script_entity_1.script:restrictNorth(...) end
Code: Select all
--place in a script_entity
function restrictNorth(script, party, dir)
local compass = {'North', 'East', 'South', 'West'}
hudPrint("The Party "..iff(dir~=0,'takes', 'cannot take').." a Step "..compass[dir+1])
return dir~=0
end