# Create a Blackboard

We can add conditions and effects that control how the agents search the tree. Searching a tree will validate conditions against the agent's blackboard. Completing nodes will apply its effects to the agent's blackboard.

<figure><img src="https://3724840250-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FwrNt0ljEuQ5gsxIfJNfv%2Fuploads%2FamXIDWTE72Eg2tA0i6g1%2Fimage.png?alt=media&#x26;token=6e8375b5-3b8f-44ae-b3f5-aa5add37969e" alt=""><figcaption><p>Conditions and effects.</p></figcaption></figure>

To start using conditions and effects in our trees we need to first create a blackboard and assign it to the tree asset (Assets->Create->BadgerHTN->Blackboard).

<figure><img src="https://3724840250-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FwrNt0ljEuQ5gsxIfJNfv%2Fuploads%2F6vb6F5r12Q6TGnpiK6KF%2Fimage.png?alt=media&#x26;token=a88ef90b-d7f2-46e1-8b43-a4d912ddd38b" alt=""><figcaption><p>Assign a blackboard.</p></figcaption></figure>

You can then start adding keys to your new blackboard that will show up when you select a node in the tree view.

<figure><img src="https://3724840250-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FwrNt0ljEuQ5gsxIfJNfv%2Fuploads%2FXamsBfryYlYnTcTWUV8f%2Fimage.png?alt=media&#x26;token=96b97f43-c92c-437d-a3aa-7bacaa68c0be" alt=""><figcaption><p>Adding a key.</p></figcaption></figure>

Clicking a node in the tree view will show all blackboard keys. Clicking the plus icon in the conditions view will add "IsAlive" as a condition to the "Wander" node.

<figure><img src="https://3724840250-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FwrNt0ljEuQ5gsxIfJNfv%2Fuploads%2FmKm4FThYnRdrhLjMBv7Y%2Fimage.png?alt=media&#x26;token=ea6314a5-dc69-45b4-aaa5-181613b86b7c" alt=""><figcaption><p>Adding a conditon.</p></figcaption></figure>

Updating the agent's "IsAlive" blackboard key can be done by adding it as an effect in the tree view or through code.

```
public class GameSystem : MonoBehaviour
{
    public void Update()
    {
        var blackboard = GetComponent<BadgerComponent>().Agent.Blackboard;
        blackboard.Set("IsAlive", true);
    }
}
```
