Comment on page
Rescue the Puppy
In this quest, you must first get the quest from one NPC, then go and save the lost puppy (another NPC), before they die. The time limit is not on the quest, but on the NPC, throwing in a new dynamic.
In this quest I want to demonstrate a few concepts. First, the quest will not be given until the player "talks" to an NPC by moving close to them. At that point the quest is started, and another NPC (the lost puppy) is notified via the QuestEvent mechanism. A timer starts, which will "kill" the dog if it runs out before the player finds them.
When the timer runs out, the dog will die, and notify the Blackboard, at which point the QuestCondition will fail. However, the quest is not set to Auto-fail, so the player will not know that they've failed until they find the dog.
When they find the dead dog, the quest will be set to complete via the in-game dialogue.
However, if the dog is still alive (timer has not run out), then the quest will be marked as complete as the dog will be rescued, sending a BlackboardNote with that data. The quest will not be completed until the player returns to the original NPC to "Turn in" the quest.
At least one QuestCondition requires an Object ID as the Blackboard Topic. This can be taken from the owner of the GameQuest, set manually at runtime (often when the quest is assigned), or set in the inspector.
This Quest sets the Object ID as "Puppy". We know in the demo there will only be one object with this ID, so it's fine to just set it now.
The QuestCondition objects "NPC Is Rescued" and "NPC Is Dead" are set up the same, but with opposite outcomes. Both are met if
true, and they can be used in many situations, with different quests, as the Blackboard Topic is marked as "Use Object Id", rather than a fixed value.