# Quest Conditions

**Quest Conditions** are the things that must be (i.e. must be true, or must be false), for a Quest Step to be marked a success or failure -- which in turn marks a Quest as successful or a failure.

There are many types of Quest Conditions, and you can also create your own, which is very useful when you have unique mechanics in your game which may be part of a condition comparison.

Quest Condition scripts all inherit from `QuestCondition`, but have unique methods based on the comparison they are evaluating.

{% hint style="info" %}
Many things can be checked using the included Quest Conditions. For example, any quest that requires a comparison to a number -- ANY number -- can use [**Blackboard Value Number**](/magic-pig-games/game-modules-4/module-documentation/quests/quest-conditions/quest-condition-details/blackboard-value-number.md).

You will need to ensure the number you care about is being posted to the [**MainBlackboard**](/magic-pig-games/game-modules-4/module-documentation/blackboard.md), but once that is the case, quests which utilize that Quest Condition will find it.
{% endhint %}

## Where are the Quest Condition scripts?

See all included Quest Condition scripts: `Assets/InfinityPBR/---Game Modules/Quests/Scripts - Quest Conditions/`

## How to create a Quest Condition object

Navigate to the folder in your project where you wish to store your Quest Condition objects. Right-click in the project view and choose `Create/Game Modules/Quest Condition/[Comparison Of Choice]`

<figure><img src="/files/htTJwV3UzR9RP1wSMNzt" alt=""><figcaption><p>All QuestCondition comparison scripts will show in this list.</p></figcaption></figure>

## Create your own Quest Conditions

While the Game Modules ships with many Quest Condition comparison types, and more will likely be added over time, you may want to create your own Quest Conditions. This is very useful when you have unique mechanics and concepts in your project, and you'd like to use those unique things with the Quests module.

While this does require some scripting, it is likely easier than you think!

{% content-ref url="/pages/qxaHD1j5QclrB2SJ5sVx" %}
[Create a Custom Quest Condition](/magic-pig-games/game-modules-4/module-documentation/quests/quest-conditions/create-a-custom-quest-condition.md)
{% endcontent-ref %}

## Quest Conditions

{% hint style="success" %}
Keep in mind Quest Conditions are not themselves a "Success" or "Failure". They are simply a fact that is either true or false. The condition is "met" when the fact is true.

"The King is Dead", an example on the [Blackboard Value Bool](/magic-pig-games/game-modules-4/module-documentation/quests/quest-conditions/quest-condition-details/blackboard-value-bool.md) page, does not specify whether it is a good or bad thing that the king is dead. Simply:

&#x20;"The condition is met when the bool value of the Blackboard Note with the Topic *'King'* and Subject *'Is Dead'* is true."

Your Quest may consider this to be a failure -- you let the king die -- or a success -- you successfully killed the king. Entirely up to you and your game.
{% endhint %}

### Common Blackboard Settings

<figure><img src="/files/LXgB1Lo3SFGePpLWyutC" alt=""><figcaption></figcaption></figure>

All Quest Condition objects will have this section, specifying the [Blackboard Note "Topic" and "Subject"](/magic-pig-games/game-modules-4/module-documentation/blackboard/blackboard-note.md) which will contain the data the condition cares about. When querying whether the condition has been met, these are the values the Quest Condition will look for on the `MainBlackboard`.

#### Use Game Id

When true, the "Topic" will be the value of `GameId()` for the object which owns this quest. This is useful when you don't know what the `Topic` will be -- such as situations where the Actor is not known at edit time, perhaps  because the actor is an enemy or other NPC.

#### Use Quest Name/Step

When true, the "Subject" we will be looking for will be a combination of the Quest Name and Quest Step Name, in this format: "Quest Name-Quest Step Name".&#x20;

*(Note, if there are spaces in the names, they will be included in this string. The dash between each section does not contain spaces before or after it.)*

This is useful when you don't know which Quest or Quest Step the Quest Condition will be included in, but need to get information out of that Quest/Step.

{% hint style="info" %}
In some cases, the data will be automatically populated, or could be so as an option, such as with `Stat` values. In other cases, you will need to post notes to the Blackboard through the normal course of your game.

Most likely you'd post a Blackboard Note to `MainBlackboard` for "King" "Is Dead" with the `bool` value `true` when the king has died.
{% endhint %}

#### Details of each Quest Condition shipped with Game Modules

{% content-ref url="/pages/dd5LqJWgLqn88rdGDU2f" %}
[Blackboard Value Bool](/magic-pig-games/game-modules-4/module-documentation/quests/quest-conditions/quest-condition-details/blackboard-value-bool.md)
{% endcontent-ref %}

{% content-ref url="/pages/C4OER6JUVP9JCjH0DYnD" %}
[Blackboard Value GameObject](/magic-pig-games/game-modules-4/module-documentation/quests/quest-conditions/quest-condition-details/blackboard-value-gameobject.md)
{% endcontent-ref %}

{% content-ref url="/pages/ArLJWks7aytEGC94zQjb" %}
[Blackboard Value Number](/magic-pig-games/game-modules-4/module-documentation/quests/quest-conditions/quest-condition-details/blackboard-value-number.md)
{% endcontent-ref %}

{% content-ref url="/pages/rrbSwLSuRT2F0DFRNdSg" %}
[Blackboard Value String](/magic-pig-games/game-modules-4/module-documentation/quests/quest-conditions/quest-condition-details/blackboard-value-string.md)
{% endcontent-ref %}

{% content-ref url="/pages/jpU0eLCNS02kvhkjEqgK" %}
[Final Stat Is](/magic-pig-games/game-modules-4/module-documentation/quests/quest-conditions/quest-condition-details/final-stat-is.md)
{% endcontent-ref %}

{% content-ref url="/pages/UtpmySoGotISpBL3vMzV" %}
[Game Condition List Contains](/magic-pig-games/game-modules-4/module-documentation/quests/quest-conditions/quest-condition-details/game-condition-list-contains.md)
{% endcontent-ref %}

{% content-ref url="/pages/B55hqxzbduWYAnGheXhT" %}
[Game Item Object List Contains](/magic-pig-games/game-modules-4/module-documentation/quests/quest-conditions/quest-condition-details/game-item-object-list-contains.md)
{% endcontent-ref %}

{% content-ref url="/pages/7p0aiwnDBtubp5zrOUp1" %}
[Game Stat List Contains](/magic-pig-games/game-modules-4/module-documentation/quests/quest-conditions/quest-condition-details/game-stat-list-contains.md)
{% endcontent-ref %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://infinitypbr.gitbook.io/magic-pig-games/game-modules-4/module-documentation/quests/quest-conditions.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
