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 Battle | |
Loaded in Frontend |
-
reinforcements:attacker_reinforcement_line(
indexnumber
)
-
Returns the
battle_reinforcement_line
at the specified index value in the attacker reinforcement lines list.Parameters:
1
index
Returns:
reinforcement linebattle_reinforcement_line
-
reinforcements:attacker_reinforcement_lines_count()
-
Returns the number of
battle_reinforcement_line
objects in the attacker reinforcement lines list.Returns:
countnumber
-
reinforcements:defender_reinforcement_line(
indexnumber
)
-
Returns the
battle_reinforcement_line
at the specified index value in the defender reinforcement lines list.Parameters:
1
index
Returns:
reinforcement linebattle_reinforcement_line
-
reinforcements:defender_reinforcement_lines_count()
-
Returns the number of
battle_reinforcement_line
objects in the defender reinforcement lines list.Returns:
countnumber
-
reinforcements:spawn_zone(
indexnumber
)
-
Returns the
battle_spawn_zone
at the specified index value in the spawn zone list.Parameters:
1
index
Returns:
spawn zonebattle_spawn_zone
-
reinforcements:spawn_zone_count()
-
Returns the number of
battle_spawn_zone
objects in the spawn zone list.Returns:
countnumber
-
reinforcements:reinforcement_army(
indexnumber
)
-
Returns the
battle_reinforcement_army
at the specified index value in the reinforcement army list.Parameters:
1
index
Returns:
reinforcement armybattle_reinforcement_army
-
reinforcements:reinforcement_army_count()
-
Returns the number of
battle_reinforcement_army
objects in the reinforcement army list.Returns:
countnumber
-
reinforcements:reinforcement_army_for_army(
armybattle_army
)
-
Returns a
battle_reinforcement_army
object associated with the suppliedbattle_army
. If nobattle_reinforcement_army
is associated with the supplied army (e.g. it's not a reinforcing army) then nothing will be returned.Parameters:
1
army
Returns:
reinforcement armybattle_reinforcement_army
-
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:
spawn zone idnumber
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(
event namestring
,
currencynumber
)
-
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
Event name.
2
Currency to add when the event is unlocked.
Returns:
nil
-
reinforcements:unlock_support_units_event(
event namestring
)
-
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
event name
Returns:
nil
-
reinforcements:lock_support_units_event(
event namestring
)
-
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
event name
Returns:
nil
-
reinforcements:link_support_units_event_with_capture_point(
event_name
string
,
capture_location
battle_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
event_name
2
capture_location
Returns:
nil
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
.
-
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:
script_idstring
-
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:
nil
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.
-
spawn_zone:unique_id()
-
Returns the unique numerical id of the spawn zone.
Returns:
unique idnumber
-
spawn_zone:position()
-
Returns the authored position of the spawn zone.
Returns:
positionbattle_vector
-
spawn_zone:has_reinforcement_line()
-
Returns if the spawn zone contains a
battle_reinforcement_line
.Returns:
has reinforcement lineboolean
-
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:
reinforcement linebattle_reinforcement_line
-
spawn_zone:can_be_used_by_alliance(
alliancebattle_alliance
)
-
Returns whether the spawn zone can be used by the supplied
battle_alliance
.Parameters:
1
alliance
Returns:
can be usedboolean
-
spawn_zone:is_safe_for_alliance(
alliancebattle_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
alliance
Returns:
is safeboolean
-
spawn_zone:highlight()
-
Activates or deactivates a highlight on the spawn zone.
[opt=true]boolean
show highlightReturns:
nil
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.
-
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:
associated armybattle_army
-
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:
target armybattle_army
-
reinforcement_army:assign_spawn_zone(
spawn zonebattle_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
spawn zone
Returns:
nil