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 Campaign
Loaded in Battle Loaded in Battle
Loaded in Frontend Loaded in Frontend
Back to top

Usage

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
Back to top

Methods

alliance:armies()

Creates and returns a battle_armies object listing all armies in the alliance.

Returns:

  1. battle_armies armies list

defined in ../../common/EmpireBattle/Source/BattleScript/BattleEditorScriptInterface.cpp, line 9022

alliance:force_ai_plan_type_attack()

Forces any AI in this alliance to prioritise attacking behaviour.

Returns:

  1. nil

defined in ../../common/EmpireBattle/Source/BattleScript/BattleEditorScriptInterface.cpp, line 9035

alliance:is_attacker()

Returns whether this alliance is attacking in the battle.

Returns:

  1. boolean is attacker

defined in ../../common/EmpireBattle/Source/BattleScript/BattleEditorScriptInterface.cpp, line 9051

alliance:force_ai_plan_type_defend()

Forces any AI in this alliance to prioritise defensive behaviour.

Returns:

  1. nil

defined in ../../common/EmpireBattle/Source/BattleScript/BattleEditorScriptInterface.cpp, line 9086

alliance:create_ai_unit_planner()

Creates and returns an ai_planner object attached to this alliance. Consider creating a script_ai_planner instead of calling this function directly.

Returns:

  1. ai_planner ai planner

defined in ../../common/EmpireBattle/Source/BattleScript/BattleEditorScriptInterface.cpp, line 9103

alliance:force_battle_victory()

Immediately forces victory for this alliance.

Returns:

  1. nil

defined in ../../common/EmpireBattle/Source/BattleScript/BattleEditorScriptInterface.cpp, line 9121

Last updated 12/08/2022 11:56:59