I was experimenting with the new off-center tilepos triggers and testing to see if they could be implemented with party facing. It turns out they can - but only partly. They are triggered when the party enters the square, but not if they only turn on the square.
I kind of needed this feature for the Theron's Quest conversion, so I went ahead and wrote up a work-around that does that job (Trigger/Face test). To test it, just proceed south through the doors to the final room. While standing on the puddle, turn around. A wall will appear in front of the party (and disappear from where ever they aren't facing). The other rooms were tests to make sure my new code didn't break any other triggers (there's a room off to the left of the second room that also has a puddle. Place items on the corners of that tile to make pits appear at diagonals - just don't fall down them, you can't come back up).
There's also a lever in the last room that switches back to the way the 'base' code does it. I bring it up because this is one of those cases that, while it can be recoded to work, I think requires a change to the engine. If you switch back to the old mode and test it, you'll discover that it will spit errors (nothing fatal, but still errors). This is because, if the party isn't facing the direction they were when they stepped on the tile, the wrong tilepos gets 'untriggered' - in this case, that means a 'tc' error and the wall that appeared upon entering is still there (and, also, the wall that should appear doesn't).
That' probably confusing, so let me give an example. The party steps on the square facing north. The trigger at tilepos 'NORTH' triggers, and a wall appears. Then, they rotate to face east. The 'NORTH' trigger doesn't untrigger, and the 'EAST' trigger doesn't fire, either, so the walls stay the same - one to the north, none to the east. The party then steps forward, off the square. The 'EAST' trigger is untriggered, which causes an error (because it was never triggered in the first place and has a nil 'tc' exvar), and the 'NORTH' trigger doesn't, so that wall is still there (NOTE: these triggers all have 'const_weight' set so that they respond to untriggers).
Now, I realize that off-center triggers weren't really meant for 'opby_party' operations, but I'm wondering if they could be. The code rewrite I did required a 'sys_tick' override, and it's somewhat complex, so I'm not all that thrilled with it. I just couldn't find another way to do it, since there is no hook on the party turning (moving, yes, turning, no).
And, if I'm completely missing something, then someone let me know.
Party facing and off-center tilepos triggers
Moderator: Sophia
Forum rules
Please read the Forum rules and policies before posting.
Please read the Forum rules and policies before posting.
- Sophia
- Concise and Honest
- Posts: 4240
- Joined: Thu Sep 12, 2002 9:50 pm
- Location: Nowhere in particular
- Contact:
Yes there is. It's, rather fittingly, on_turn(direction).Remy wrote:there is no hook on the party turning
It's used in standard DM so you can turn on a stairwell and you will end up on the other level, but I think this will let you do what you wanted.
I looked at your code, and I'll also point out something else useful, even if you change your approach-- you need to dsb_export any global variables you want DSB to remember, like this:
Code: Select all
dsb_export("g_last_facing")