Alliance
Alliance
objects represent logical alliances taking part in a battle. One or more armies fight together in an alliance to contest a battle. There are always exactly two alliances.
Alliance
objects are derived from the battle_hierarchy
, from the battle_alliances
collection object which is in turn sourced from the battle
object.
Loaded in Campaign | |
Loaded in Battle | |
Loaded in Frontend |
Once a handle to an alliance 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 alliance_player = bm:alliances():item(1)
-- calling a function on the object once created
bm:out("number of armies on the player's side: " .. alliance_player:armies():count())
number of armies on the player's side: 2
-
alliance:armies()
-
Creates and returns a
battle_armies
object listing all armies in the alliance.Returns:
armies listbattle_armies
-
alliance:force_ai_plan_type_attack()
-
Forces any AI in this alliance to prioritise attacking behaviour.
Returns:
nil
-
alliance:is_attacker()
-
Returns whether this alliance is attacking in the battle.
Returns:
is attackerboolean
-
alliance:force_ai_plan_type_defend()
-
Forces any AI in this alliance to prioritise defensive behaviour.
Returns:
nil
-
alliance:create_ai_unit_planner()
-
Creates and returns an
ai_planner
object attached to this alliance. Consider creating ascript_ai_planner
instead of calling this function directly.Returns:
ai plannerai_planner
-
alliance:force_battle_victory()
-
Immediately forces victory for this alliance.
Returns:
nil