Connector between levels
Connector between levels
Is it possible to use a button on one level to trigger something on another?
At the moment it lets me connect them but not specify the action.
At the moment it lets me connect them but not specify the action.
Re: Connector between levels
Yes just use simple lua scripts.
Example:
The lever/button and the script must be in the same level. The door can be in a lower level.
You need to rename door01 and lever01 if you want to use this.
Example:
Code: Select all
function sdoor01()
if lever01:getLeverState() == "activated" then
door01:setDoorState("open")
else
door01:setDoorState("closed")
end
end
You need to rename door01 and lever01 if you want to use this.
Re: Connector between levels
Finished Dungeons - complete mods to play
Re: Connector between levels
thanks alot Magus.
would it also be possible to call a lua function on another level this way?
would it also be possible to call a lua function on another level this way?
Re: Connector between levels
As far as I can see, you are referencing the object, so it doesn't seem to care where it is on the map. This is the advantage of script calls
Re: Connector between levels
i mean use a lua script on one level to make a lua script on another level do something?
Re: Connector between levels
don't think this works. Right now we can't call functions outside of the lua scripts.
EDIT: Found a way. You can use a timer for the second script, this way you can activate the timer from all other floors and the timer will run the lua script.
EDIT: Found a way. You can use a timer for the second script, this way you can activate the timer from all other floors and the timer will run the lua script.
Re: Connector between levels
Shroom wrote:As far as I can see, you are referencing the object, so it doesn't seem to care where it is on the map. This is the advantage of script calls
Use the level objects - you can use timers, or activate plates or whatever else you want to do to run localised scripts - these objects can sit in unconnected rooms, or just not be triggered by the party, items or monsters etcMagus wrote:don't think this works. Right now we can't call functions outside of the lua scripts.
EDIT: Found a way. You can use a timer for the second script, this way you can activate the timer from all other floors and the timer will run the lua script.
Re: Connector between levels
timers are your friends - very powerful friends
Finished Dungeons - complete mods to play
Re: Connector between levels
A much better way is using counters. Set the counter to 1 and decrease it with a script, the counter runs a new script that resets the counter to 1.
This way you don't need to wait 1 second for the script to run.
This way you don't need to wait 1 second for the script to run.