Panic Switch

Created with Sketch.

Panic Switch

I’ve got switches working great using a single variable and modifiable terrain. So I can have stuff move on a switch, change on command and stay that way afterwards. The basic code I’ve written is nice and portable and should be cool for almost everything else in the Cliff level and anything else in the game that needs switches like doors and stuff. The new code uses a single variable system unlike the more complex multiple variable system code that I’ve written before. Now I can have different stuff have different timings and wholly different triggers so I can have more than 1 on a page at the same time. So I’m liking that.
The problem that I’ve run into is what happens when you die. Not in a spiritual sense mind you, since there’s no “Burn in Hell Forever” function, but in a mechanical one. Basically, if you are killed by a scripted event I need to reset the scripted event. It’s not a huge issue, but the scripting and the Death() functions don’t talk to each other. In other words, I can’t have scripting run off this command:

If You Just Died…
Do Stuff
Reset Other Stuff

There’s no way to pass a variable from the Reaper Function to the scripting. Unless I rewrite it that is. I’m thinking that I need to add a bit to the Death Function that basically tells it to reset some stuff if the Story Progress variable is something specific. Then at least I’ll have something that can be passed. Of course when we do some logic we get:
1) Trigger a switch->Die -> Reset Switch
2) Trigger a switch -> Do a different scripted event and update the StoryProgress variable -> Die -> Reset variables, but not switch
3) Trigger switch -> Do different scritped event -> Return to first screen, trigger different switch-> Die -> Reset Variables, but not the original switch or the one that killed you.

You see, in the 3rd place it’s possible to have an event carry over from a previous life. Like some kind of polite poltergeist. Basically, I’m thinking about the screen that I’ve built yesterday. It has 2 triggered blocks that fall and could squish you. In the 3rd test case if you trigger the first one and then move on and do something else, the game will update the Story Progress variable. If you come back and trigger the other switch and it kills you, the Story Progress variable is no longer relevant to the event, so it would not reset the switch that killed you. In effect making an event from a previous relevant to your current endeavors. That’s not good, at least not in this context. It’s just sloppy scripting.
So, I’m thinking that I’ll trigger stuff off screen sometimes. Basically, if you get past a scripted event without triggering all of the stuff in it, the next event should clean it up. So in the test case, if you do a different event and come back, the switches are all already triggered, even if you missed them. So if you die, no problem, since nothing you caused is being carried over. I may decide later that I hate it, but it works in the context of the level and as I think of it, nothing else in the game really has scripting like the cliffs do.
Thanks for the help internet!

-In non-dev crap I’m playing Tenchu: Shadow Assassins and finding I enjoy it quite a bit. The sword fighting is crap, so I avoid it at all costs. There’s been some griping that the basic concept has changed. In previous games the areas were more free form and game the option to try different things. That was great but I frequently got the idea that I was doing something incorrectly and the stab wounds to prove it. TSA is a lot more linear and that’s okay. Each encounter is now presented as a stealth puzzle to figure out and when I break somebodies, um, everything (with Wii-mote action!) I get the feeling that I’m smart and I like that feeling. Then I feel dumb at the end when it gives me a D grade. Apparently I’m a less than average ninja.

-Wow, 3 exclamation marks? Wait…one…two…hmm, just 2 I guess…Three! Ah, there it is.