So I am trying to use a script to open a door when 2 pressure plates are activated. I managed to use the script below to accomplish this, however it only works once. I want it so that if I remove the rocks from the pressure plate the door closes and if they are reaplied the door opens again. any help?
SpoilerShow
counter = 2
function activate()
counter = counter - 1
checkValue()
end
function deactivate()
counter = counter + 1
checkValue()
end
function checkValue()
if counter == 0 then
pressuredoor:open()
else
pressuredoor:close()
end
end
have you connected each of the pressure plates twice to the script_entity, once with event activate, action activate and once with event deactivate, action deactivate?
you also probably don't even need a script for this as there is a counter-entity that you could use. set it to initial value 2 and connect it to the door on the any event with action toggle. then connect the pressure plates twice to the counter once with event activate, action decrement and once with event deactivate, action increment.
can't test right now but that should work.