(done) Directional trigger
Posted: Sun May 04, 2008 8:39 pm
I am probably missing something obvious, but I can't seem to make a floor trigger operated by the party only when facing a given direction (say, north.)
There are two problems to solve. 1) The party must not set the trigger when it steps on it facing anything but north. 2) If, while standing on the obj.trigger, the party turns to face north, the trigger should get, well, triggered. And of course, turning away from north should release the trigger. A basic obj.trigger instance triggers when stepped on, regardless of direction, and does nothing when the party turns while standing on it.
- Giving the obj.trigger instance a 'face' exvar doesn't prevent the trigger from acting when stepped on while facing the wrong direction.
- Giving it an on_turn exvar set to 'on_turn = floor_trigger' does not do anything. floor_trigger is the function that gets called when the trigger is stepped on, but clearly whatever happens on party turning, it doesn't involve checking the exvars of triggers.
- Modifying the obj.trigger archetype to add one line to it 'on_turn = floor_trigger,' does nothing most of the time and crashes DSB sometimes (when facing north (0)?)
- I have tried leaving the trigger as is and making it activate a function_caller object, but how do these even work? I do not know. And how would I get the activation to occur when the party turns? Can the function caller deactivate the trigger? would that be enough?
_ I have thought about putting a telporter on that tile as well, with a delay of one tick for its activation, that would teleport the party to the same tile, in the hopes of deactivating-reactivating the trigger, but I suspect that might lead to infinite telportation and, frankly, it shouldn't be that complicated.
I have spend several hours on this problem now, and I am no closer to a working solution. Any help would be appreciated.
There are two problems to solve. 1) The party must not set the trigger when it steps on it facing anything but north. 2) If, while standing on the obj.trigger, the party turns to face north, the trigger should get, well, triggered. And of course, turning away from north should release the trigger. A basic obj.trigger instance triggers when stepped on, regardless of direction, and does nothing when the party turns while standing on it.
- Giving the obj.trigger instance a 'face' exvar doesn't prevent the trigger from acting when stepped on while facing the wrong direction.
- Giving it an on_turn exvar set to 'on_turn = floor_trigger' does not do anything. floor_trigger is the function that gets called when the trigger is stepped on, but clearly whatever happens on party turning, it doesn't involve checking the exvars of triggers.
- Modifying the obj.trigger archetype to add one line to it 'on_turn = floor_trigger,' does nothing most of the time and crashes DSB sometimes (when facing north (0)?)
- I have tried leaving the trigger as is and making it activate a function_caller object, but how do these even work? I do not know. And how would I get the activation to occur when the party turns? Can the function caller deactivate the trigger? would that be enough?
_ I have thought about putting a telporter on that tile as well, with a delay of one tick for its activation, that would teleport the party to the same tile, in the hopes of deactivating-reactivating the trigger, but I suspect that might lead to infinite telportation and, frankly, it shouldn't be that complicated.
I have spend several hours on this problem now, and I am no closer to a working solution. Any help would be appreciated.