Alliances

The alliances collection object contains a list of 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 Battle loaded in battle
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 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. alliance alliance

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

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 6784

Last updated 25/08/2021 12:07:50