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

alliance:force_ai_plan_type_attack()

Forces any AI in this alliance to prioritise attacking behaviour.

Returns:

  1. nil

alliance:is_attacker()

Returns whether this alliance is attacking in the battle.

Returns:

  1. boolean is attacker

alliance:force_ai_plan_type_defend()

Forces any AI in this alliance to prioritise defensive behaviour.

Returns:

  1. nil

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

alliance:force_battle_victory()

Immediately forces victory for this alliance.

Returns:

  1. nil
Last updated 7/9/2024 11:45:05 AM