Invasion Manager
The Invasion Manager is used to create and manage scripted A.I invasions in the campaign
The primary purpose of the Invasion Manager is to created, hold and manage invasion objects
See the invasion section below for details on how to set up and begin invasions
| Loaded in Campaign | 
										 | 
								
| Loaded in Battle | 
										 | 
								
| Loaded in Frontend | 
										 | 
								
- 
							
invasion_manager:new_invasion(key
string,faction_key
string,force_list
string,spawn_location
object,is_CAI
bool,cai_personnality
string
) - 
							Adds a new invasion to the invasion manager
							
Parameters:
1
stringThe key of this invasion
2
stringThe key of the faction that this invasion belongs to
3
stringThe units that will be part of this invasion
4
objectPass either a table of x/y coordinates or a string for the key of a preset location
5
boolDefines if this invasion will be immediatly handed to CAI or controlled via scripts
6
stringCAI Personnality key to provide if the invasion is handled by CAI
Returns:
invasionThe new invasion object created by this function
defined in ../../Warhammer/working_data/script/_lib/lib_campaign_invasion_manager.lua, line 29
 
- 
							
invasion_manager:new_spawn_location(stringkey, numberx, numbery) - 
							Create a new spawn location that can be used later by referencing its key
							
Parameters:
1
stringThe key of this location
2
numberThe X coordinate of this location
3
numberThe Y coordinate of this location
Returns:
nil
defined in ../../Warhammer/working_data/script/_lib/lib_campaign_invasion_manager.lua, line 113
 
- 
							
invasion_manager:get_invasion(stringkey) - 
							Returns an invasion from the invasion manager by its key
							
Parameters:
1
stringThe key of the invasion object
Returns:
invasionThe invasion object with the key provided
defined in ../../Warhammer/working_data/script/_lib/lib_campaign_invasion_manager.lua, line 195
 
- 
							
invasion_manager:remove_invasion(stringkey) - 
							Removes an invasion from the invasion manager by its key
							
Parameters:
1
stringThe key of the invasion object
Returns:
nil
defined in ../../Warhammer/working_data/script/_lib/lib_campaign_invasion_manager.lua, line 207
 
- 
							
invasion_manager:kill_invasion_by_key(stringkey) - 
							Kills an invasion via the invasion manager, see the kill function on the invasion object for details
							
Parameters:
1
stringThe key of the invasion object
Returns:
nil
defined in ../../Warhammer/working_data/script/_lib/lib_campaign_invasion_manager.lua, line 225
 
- 
							
invasion_manager:generate_unique_invasion_key(stringoriginal_invasion_key - the key we want to use) - 
							returns a key that is not used for an active invasion - adds a number to the end of the original key if it is already used. tries at max 100 times as a sanity check
							
Parameters:
1
stringoriginal_invasion_key - the key we want to use
Returns:
akey that is not used for any invasion so far
defined in ../../Warhammer/working_data/script/_lib/lib_campaign_invasion_manager.lua, line 237
 
Invasion
- 
							
invasion:set_target(stringtarget_type, objecttarget, stringtarget_faction_key) - 
							Sets the target for an invasion
Target Types: REGION, CHARACTER, LOCATION, PATROL
- REGION - Requires the target to be set as a region key
 
- CHARACTER - Requires the target to be set as a character's CQI
 
- LOCATION - Requires the target to be set as a table containing an x and y variable, e.g. {x = 5, y = 3}
 
- PATROL - Requires the target to be set as a table containing any number of position tables, e.g. {{x = 5, y = 3}, {x = 9, y = 2}}
 Parameters:
1
stringThe type of the target
2
objectThe actual target
3
stringThe faction that is the indended target
Returns:
nil
defined in ../../Warhammer/working_data/script/_lib/lib_campaign_invasion_manager.lua, line 277
 - REGION - Requires the target to be set as a region key
 
- 
							
invasion:remove_target() - 
							Sets this invasion to no longer have a target
							
Returns:
nil
defined in ../../Warhammer/working_data/script/_lib/lib_campaign_invasion_manager.lua, line 329
 
- 
							
invasion:assign_general(charactercharacter) - 
							Sets a General to be used when spawning this invasion
							
Parameters:
1
characterThe general that will be used (can optionally be a character CQI)
Returns:
nil
defined in ../../Warhammer/working_data/script/_lib/lib_campaign_invasion_manager.lua, line 338
 
- 
							
invasion:create_general(make_faction_leader
boolean,agent_subtype
string,forename
string,clan_name
string,family_name
string,other_name
string
) - 
							Sets up a general to be created to command this invasion force when it is spawned
							
