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(string
key, string
faction_key, string
force_list, object
spawn_location)
-
Adds a new invasion to the invasion manager
Parameters:
1
string
The key of this invasion
2
string
The key of the faction that this invasion belongs to
3
string
The units that will be part of this invasion
4
object
Pass either a table of x/y coordinates or a string for the key of a preset location
Returns:
invasion
The new invasion object created by this function
defined in ../../warhammer/working_data/script/_lib/lib_campaign_invasion_manager.lua, line 30
-
invasion_manager:new_invasion_from_existing_force(string
key, force_interface
force)
-
Adds a new invasion to the invasion manager created from an existing force
Parameters:
1
string
The key of this invasion
2
force_interface
The existing force to use with this invasion
Returns:
invasion
The new invasion object created by this function
defined in ../../warhammer/working_data/script/_lib/lib_campaign_invasion_manager.lua, line 103
-
invasion_manager:new_spawn_location(string
key, number
x, number
y)
-
Create a new spawn location that can be used later by referencing its key
Parameters:
1
string
The key of this location
2
number
The X coordinate of this location
3
number
The Y coordinate of this location
Returns:
nil
defined in ../../warhammer/working_data/script/_lib/lib_campaign_invasion_manager.lua, line 170
-
invasion_manager:get_invasion(string
key)
-
Returns an invasion from the invasion manager by its key
Parameters:
1
string
The key of the invasion object
Returns:
invasion
The invasion object with the key provided
defined in ../../warhammer/working_data/script/_lib/lib_campaign_invasion_manager.lua, line 252
-
invasion_manager:remove_invasion(string
key)
-
Removes an invasion from the invasion manager by its key
Parameters:
1
string
The key of the invasion object
Returns:
nil
defined in ../../warhammer/working_data/script/_lib/lib_campaign_invasion_manager.lua, line 264
-
invasion_manager:kill_invasion_by_key(string
key)
-
Kills an invasion via the invasion manager, see the kill function on the invasion object for details
Parameters:
1
string
The key of the invasion object
Returns:
nil
defined in ../../warhammer/working_data/script/_lib/lib_campaign_invasion_manager.lua, line 275
Invasion
-
invasion:set_target(string
target_type, object
target, string
target_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
string
The type of the target
2
object
The actual target
3
string
The faction that is the indended target
Returns:
nil
defined in ../../warhammer/working_data/script/_lib/lib_campaign_invasion_manager.lua, line 306
- 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 354
-
invasion:add_aggro_radius(number
radius, table
target_list, number
abort_timer)
-
Add an aggravation radius to this invasion in which the force will attack all specified targets that enter its aggro range
Parameters:
1
number
The radius of the aggrevation range at which this invasion will trigger an attack
2
table
A table containing faction keys of all the factions that will trigger an attack. If nil, will target any warring factions
3
number
The number of turns after which this invasion will give up after chasing a target
Returns:
nil
defined in ../../warhammer/working_data/script/_lib/lib_campaign_invasion_manager.lua, line 363
-
invasion:remove_aggro_radius()
-
Removes all aggravation behaviour from this invasion
Returns:
nil
defined in ../../warhammer/working_data/script/_lib/lib_campaign_invasion_manager.lua, line 384
-
invasion:abort_on_target_owner_change(boolean
abort)
-
Sets if the Invasion will abort if the owner of the target differs to the Invasions faction target
Parameters:
1
boolean
Will abort if true
Returns:
nil
defined in ../../warhammer/working_data/script/_lib/lib_campaign_invasion_manager.lua, line 397
-
invasion:assign_general(character
character)
-
Sets a General to be used when spawning this invasion
Parameters:
1
character
The 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 405
-
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
boolean
If True this character will become the faction leader
2
string
The key of this characters intended subtype
3
string
The name key of this characters forename
4
string
The name key of this characters clan name
5
string
The name key of this characters family name
6
string
The name key of this characters other name
Returns:
nil
defined in ../../warhammer/working_data/script/_lib/lib_campaign_invasion_manager.lua, line 416
-
invasion:set_general_immortal(boolean
should_stop)
-
Sets whether the General leading this invasion should be immortal or not
Parameters:
1
boolean
General spawned will be immortal if True
Returns:
nil
defined in ../../warhammer/working_data/script/_lib/lib_campaign_invasion_manager.lua, line 437
-
invasion:should_stop_at_end(boolean
should_stop)
-
Sets the Invasion should not move after completing it's objective
Parameters:
1
boolean
Will stop if True
Returns:
nil
defined in ../../warhammer/working_data/script/_lib/lib_campaign_invasion_manager.lua, line 452
-
invasion:apply_effect(string
effect_key, number
turns)
-
Allows you to apply an effect bundle to the forces in this invasion
Parameters:
1
string
The key of the effect bundle
2
number
The 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 464
-
invasion:add_character_experience(number
experience_amount, boolean
by_level)
-
Allows you to add experience to the general in this invasion or set their level
Parameters:
1
number
The amount of experience to apply
2
boolean
If 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 484
-
invasion:add_unit_experience(number
unit_experience_amount)
-
Allows you to add experience to the units of the army in this invasion
Parameters:
1
number
The amount of experience to apply
Returns:
nil
defined in ../../warhammer/working_data/script/_lib/lib_campaign_invasion_manager.lua, line 516
-
invasion:add_respawn(boolean
respawn, number
respawn_count, number
respawn_delay)
-
Allow you to add a respawn to the invasion so that if it dies it will respawn a set amount of times after a set delay
Parameters:
1
boolean
If True this invasion will spawn after its force dies
2
number
The amount of times the invasion will respawn before stopping
3
number
The delay before respawning another time after the force respawns
Returns:
nil
defined in ../../warhammer/working_data/script/_lib/lib_campaign_invasion_manager.lua, line 534
-
invasion:should_maintain_army(boolean
maintain, number
respawn_count)
-
Allows you to set the invasion to maintain its army strength by adding a missing unit each turn with a percentage chance
Parameters:
1
boolean
If True this invasion will attempt to maintain it strength
2
number
The chance per turn to add one of its missing units
Returns:
nil
defined in ../../warhammer/working_data/script/_lib/lib_campaign_invasion_manager.lua, line 553
-
invasion:start_invasion(
maintain
function,
declare_war
[boolean],
invite_attacker_allies
[boolean],
invite_defender_allies
[boolean],
allow_diplomatic_discovery
[boolean]
) -
Starts the invasion, spawning its force if neccessary and handing control of the force over to the script instead of the A.I
Parameters:
1
function
If True this invasion will attempt to maintain it strength
2
boolean
optional, default value=true
If True the invasion will declare war on its targets
3
boolean
optional, default value=true
If True the invasion will invite its allies when declaring war
4
boolean
optional, default value=true
If True the invasions target will invite its allies when declaring war
5
boolean
optional, default value=true
If True the invasion manager will decide whether to allow diplomatic discovery for the spawned ai force; If false there will be no diplomatic discovery occurring for the spawned ai force (this additional optional parameter is being supplied because it can create a major slowdown)
Returns:
nil
defined in ../../warhammer/working_data/script/_lib/lib_campaign_invasion_manager.lua, line 568
-
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 1172
-
invasion:kill(boolean
general_only)
-
Kills this invasions General and the whole force (or just the General)
Parameters:
1
boolean
If 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 1189
-
invasion:get_general()
-
Returns the character leading this invasion force
Returns:
character
The general of the invasions force
defined in ../../warhammer/working_data/script/_lib/lib_campaign_invasion_manager.lua, line 1207
-
invasion:get_commander()
-
Returns the character that is the current leader of this force even if it is a colonel
Returns:
character
The commander of the invasions force
defined in ../../warhammer/working_data/script/_lib/lib_campaign_invasion_manager.lua, line 1221
-
invasion:get_force()
-
Returns the force interface of this invasion
Returns:
military_force
The military force belonging to the invasion
defined in ../../warhammer/working_data/script/_lib/lib_campaign_invasion_manager.lua, line 1247
-
invasion:has_target()
-
Checks if an invasion has a target
Returns:
boolean
Returns True if the invasion has a target
defined in ../../warhammer/working_data/script/_lib/lib_campaign_invasion_manager.lua, line 1257
-
invasion:has_started()
-
Checks if an invasion has started
Returns:
boolean
Returns True if this invasion has started
defined in ../../warhammer/working_data/script/_lib/lib_campaign_invasion_manager.lua, line 1264
-
invasion:turn_spawned()
-
Checks what turn this invasion was spawned on
Returns:
number
Returns 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 1271