Goals Triggers and Regions

## Objective

The goal of this guide is to introduce you to the basic of Goals, Triggers, and Regions. These are key for creating story elements and interactions. We will create a goal for the scene created in A Simple Shootout and add some narration text upon entering a room.
This guide will go over:

1. Creating Goals
2. Creating Regions
3. Creating Triggers
4. Applying Triggers to Goals/Regions

## Creating a Goal

First off we'll setup an objective for the scene. Goal, along with trigger, can be created in the Scene Data window and modified in the Properties window.

1. Right-Click **Goals** -> Select **Create Scene Goal**
2. Select **New Scene Goal**
3. Set a name for your Goal in the Properties window. (e.g. "Kill all Lonestar")
4. Change **Default Status** from **Hidden** to **Started**

### Creating a Trigger

Without some way of tracking what the player has done, the Goal cannot do anything. We'll create a trigger that sets the goal status to "Success" once all of the Lonestar have been taken care of.

1. Right-Click **Triggers** -> Select  **Create Trigger**
2. Select **NewTrigger**
3. Double-Click **NewTrigger** to rename it (e.g. "g\_KillLonestar")

**When**

A **When Statement** is used to define when the Trigger will fire off. When a new **When Statement** is created it will default its condition to When combat enters a new Round**.** These can be changed by Right-Clicking the statement and selecting from a list of new ones.

1. Click  to add a new **When Statement**
2. Right-Click the Statement -> Select On Actor Death

The statement should read:

When (Triggering Actor) kills (Triggering Target Actor)

This means the trigger only fires off when an Actor dies.

**If**

**If Statements** are used to define more conditions that need to be met before a Trigger fires off. We will set the trigger to only fire off if the Actor that dies is on the Lonestar team.

1. Click  to add a new **If Statement**
2. Right-Click **No Condition** -> Select Compare Actor Team
3. Right-Click **Triggering Actor** -> Under **Functions** Select **Triggering Target Actor**
4. Right-Click **Shadowrunners** -> Under **Preset Values** Select **Lonestar**

Almost there, we need one more if statement, otherwise trigger would go off every time a Lonestar Actor died. To avoid this we'll create a check that checks for the remaining number of Lonestar members"

1. Click  to add a new **If Statement**
2. Right-Click **No Condition** -> Select Evaluate Team Survival
3. Right-Click **(0)** -> Input **100**
4. Right-Click **Shadowrunners** -> Under **Preset Values** Select **Lonestar**

**Do**

Now that the trigger is setup with the appropriate conditions what do we do? We create a new **Do Statement** that sets the Goal status to **Success**.

1. Click  to add a new **Do Statement**
2. Right-Click **No effect** -> Under **Gameplay** Select Set Goal Status
3. Right-Click **Hidden** -> Under **Preset Values** Select **Success**

By default **Set Goal Status** uses the first goal in the scene. Since we only have one goal, the option defaulted to the one we created.

## Narration Pop-Up

To give the player a specific experience when one of their characters enters a part of the map, we want to create a Region that covers that part of the map. We will then create a trigger that does something once the region has been entered.

### Creating a Region

A Region is a way of defining an area for a different kinds of triggers. Regions are found in the Scene Contents window along with Actors, Interactable Props, and Paths.

1. Right-Click **Region** -> Select **Add New Region**
2. Resize and Position the Region
	* The region indicator defines the Regions origin while the gear lets you resize it.
3. Set a name for the Region in the Properties window (e.g. "Enter Room")

### Setting up a Trigger

Now that the region is defined lets set what happens when it is interacted with.

1. Right-Click **Triggers** -> Select  **Create Trigger**
2. Select **NewTrigger**
3. Double-Click **NewTrigger** to rename it (e.g. "rgn\_EnterRoom")

**When**

1. Click  to add a new Statement
2. Right-Click the Statement -> Select On Region Enter

Similar to **Get Goal Status**, the **On Region Enter** statement defaults to the first Region.
The statement should read "When an Actor enters a the Region" meaning this trigger fires when an Actor enters the new region.

**If**

The default Compare Actor Team statement will handle our needs.

1. Click  to add a new **If Statement**
2. Right-Click **No Condition** -> Select **Compare Actor Team**

This trigger will now only fire if the Actor is a member of team **Shadowrunners**.

**Do**

1. Click  to add a new *Do Statement*
2. Right-Click **No effect** -> Under **Dialogue** Select Display Text over Actor
3. Right-Click **Triggering Actor** -> Under **Existing Actors** select a **Lonestar Member**
4. Right-Click **(Text)** -> Select **Click to Enter Text** (e.g. "I hear something")

Lets add one more **Do Statement**.

**Do**

1. Click  to add a new **Do Statement**
2. Right-Click **No effect** -> Under **Dialogue** Select Display Text at Screen Position
3. Right-Click **(Text)** -> Select **Click to Enter Text** (e.g. "You hear the distinctive sounds of guns being readied for action.")

## Testing the Scene

With everything in place it is time to test the scene. This requires the game client to be running with the content menu open.

1. Select **Tools** -> **Test Scene**
2. Select **Hire Main Character** from the **Main Character Override** drop down
3. Click the **Test Scene** Green Arrow
4. Switch focus to the Shadowrun Returns game client
5. Click **Continue** when the scene has finished loading