Armies

An armies object is a collection of battle_army objects. Like the other battle collection objects (battle_alliances and battle_units), armies:count returns the number of objects and armies:item returns individual items in the collection.

Loaded in Campaign Loaded in Campaign
Loaded in Battle Loaded in Battle
Loaded in Frontend Loaded in Frontend
Back to top

Creation

Armies objects are derived from battle_alliance objects in the battle_hierarchy - see the battle_hierarchy page for more information. Preferably, use the script_unit or generated_battle frameworks provided by the script libraries to negate the need to explicitly create armies objects.

Back to top

Usage

Once a handle to an armies 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 armies_player = bm:alliances():item(1):armies()
bm:out("number of armies on the player's side: " .. armies_player:count())        -- calling a function on the object once created
number of armies on the player's side: 2
Back to top

Methods

armies:item(number index)

Returns the battle_army at the specified index in the armies list. The list is 1-based, so supplying 1 as an argument will return the first army in the alliance.

Parameters:

1

number

index

Returns:

  1. battle_army army

armies:count()

Returns the size of the armies list.

Returns:

  1. number size of list
Last updated 7/9/2024 11:45:05 AM