FCS: AI Packages

### Overview

AI Packages are a list of actions that a squad can take based on different triggers and conditions. They decide how the squad as a whole will behave when active.

### Data

* **General**
	+ **Clears Existing Jobs:** ???
	+ **Signal Func:** A list of parameters that can control when the package ends. Can also select special ***targets*** for certain goals to use.
	+ **Unloaded Func:** A list of actions that a squad can perform while unloaded.

* **Sidebar Addons**
	+ **Contract End Dialogue Delivery:**
	+ **Contract End Talk Passive:**
	+ **Inherits From:** Makes it so the package will also included goals contained in these packages.
	+ **Leader AI Goals:** Can insert goals for the leader of the squad to perform.
	+ **Leads To:**
	+ **Slave AI Goals:** Can insert goals for characters enslaved by the squad to perform.
	+ **Squad AI Goals:** Can insert goals for the squad to perform, not counting the leader.
	+ **Squad2 AI Goals:** Can insert goals for the second group of the squad to perform (specified by the squad). Will override the squad goals.

### Adding Goals

AI goals determine actions that the different members of the squad perform. Goals will become active in each list based on their priority, specified time of day, whether or not they override combat, and individual triggers needed to perform that action. To find additional information on what each goal does, check their enum and compare it to the list found in the goals page.

### Triggering Packages

There are multiple ways to give squads packages. This may include:

* Adding the package(s) to the squad directly in the FCS. If multiple packages are given to a squad, they may switch between them depending on their signal functions.
* Giving them a possibly time-sensitive AI Contract via the dialogue menu. This will take priority over the squad's normal packages until the contract expires.
* Replacing the squad package in the dialogue menu.

### Signal Functions

Determines the conditions that cause this package to end. Also controls how the package chooses its main ***target*** for goals.

* **None**
* **Retreat Cannibal Raid**
* **At Safe Town**
* **At Home Town**
* **Cannibal Start Patrol**
* **Squad Not Intact**
* **Start Patrol**
* **Diplomat Mission**
* **Defeat Squad**
* **Home Owner Keep Locked**
* **Gather Up All Local Prisoners**
* **Slaver Ship to Workcamp**
* **Bodyguard**
* **Become Ex Slave**
* **Out of Danger**
* **Defend Player Town Timed**
	+ Makes the player's town the ***target*** for goals.
	+ Ends when the specified amount of hours in the dialogue effect has passed.
	+ Used for merc contract jobs.
* **Wandering Town to Town**
	+ ***Targets*** nearby towns and outposts.
	+ Typically used by goals with the "wandering trader" enum.
	+ May end and temporarily switch to a lower priority package once the squad reaches their destination.
* **Hang Out at Bar**
* **Raiding Weak Villages**
* **War Gather Forces**
* **War Assault Town**
* **War Battle Meeting**
* **Refugee Disband**
* **Start Patrol Running**
* **Gather Up All Local Prisoners Unholy**
* **Retreat Cannibal Raid to Nearest Nest**
* **Hang Out Outdoors Only**
* **Cannibals At Home**
* **Slaver Ship to Anywhere Close**
* **Passing By Town Assault**
	+ Used by attacking patrols when they happen across a player base.
* **Occupy Conquered Town**
	+ Seems to be activated by selecting this as the "Leads To" package from a different package. Presumably mostly used by packages with the "Passing By Town Assault" signal function.
* **Defend Player Town Campaign**
* **War Assault Town Cannibal**
* **Timed Contract**
	+ Package is given to the squad by the "AI Contract" dialogue effect. The ***target*** of the package is the same as the target of the dialogue event (So if the squad spots a random neutral and receive a contract to bodyguard them in that event, they will protect whichever neutral character it was that they spotted).
	+ Ends when the specified amount of hours in the dialogue effect has passed.
	+ Usually what is used by contract jobs

### Unloaded Functions

These are what squads do when not in the loaded area.

* **None**
	+ Squad does nothing
* **Patrol Town**
* **Patrol Shortrange**
* **Patrol Longrange**
* **Go Home**
	+ Squad goes to their home building.
* **Travel Target**
	+ Travels to the ***target*** destination, such as when mercenaries travel to the player town when they are hired to defend it.
* **Travel Target Fast**
	+ Same as Travel Target, but at a running pace.