reinforcements Reinforcements

The Reinforcements collection object is a central interface through which other objects related to reinforcements can be accessed. A handle to the reinforcements object may be obtained by calling battle:reinforcements.

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

Reinforcement Lines

reinforcements:attacker_reinforcement_line(number index)

Returns the battle_reinforcement_line at the specified index value in the attacker reinforcement lines list.

Parameters:

1

number

index

Returns:

  1. battle_reinforcement_line reinforcement line

defined in ../../common/EmpireBattle/Source/BattleScript/BattleScriptReinforcement.cpp, line 444

reinforcements:attacker_reinforcement_lines_count()

Returns the number of battle_reinforcement_line objects in the attacker reinforcement lines list.

Returns:

  1. number count

defined in ../../common/EmpireBattle/Source/BattleScript/BattleScriptReinforcement.cpp, line 462

reinforcements:defender_reinforcement_line(number index)

Returns the battle_reinforcement_line at the specified index value in the defender reinforcement lines list.

Parameters:

1

number

index

Returns:

  1. battle_reinforcement_line reinforcement line

defined in ../../common/EmpireBattle/Source/BattleScript/BattleScriptReinforcement.cpp, line 479

reinforcements:defender_reinforcement_lines_count()

Returns the number of battle_reinforcement_line objects in the defender reinforcement lines list.

Returns:

  1. number count

defined in ../../common/EmpireBattle/Source/BattleScript/BattleScriptReinforcement.cpp, line 497

Back to top

Spawn Zones

reinforcements:spawn_zone(number index)

Returns the battle_spawn_zone at the specified index value in the spawn zone list.

Parameters:

1

number

index

Returns:

  1. battle_spawn_zone spawn zone

defined in ../../common/EmpireBattle/Source/BattleScript/BattleScriptReinforcement.cpp, line 516

reinforcements:spawn_zone_count()

Returns the number of battle_spawn_zone objects in the spawn zone list.

Returns:

  1. number count

defined in ../../common/EmpireBattle/Source/BattleScript/BattleScriptReinforcement.cpp, line 532

Back to top

Reinforcement Armies

reinforcements:reinforcement_army(number index)

Returns the battle_reinforcement_army at the specified index value in the reinforcement army list.

Parameters:

1

number

index

Returns:

  1. battle_reinforcement_army reinforcement army

defined in ../../common/EmpireBattle/Source/BattleScript/BattleScriptReinforcement.cpp, line 551

reinforcements:reinforcement_army_count()

Returns the number of battle_reinforcement_army objects in the reinforcement army list.

Returns:

  1. number count

defined in ../../common/EmpireBattle/Source/BattleScript/BattleScriptReinforcement.cpp, line 567

reinforcements:reinforcement_army_for_army(battle_army army)

