Hi
I'm having some trouble with objectives. Let's say I have a situation like this:
When I talk to any of 5 NPCs, they tell me how to enter the vampire's castle, and I set the objective active state to 2. "Go to the castle." Then I find the vampire, have a cutscene and chase him to the woods. Now, in the woods, with the vampire cornered, I'm in state 4. "Stake the vampire." But then I realize I need health potions so I return to town for some, and there I talk to one of those 5 NPCs, so now my state is back to 2.
This breaks the logic as when I return to the woods to face the vampire, my state should be 4. "Stake the vampire", but that random conversation with the NPC set it back to 2 "Go to the castle".
So far, the solution I use is far from ideal, as I have to create a lot of checks everywhere. Like having the NPCs only trigger the jump to state 2 if the state is 0 or 1.
Isn't there a simpler way? Like a way to prevent the state from moving backwards? Maybe an Objective.setState action list node with a condition (like setStageIfCurrentStateLower)?
Basically, I’m trying something like the technique from this GDC talk:
From the talk I gather that having the states (objectives) be high water marks (a state implies that all previous states conditions have been met) reduces complexity and bugs immensely.
It looks like you're new here. If you want to get involved, click one of these buttons!
Comments
Having a per-Objective option to only allow the active state to "move down" the states list might be worth adding. I'll give this some thought.
Quick note on your intel state: are you using sub-objectives? That lets you automate the switching to state 3 when you have a number of NPCs that you can potentially talk to - see the tutorial here.
That would be great!
The intel state in question was just a simplified example to illustrate a situation im having that is forcing me to have checks every time i use setStage. Its very easy to mess up the state of objectives.
Yes, I'll include this in the next release.