Object script state, what am I doing wrong?
Posted: Thu May 29, 2003 7:52 pm
Okay I've set up some forcefields (using Ed the Monkey's green forcefield sprite) tagged them lvl1, lvl2 etc and set the door entities as laser doors. Then because I couldn't figure away of setting up an emitter that could be disabled by using the repair skill without setting up hundreds of mini-zones, I set up a series of switches that need a key.
The forcefields are initially down, and come on when an alarm is triggered.
In my startup trigger I've set the object script state of the forcefields as checked (with Ed's sprite this opens them), the door switches as checked and a variable 'forcefields_on is false'.
Then when the alarm goes off I set the object script state as unchecked, this raises them fine (you'd better not be in a doorway when they go up!) and I've set the variable to 'forcefields_on is true'.
When the key is used on the switch it lowers them fine but here's where my problem is. I've set up a science switch as a central switch which disables the forcefields permanently (this is what I need the variable for) the normal switches are only meant to lower the forcefields temporarily. The key works and the forcefields turn off, then after a short time turn back on again (and this is the problem part) they then promptly turn back off, then on, then off etc etc.
The trigger for the switch is
preserved
conditions:
variable 'forcefield_on' is true (turning off the science switch will set this variable to off)
object script state 'door_switch_lvl1' unchecked.
actions:
object script state 'lvl1' checked
B wait 20 seconds
object script state 'door_switch_lvl1' checked
B wait 1 second
object script state 'lvl1' unchecked
Anyone know what I've done wrong?
Cheers
The forcefields are initially down, and come on when an alarm is triggered.
In my startup trigger I've set the object script state of the forcefields as checked (with Ed's sprite this opens them), the door switches as checked and a variable 'forcefields_on is false'.
Then when the alarm goes off I set the object script state as unchecked, this raises them fine (you'd better not be in a doorway when they go up!) and I've set the variable to 'forcefields_on is true'.
When the key is used on the switch it lowers them fine but here's where my problem is. I've set up a science switch as a central switch which disables the forcefields permanently (this is what I need the variable for) the normal switches are only meant to lower the forcefields temporarily. The key works and the forcefields turn off, then after a short time turn back on again (and this is the problem part) they then promptly turn back off, then on, then off etc etc.
The trigger for the switch is
preserved
conditions:
variable 'forcefield_on' is true (turning off the science switch will set this variable to off)
object script state 'door_switch_lvl1' unchecked.
actions:
object script state 'lvl1' checked
B wait 20 seconds
object script state 'door_switch_lvl1' checked
B wait 1 second
object script state 'lvl1' unchecked
Anyone know what I've done wrong?
Cheers