I wanna have two switches to open a door when they're both activated.
if "door_leftswitch:on_activated() and door_rightswitch:on_activated() then
door_to_b1:is_opening("true")
end
Names:
Switch 1: door_leftswitch
Switch 2: door_rightswitch
Door: door_to_b1
How can do this. I tried to mess around with LUA, but can't figure it out.
I guess it works like this:
function door_leftswitch:on_activated()
if door_rightswitch:is_activated() then
map:open_doors("door_to_b1");
end
end
function door_rightswitch:on_activated()
if door_leftswitch:is_activated() then
map:open_doors("door_to_b1");
end
end
I've tried that one, but it doesn't work.
It does work for me...
Are you trying this in the map script and have you written this line?
local map = ...
If your door is not a door entity but a dynamic tile, try this line
door_to_b1:set_enabled(false)
instead of map:open_doors()
Anyway, this code
if door_leftswitch:on_activated() and door_rightswitch:on_activated() then
door_to_b1:is_opening("true")
end
can't work for the following reasons:
1.) on_activated() is a function that is called when the switch is activated. The function that tells you whether the switch is activated is called is_activated()
2.) is_opening is a function that returns a boolean value and doesn't take any parameters. So this won't have any effect.
It does work. I made a little error on my side. One of the switches had a spelling error in it's name. Thanks for helping.