Object switched on won't unlock exit
demonboy
07 Apr 2012, 15:26I have a lightswitch (switch) which is on a wall. When the light is on I want it to reveal an exit. Currently the exit is locked when the light is not switched on. When the light is switched on I've set a script to unlock the exit, yet it remains locked. I've taken a screen shot of my setup for the script. I wonder if this has something to do with the hierarchy of my tree on the left? Surely the switch has to be an object of the wall. The wall is a surface. The light can switch on and off and when you look, the description for light on or light off is correct, so why won't the exit unlock when the light is switched on?


Alex
07 Apr 2012, 17:09Because that script only runs when the player uses that exit. If the exit is locked, that script won't run.
You want the script to run when you flick the switch, so put the script in the light switch, in the "after switching on the object" section.
You want the script to run when you flick the switch, so put the script in the light switch, in the "after switching on the object" section.
demonboy
07 Apr 2012, 17:24Spot on. Thanks, Alex. Easy when you know how and it makes complete sense!