[HOWTO] How To: Revert Quest Node States If Conditions Are No Longer True

Announcements, support questions, and discussion for Quest Machine.
Post Reply
User avatar
Tony Li
Posts: 20723
Joined: Thu Jul 18, 2013 1:27 pm

[HOWTO] How To: Revert Quest Node States If Conditions Are No Longer True

Post by Tony Li »

Quests sometimes have conditions that, once true, can become untrue. For example, if a quest requires the player to have a certain amount of an item, the player could acquire that amount and then lose some of them. In this case, you may want to "roll back" the quest to wait for the player to regain the required amount of the item.

To do this, add a node that checks if the player no longer has enough of the item. If this node's conditions becomes true (i.e., not enough items), revert the state of the quest.

Here's an example from the Inventory Pro integration, although this concept works just as well for any quest, not just Inventory Pro:

revertQuestNodeOnLoseItems.png
revertQuestNodeOnLoseItems.png (54.53 KiB) Viewed 3677 times

This was auto-generated by Quest Machine's procedural quest generator, but you can do the same thing with hand-written quests. When the "Fetch 5 Apples" node becomes successful, it activates two nodes: "Talk to Villager" and "Revert Fetch 5".

The "Revert Fetch 5" node checks if the player has less than 5 apples. If so, it sets the nodes back to a state where the "Fetch 5 Apples" node is active again. Since it was auto-generated, the node IDs shown in the Actions section aren't as human-readable as they could be if you made the quest by hand. but it should convey the idea. The node whose ID is "1" is the "Fetch 5 Apples" node, BTW.

Note: If reverting the quest and setting the previous node active doesn't cause it to trigger its condition when true, set the previous node inactive first and then active.
Post Reply