Creating mods/EventTriggers

**EventTriggers** define what behavior causes a certain event to start. Daily dialogs don't need triggers, but every other event you want will need some sort of trigger. This includes heart events, unlocking a new character, or any sort of quest event you might want to create. There are many different types of triggers, but mostly you'll be using AreaChange and Dialog triggers. To create a chain of events, you'll also want to set a "**requiredFlag**" on those events. We discuss each of them in detail below:

## Event Trigger Examples

Event Triggers can be set up as **AreaChange** events, like this:

```
 {
 "eventName": "LandingEventInside",
 "eventTrigger": "AreaChange",
 "eventFileLocation": "Events",
 "inArea": "InsideAdministrationBuilding"
 },

```

That example triggers the area named **LandingEventInside** whenever the player enters the administration building.

```
 {
 "eventName": "LandingEventWithHailey",
 "eventTrigger": "Dialog",
 "talkTo": "Hailey",
 "eventFileLocation": "Events",
 "inArea": "InsideAdministrationBuilding"
 },

```

The above example is a dialog based trigger. It triggers when talking to Hailey, and in this example it requires you to be inside the administration building. If you want to create a followup event, you can use a **requiredFlag** like this:

```
 {
 "eventName": "LandingEventFollowup",
 "eventTrigger": "Dialog",
 "talkTo": "Emma",
 "eventFileLocation": "Events",
 "requiredFlag": "LandingEventWithHailey"
 },

```

In this above example, the LandingEventFollowup will trigger, but it requires you to have seen the LandingEventWithHailey event. Note that you can set flags in dialog with the "SetFlag" command, or whenever the event with that name is triggered. This is a simple followup event, and you can make a chain of them.

## Event Trigger Parameters

* eventName - Required: What's the name of the event that this will trigger?
* eventTrigger - Required: One of the trigger types
* eventFileLocation - Required: What's the name of the file that this event is in?
* requiredFlag - Optional: Only trigger this event if this flag is set.
* requiredFlag2 - Optional: If you have a second requiredFlag, this flag must also be set for the event to trigger.
* talkTo - If you're doing a Dialog event, this is required. It also specifies who the minFriendship check is looking at.
* inArea - Optional: Only triggers when you're in the area with this name.
* minTime - Optional: Min time of day. 6 = 6 am, 22 = 10 pm. Time must be after the min for the event to trigger.
* maxTime - Optional: Max time of day. 6 = 6 am, 22 = 10 pm. Time must be before the max.
* minFriendship - Will only trigger with this friendship level. Each heart is worth 20. So someone's first heart event should occur at 20, second at 40, etc.
* questStarted - Only trigger if they have a quest with this name in the start phase.
* questFinished - Only trigger if they have a quest with this name in the start phase.
* relationshipStatus - Only trigger if they have a relationship with the below person in this stage. Options are: Normal, Dating, JustFriends, FormerlyDated, Married, MovedIn, MovedInOrBetter (which means, MovedIn or Married)
* relationshipWith - The name of the person you are checking the relationship status with using relationshipStatus
* relationshipWith2 - Check the relationship of a second person too.
* relationshipStatus2 - Check the relationship of a second person too.

## All Event Trigger Types

* Dialog - Trigger when you talk to the person specified in the "talkTo" parmeter.
* AreaChange - Trigger when you enter the area specified by the "inArea" parameter.
* Wakeup - Triggers when you wake up (you can use the inArea parameter to see where they slept)
* WaterCrop - Triggers when you water a crop. Mostly useful for tutorial style stuff.
* PlantSeed - Triggers when you plant a seed. Mostly useful for tutorial style stuff.
* GatherIntroScrap - Triggers anytime you gather scrap. Really only intended for the tutorial.
* HarvestCrop - Triggers when you harvest a crop.
* BoughtBlueprint - Bought a blueprint. (Used in the marsh boots quest)
* ShipNow - Shipped something. (Used in the Miles missions)
* GatherCrafted - Crafted something at a workbench or removed a crafted item from the workbench.
* ForageItem - Foraged for a seed from a bird nest.
* NeverTriggers - This event will never trigger, so it's useful for events you want to mark that only happen from other code. Good for testing.
* HoeField - Hoe a field
* PlayerConstruction - Constructed a major colony item. This means the bridge, upgrading a house, the town expansion, etc. This trigger tends to get used to track major progression.
* SampleAnimal - Get a DNA sample from an animal.
* FeedAnimal - Feed an animal.
* HarvestAnimalProduct - Get a product from an animal.
* ForageMiningNode - Get some ore from a mining node. (Used in the "GemsForMiles" quest)