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 Battle | |
Loaded in Frontend |
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
-
alliances:item(
indexnumber
)
-
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 supplying1
as an argument will return the first alliance.Parameters:
1
index
Returns:
alliancebattle_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:
size of alliances listnumber
defined in ../../common/EmpireBattle/Source/BattleScript/BattleEditorScriptInterface.cpp, line 9215