Army
Army
objects represent logical armies taking part in a battle. One or more armies fight together on each side of the battle in an battle_alliance
to contest victory.
An army contains one or more logical battle_unit
objects, which may be accessed through the battle_units
collection object that the army
provides.
Loaded in Campaign | |
Loaded in Battle | |
Loaded in Frontend |
Army
objects are derived from battle_armies
list objects in the battle_hierarchy
, which are themselves derived from battle_alliance
objects - see the battle_hierarchy
page for more information. Army
objects must be created in order to create script_unit
objects. Using the generated_battle
framework negates the need to explicitly create army
objects, however.
Once a handle to an army object is obtained, functions may be called on it to query or modify its state in the following form.
Example - Specification:
<object_name>:<function_name>(<args>)
Example - Creation and Usage:
local army_player = bm:alliances():item(1):armies():item(1)
local uc_player_01 = army_player:create_unit_controller() -- calling a function on the object once created
-
army:units()
-
Creates and returns a
battle_units
object listing all units in the army.Returns:
units listbattle_units
defined in ../../common/EmpireBattle/Source/BattleScript/BattleEditorScriptInterface.cpp, line 8066
-
army:faction_key()
-
Returns the key of the army's faction, from the
factions
database table.Returns:
faction keystring
defined in ../../common/EmpireBattle/Source/BattleScript/BattleEditorScriptInterface.cpp, line 8166
-
army:subculture_key()
-
Returns the subculture key of the army's faction, from the
cultures_subcultures
database table.Returns:
subculture keystring
defined in ../../common/EmpireBattle/Source/BattleScript/BattleEditorScriptInterface.cpp, line 8185
-
army:flag_path()
-
Returns the folder path of the flag icons used for the army's faction, from the
flags_path
field of thefactions
database table.Returns:
faction flags folder pathstring
defined in ../../common/EmpireBattle/Source/BattleScript/BattleEditorScriptInterface.cpp, line 8214
-
army:is_rebel()
-
Returns whether the army's faction is a rebel faction.
Returns:
is rebelboolean
defined in ../../common/EmpireBattle/Source/BattleScript/BattleEditorScriptInterface.cpp, line 8233
-
army:alliance()
-
Returns the alliance object to which the army belongs.
Returns:
parent alliancebattle_alliance
defined in ../../common/EmpireBattle/Source/BattleScript/BattleEditorScriptInterface.cpp, line 8252
-
army:enable_reinforcement(
spawn zone unique idnumber
)
-
Enables a reinforcement army to deploy from the spawn zone of the specified id, allowing it to start reinforcing. A reinforcing army must be enabled through some mechanism before it can enter the battle. In standard campaign battles, a reinforcing army is enabled through a player-facing timer - this function can be called to enable an army before the timer finishes, for example.
Parameters:
1
spawn zone unique id
Returns:
nil
defined in ../../common/EmpireBattle/Source/BattleScript/BattleEditorScriptInterface.cpp, line 8266
-
army:create_unit_controller()
-
Creates and returns a
battle_unitcontroller
object associated with this army. Consider using thegenerated_battle
orscript_unit
framework, or at least the helper functions documented in the sectionUnitcontroller Creation
rather than calling this directly.Returns:
unitcontrollerbattle_unitcontroller
defined in ../../common/EmpireBattle/Source/BattleScript/BattleEditorScriptInterface.cpp, line 8283
-
army:is_commander_alive()
-
Returns whether the army commander is alive or not.
Returns:
is commander aliveboolean
defined in ../../common/EmpireBattle/Source/BattleScript/BattleEditorScriptInterface.cpp, line 8298
-
army:is_commander_invincible()
-
Returns whether the army commander is invincible or not.
Returns:
is commander invincibleboolean
defined in ../../common/EmpireBattle/Source/BattleScript/BattleEditorScriptInterface.cpp, line 8315
-
army:is_player_controlled()
-
Returns whether this army is controlled by a human player.
Returns:
is player controlledboolean
defined in ../../common/EmpireBattle/Source/BattleScript/BattleEditorScriptInterface.cpp, line 8332
-
army:army_handicap()
-
Returns the army handicap, which indicates the difficulty level the battle is being played at. A returned value of 1 equates to easy difficulty, 0 to normal difficulty, -1 to hard difficulty and -2 to very hard difficulty.
Returns:
handicap valuenumber
defined in ../../common/EmpireBattle/Source/BattleScript/BattleEditorScriptInterface.cpp, line 8349
-
army:winds_of_magic_remaining_recharge_rate()
-
Returns the remaining recharge left for an armies magic pool. This is rate of recharge compared to max possible recharge rate. 0 is slowest speed, 1 is quickest.
Returns:
recharge ratenumber
defined in ../../common/EmpireBattle/Source/BattleScript/BattleEditorScriptInterface.cpp, line 8366
-
army:winds_of_magic_reserve()
-
Returns the reserve magic this army can spend. This is the total amount of magic available to this army that hasn't yet entered its current pool. As the current pool is spent on casting spells, magic flows to it from the reserve pool until that pool is empty.
Returns:
magicnumber
defined in ../../common/EmpireBattle/Source/BattleScript/BattleEditorScriptInterface.cpp, line 8392
-
army:winds_of_magic_current()
-
Returns the current amount of magic this army has available to spend.
Returns:
magicnumber
defined in ../../common/EmpireBattle/Source/BattleScript/BattleEditorScriptInterface.cpp, line 8415
-
army:modify_winds_of_magic_reserve(
magic to addnumber
)
-
Adds the supplied amount to the winds of magic reserve for the army. The reserve is the total amount of magic the army has left to spend, that hasn't yet entered its current pool.
Parameters:
1
magic to add
Returns:
nil
defined in ../../common/EmpireBattle/Source/BattleScript/BattleEditorScriptInterface.cpp, line 8438
-
army:modify_winds_of_magic_current(
magic to addnumber
, [
add directlyboolean
])
-
Adds the supplied amount to the current winds of magic for the army. The optional flag specifies that it should not be taken from the reserve - if set, the magic is directly added to the current pool with the reserve pool left untouched.
Parameters:
1
magic to add
2
optional, default value=false
add directly
Returns:
nil
defined in ../../common/EmpireBattle/Source/BattleScript/BattleEditorScriptInterface.cpp, line 8460
-
army:allow_use_toggleables(
allow use toggleablesboolean
)
-
Allows/Stops this army to interact with toggleables
Parameters:
1
allow use toggleables
Returns:
nil
defined in ../../common/EmpireBattle/Source/BattleScript/BattleEditorScriptInterface.cpp, line 8494
-
army:get_reinforcement_units([
reinforcement collectionnumber
])
-
Returns a
battle_units
collection containing reinforcements waiting to deploy. Supply an optional index if there are multiple units collections waiting to reinforce.Parameters:
1
optional, default value=1
reinforcement collection
Returns:
reinforcements unitsbattle_units
defined in ../../common/EmpireBattle/Source/BattleScript/BattleEditorScriptInterface.cpp, line 8510
-
army:is_reinforcement_army()
-
Returns true if this army is a reinforcement army
Returns:
is a reinforcement armyboolean
defined in ../../common/EmpireBattle/Source/BattleScript/BattleEditorScriptInterface.cpp, line 8560
-
army:get_reinforcement_target_army()
-
Returns the target army of the reinforcement if it is one
Returns:
target reinforcement army, orbattle_army
nil
if there is none.
defined in ../../common/EmpireBattle/Source/BattleScript/BattleEditorScriptInterface.cpp, line 8578
-
army:num_reinforcement_units()
-
Return the number of
battle_units
collections that are reinforcements waiting to deploy for this army.Returns:
number of reinforcement units collections.number
defined in ../../common/EmpireBattle/Source/BattleScript/BattleEditorScriptInterface.cpp, line 8599
-
army:unique_id()
-
Return the unique of this army.
Returns:
unique id of the army.number
defined in ../../common/EmpireBattle/Source/BattleScript/BattleEditorScriptInterface.cpp, line 8637
-
army:enable_reinforcement_adc()
-
Allows aide-de-camp messages being generated for this army.
Returns:
nil
defined in ../../common/EmpireBattle/Source/BattleScript/BattleEditorScriptInterface.cpp, line 8655
-
army:suppress_reinforcement_adc([
number of messages allowed before disabling themnumber
])
-
Prevents reinforcement aide-de-camp messages being generated for this army.
Parameters:
1
optional, default value=nil
number of messages allowed before disabling them
Returns:
nil
defined in ../../common/EmpireBattle/Source/BattleScript/BattleEditorScriptInterface.cpp, line 8665
-
army:change_faction(
faction keystring
)
-
Changes the army's faction mid-battle.
Parameters:
1
faction key
Returns:
nil
defined in ../../common/EmpireBattle/Source/BattleScript/BattleEditorScriptInterface.cpp, line 8692
-
army:enable_army_destruction_morale_effect(
enable effectboolean
)
-
Sets whether the army destruction morale effect can apply to this army or not.
Parameters:
1
enable effect
Returns:
nil
defined in ../../common/EmpireBattle/Source/BattleScript/BattleEditorScriptInterface.cpp, line 8714
-
army:quit_battle()
-
Instructs the army to quit the battle.
Returns:
nil
defined in ../../common/EmpireBattle/Source/BattleScript/BattleEditorScriptInterface.cpp, line 8730
-
army:highlight_deployment_areas([
should highlightboolean
])
-
Activates or deactivates a highlight on the deployment area related to this army.
Parameters:
1
optional, default value=true
should highlight
Returns:
nil
defined in ../../common/EmpireBattle/Source/BattleScript/BattleEditorScriptInterface.cpp, line 8743
-
army:use_special_ability(
keystring
,
positionbattle_vector
, [
bearingnumber
], [
widthnumber
])
-
Instructs the army to target a special ability at a supplied position.
Parameters:
1
Key of the special ability, from the
army_special_abilities
database table.2
Position to target the special ability at.
3
optional, default value=nil
Bearing of the special ability in degrees. This is optional and is not required for all abilities.
4
optional, default value=nil
Width of the special ability in metres. This is optional and is not required for all abilities.
Returns:
nil
defined in ../../common/EmpireBattle/Source/BattleScript/BattleEditorScriptInterface.cpp, line 8756
-
army:has_currency(
currency typestring
)
-
Returns whether this army has access to the specified battle currency.
Parameters:
1
Key of the battle currency, from the
battle_secondary_currency_types
database table.Returns:
nil
defined in ../../common/EmpireBattle/Source/BattleScript/BattleEditorScriptInterface.cpp, line 8798
-
army:currency_amount(
currency typestring
)
-
Returns the current quantity of the specified battle currency available to this army.
Parameters:
1
Key of the battle currency, from the
battle_secondary_currency_types
database table.Returns:
nil
defined in ../../common/EmpireBattle/Source/BattleScript/BattleEditorScriptInterface.cpp, line 8825
-
army:reset_currency_amount(
currency typestring
)
-
Resets the quantity of the specified battle currency available to this army to 0.
Parameters:
1
Key of the battle currency, from the
battle_secondary_currency_types
database table.Returns:
nil
defined in ../../common/EmpireBattle/Source/BattleScript/BattleEditorScriptInterface.cpp, line 8857