---
description: >-
  This demo quest requires the player to walk through three colorful cubes --
  red, green, blue -- which unlocks the "Lucky Treasure".
---

# Push the Button

### Quest Details

In the Demo Scene, there's a big red cube. When the player walks into the cube, it disappears, and a green cube appears. Walking into that makes it disappear and a blue cube appear. Finally, walking into the blue cube makes it disappear, and also completes a Quest.

{% hint style="success" %}
While much of the Quest system is built for you, the nuances of how Quests work in your game is unique to your game, and some custom coding may be required to handle specific circumstances. The cubes and trigger scripts on them in the demo scene are an example of how you may create custom scripts to push data into the Quest system.

View the "Red Zone" object in the Inspector to see the scripts "Color Cube Zone Trigger" and "Quest Trigger Bool" to see how those work.
{% endhint %}

_View the Quest object in the Inspector:_ _`Assets/InfinityPBR/---Game Modules/_Demo Files/Demo Files - Quests/Demo - Group Quests`_

The Quest is called **"Push the Buttons"**. In the Inspector, we can see that the **Quest** will _Subscribe to Blackboard_. This is required for a quest to auto complete or fail, as it will use the **Blackboard** to get the data it needs to know whether **Quest Conditions** have been met.

_Sequential Steps_ is also true, which means the **Quest Steps** will be checked only if the prior steps have been completed successfully. Otherwise, all Quest Steps will be checked for success or failure at all times, and can be completed in any order.

{% hint style="success" %}
When _Sequential Steps_ is true, it is possible for **Quest Steps** later in the list to be completed prior to an earlier step. The system will not check the later steps until prior steps are completed. If a step is marked complete and the next step is already complete, it will also be marked complete on the next frame.
{% endhint %}

_Auto Succeed_ is also marked true. This means the system will automatically check if the Quest succeeds or fails. In this demo, there are no failure conditions, so the _Auto Fail_ option has no impact.

### Completion

In the demo scene, the "Lucky Treasure" button starts out red, and is locked. Clicking the button will show a Debug.Log indicating the treasure is locked. View the "Lucky Treasure Box" object in the Inspector to see action for the UI Button, and the _DemoQuestLockedBox.cs_ component.&#x20;

This script controls the logic for the box, and is also the receiver for **QuestEvent** objects.

<figure><img src="https://2431624982-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MY3N_li2jPq7az6mYfq%2Fuploads%2FADpVQrXZE0bGYRt60Taa%2FScreenshot%202022-12-26%20at%202.05.28%20PM.png?alt=media&#x26;token=571e799c-5e99-4915-bb3b-2d291f72497e" alt=""><figcaption><p>Inheriting from QuestFollower provides the basic plumbing required, but Quest DemoLockBox.cs has the specific logic for its own purposes.</p></figcaption></figure>

{% hint style="info" %}
_DemoQuestLockedBox.cs_ inherits from _QuestFollower_, which is a script you can use in your own project. _QuestFollower_ implements _IFollowQuests_ and has all the needed methods for doing so.

You can override the `Receive()` method to run your own logic depending on the use case in your project.
{% endhint %}