Parameters:
1
booleanIf True this character will become the faction leader
2
stringThe key of this characters intended subtype
3
stringThe name key of this characters forename
4
stringThe name key of this characters clan name
5
stringThe name key of this characters family name
6
stringThe name key of this characters other name
Returns:
nil
defined in ../../Warhammer/working_data/script/_lib/lib_campaign_invasion_manager.lua, line 349
 
- 
							
invasion:set_general_immortal(booleanshould_stop) - 
							Sets whether the General leading this invasion should be immortal or not
							
Parameters:
1
booleanGeneral spawned will be immortal if True
Returns:
nil
defined in ../../Warhammer/working_data/script/_lib/lib_campaign_invasion_manager.lua, line 370
 
- 
							
invasion:apply_effect(stringeffect_key, numberturns) - 
							Allows you to apply an effect bundle to the forces in this invasion
							
Parameters:
1
stringThe key of the effect bundle
2
numberThe turns the effect bundle will be applied for after the invasion is started
Returns:
nil
defined in ../../Warhammer/working_data/script/_lib/lib_campaign_invasion_manager.lua, line 385
 
- 
							
invasion:add_character_experience(numberexperience_amount, booleanby_level) - 
							Allows you to add experience to the general in this invasion or set their level
							
Parameters:
1
numberThe amount of experience to apply
2
booleanIf true the experience amount supplied will set the level of the character and not their xp
Returns:
nil
defined in ../../Warhammer/working_data/script/_lib/lib_campaign_invasion_manager.lua, line 405
 
- 
							
invasion:add_unit_experience(numberunit_experience_amount) - 
							Allows you to add experience to the units of the army in this invasion
							
Parameters:
1
numberThe amount of experience to apply
Returns:
nil
defined in ../../Warhammer/working_data/script/_lib/lib_campaign_invasion_manager.lua, line 437
 
- 
							
invasion:start_invasion(budget
number,unit count
number,declare_war
[boolean],invite_attacker_allies
[boolean],invite_defender_allies
[boolean]
) - 
							Starts the invasion, spawning its force if neccessary
							
Parameters:
1
numberIf >0 will spawn an army with such a budget
2
numberIf >0 will spawn an army with this unit count (when using a budget)
3
booleanoptional, default value=true
If True the invasion will declare war on its targets
4
booleanoptional, default value=true
If True the invasion will invite its allies when declaring war
5
booleanoptional, default value=true
If True the invasions target will invite its allies when declaring war
Returns:
nil
defined in ../../Warhammer/working_data/script/_lib/lib_campaign_invasion_manager.lua, line 456
 
- 
							
invasion:release() - 
							Releases the invasion force back to AI control
							
Returns:
nil
defined in ../../Warhammer/working_data/script/_lib/lib_campaign_invasion_manager.lua, line 1156
 
- 
							
invasion:kill(booleangeneral_only) - 
							Kills this invasions General and the whole force (or just the General)
							
Parameters:
1
booleanIf True only the Generate will be killed and the force will remain
Returns:
nil
defined in ../../Warhammer/working_data/script/_lib/lib_campaign_invasion_manager.lua, line 1177
 
- 
							
invasion:get_general() - 
							Returns the character leading this invasion force
							
Returns:
characterThe general of the invasions force
defined in ../../Warhammer/working_data/script/_lib/lib_campaign_invasion_manager.lua, line 1195
 
- 
							
invasion:get_commander() - 
							Returns the character that is the current leader of this force even if it is a colonel
							
Returns:
characterThe commander of the invasions force
defined in ../../Warhammer/working_data/script/_lib/lib_campaign_invasion_manager.lua, line 1209
 
- 
							
invasion:get_force() - 
							Returns the force interface of this invasion
							
Returns:
military_forceThe military force belonging to the invasion
defined in ../../Warhammer/working_data/script/_lib/lib_campaign_invasion_manager.lua, line 1235
 
- 
							
invasion:has_started() - 
							Checks if an invasion has started
							
Returns:
booleanReturns True if this invasion has started
defined in ../../Warhammer/working_data/script/_lib/lib_campaign_invasion_manager.lua, line 1245
 
- 
							
invasion:turn_spawned() - 
							Checks what turn this invasion was spawned on
							
Returns:
numberReturns the turn number that this invasion was started on, or 0 if it has not been
defined in ../../Warhammer/working_data/script/_lib/lib_campaign_invasion_manager.lua, line 1252