Returns a battle_reinforcement_army object associated with the supplied battle_army. If no battle_reinforcement_army is associated with the supplied army (e.g. it's not a reinforcing army) then nothing will be returned.

Parameters:

1

battle_army

army

Returns:

  1. battle_reinforcement_army reinforcement army

defined in ../../common/EmpireBattle/Source/BattleScript/BattleScriptReinforcement.cpp, line 584

reinforcements:random_spawn_zone(... spawn zones)

Randomly selects and returns a spawn zone among those provided, weighting the selection based on their actual width.

Parameters:

1

...

One or more battle_spawn_zone objects specified as separate arguments.

Returns:

  1. number spawn zone id

defined in ../../common/EmpireBattle/Source/BattleScript/BattleScriptReinforcement.cpp, line 605

Back to top

Supporting Units

In certain battles such as survival battles, reinforcement currency can be spent by the player to bring reinforcements on to the battlefield at a time of their choosing. Reinforcement currency can be added for the player through script using the functions below.

reinforcements:set_cost_based_support_units_event(string event name, number currency)

Creates a event that adds currency that the player can spend on reinforcing units. The event will not actually be applied until reinforcements:unlock_support_units_event is called.

Parameters:

1

string

Event name.

2

number

Currency to add when the event is unlocked.

Returns:

  1. nil

defined in ../../common/EmpireBattle/Source/BattleScript/BattleScriptReinforcement.cpp, line 648

reinforcements:unlock_support_units_event(string event name)

Applies a supporting-units event with the supplied name, granting the reinforcement currency amount associated with the event to the player. The event should have been previously set up with reinforcements:set_cost_based_support_units_event.

Parameters:

1

string

event name

Returns:

  1. nil

defined in ../../common/EmpireBattle/Source/BattleScript/BattleScriptReinforcement.cpp, line 668

reinforcements:lock_support_units_event(string event name)

Locks a supporting-units event with the supplied name, granting the reinforcement currency amount associated with the event to the player. The event should have been previously set up with reinforcements:set_cost_based_support_units_event.

Parameters:

1

string

event name

Returns:

  1. nil

defined in ../../common/EmpireBattle/Source/BattleScript/BattleScriptReinforcement.cpp, line 685

reinforcements:link_support_units_event_with_capture_point(
  
string event_name,
  battle_capture_location
capture_location
)

Links a capture point with an unlocking support units event, that way we can show in the CP tooltip The event should have been previously set up with reinforcements:set_cost_based_support_units_event.

Parameters:

1

string

event_name

2

battle_capture_location

capture_location

Returns:

  1. nil

defined in ../../common/EmpireBattle/Source/BattleScript/BattleScriptReinforcement.cpp, line 702


Reinforcement Line

A reinforcement line is a logical line drawn in the map data along which armies reinforce. A reinforcement line is contained within a battle_spawn_zone.

Back to top

Methods

reinforcement_line:script_id()

Returns the script_id of the reinforcement line. This can be set in the map data and facilitates scripted battle_army objects spawning in particular spawn zones.

Returns:

  1. string script_id

defined in ../../common/EmpireBattle/Source/BattleScript/BattleScriptReinforcement.cpp, line 92

reinforcement_line:enable_random_deployment_position()

Enables random deployment position along the reinforcement line. With this mode enabled on the reinforcement line, units will enter the battlefield at random locations along the line rather than from left to right in a uniform fashion.

Returns:

  1. nil

defined in ../../common/EmpireBattle/Source/BattleScript/BattleScriptReinforcement.cpp, line 112


Spawn Zone

Spawn Zones are areas in which reinforcing armies may spawn and enter the battlefield. Handles to spawn zones may be attained through the relevant commands on the battle_reinforcements object. A reinforcing army may be assigned to a spawn zone with reinforcement_army:assign_spawn_zone.

Each spawn zone can contain a battle_reinforcement_line, which is a line within the spawn zone which determines where units line up.

Back to top

Methods

spawn_zone:unique_id()

Returns the unique numerical id of the spawn zone.

Returns:

  1. number unique id

defined in ../../common/EmpireBattle/Source/BattleScript/BattleScriptReinforcement.cpp, line 168

spawn_zone:position()

Returns the authored position of the spawn zone.

Returns:

  1. battle_vector position

defined in ../../common/EmpireBattle/Source/BattleScript/BattleScriptReinforcement.cpp, line 186

spawn_zone:has_reinforcement_line()

Returns if the spawn zone contains a battle_reinforcement_line.

Returns:

  1. boolean has reinforcement line

defined in ../../common/EmpireBattle/Source/BattleScript/BattleScriptReinforcement.cpp, line 204

spawn_zone:reinforcement_line()

Returns the battle_reinforcement_line linked with the spawn zone. If no reinforcement line is linked then nothing is returned.

Returns:

  1. battle_reinforcement_line reinforcement line

defined in ../../common/EmpireBattle/Source/BattleScript/BattleScriptReinforcement.cpp, line 228

spawn_zone:can_be_used_by_alliance(battle_alliance alliance)

Returns whether the spawn zone can be used by the supplied battle_alliance.

Parameters:

1

battle_alliance

alliance

Returns:

  1. boolean can be used

defined in ../../common/EmpireBattle/Source/BattleScript/BattleScriptReinforcement.cpp, line 254

spawn_zone:is_safe_for_alliance(battle_alliance alliance)

Returns whether the spawn zone is safe for the battle_alliance. A safe spawn zone is one in which forces of that alliance outnumber any enemy.

Parameters:

1

battle_alliance

alliance

Returns:

  1. boolean is safe

defined in ../../common/EmpireBattle/Source/BattleScript/BattleScriptReinforcement.cpp, line 275

spawn_zone:highlight()

Activates or deactivates a highlight on the spawn zone.
[opt=true] boolean show highlight

Returns:

  1. nil

defined in ../../common/EmpireBattle/Source/BattleScript/BattleScriptReinforcement.cpp, line 296


Reinforcement Army

A reinforcement army wraps any battle_army that is waiting to come on as a reinforcement, and serves as its interface to manage the process of doing so. Armies waiting to come on to the battlefield may be manipulated through this interface. Handles to reinforcement army objects can be sought from the relevant functions on the battle_reinforcements interface.

Back to top

Methods

reinforcement_army:army()

Returns the battle_army this reinforcement army is associated with. The units within this contained army are waiting to come on as reinforcements.

Returns:

  1. battle_army associated army

defined in ../../common/EmpireBattle/Source/BattleScript/BattleScriptReinforcement.cpp, line 367

reinforcement_army:target_army()

Returns the battle_army this reinforcement army targets. Units within this reinforcement army will be moved into the target army as they enter the battlefield.

Returns:

  1. battle_army target army

defined in ../../common/EmpireBattle/Source/BattleScript/BattleScriptReinforcement.cpp, line 379

reinforcement_army:assign_spawn_zone(battle_spawn_zone spawn zone)

Assigns the reinforcement army to a supplied spawn zone. This controls where the reinforcing units will appear on the battlefield when they reinforce.

Parameters:

1

battle_spawn_zone

spawn zone

Returns:

  1. nil

defined in ../../common/EmpireBattle/Source/BattleScript/BattleScriptReinforcement.cpp, line 391

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