Alliances

The alliances collection object contains a list of battle_alliance objects represent logical alliances taking part in a battle. There are always exactly two alliances. The alliances object is derived from the battle_hierarchy, from the top-level battle object, by calling battle:alliances as shown below.

Example:

alliances = bm:alliances()
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 alliances 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 a = bm:alliances()
bm:out("number of alliances: " .. a:count())        -- calling a function on the object once created
number of alliances: 2
Back to top

Methods

alliances:item(number index)

Returns the battle_alliance at the specified index in the alliances list. At present there are always two alliances on the battlefield, with the first being the attacker and the second being the defender. The list is 1-based, so supplying 1 as an argument will return the first alliance.

Parameters:

1

number

index

Returns:

  1. battle_alliance alliance

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

alliances:count()

Returns the size of the alliances list. At present this will always be 2.

Returns:

  1. number size of alliances list

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

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