Toggle System

The Toggle System collection object provides access to other objects related to the toggle system. These are objects on the battlefield that can be turned on and off, such as barricades and map barriers. The toggle_system object provides access to a list of individual battle_toggle_slot objects from an internal numbered list. The function toggle_system:toggle_slot provides access to an individual toggle slot by index, while toggle_system:toggle_slot_count returns the size of the list.

A handle to the toggle system object may be obtained by calling battle:toggle_system.

Example:

toggle_system = bm:toggle_system()
Loaded in Campaign Loaded in Campaign
Loaded in Battle Loaded in Battle
Loaded in Frontend Loaded in Frontend
Back to top

Functionality

toggle_system:toggle_slot(number index)

Returns the toggle slot at the specified index value in the collection. The list is 1-based, the toggle slot at index 1 is the first toggle slot in the list.

Parameters:

1

number

index

Returns:

  1. battle_toggle_slot toggle_slot

defined in ../../common/EmpireBattle/Source/BattleScript/BattleScriptToggleSystem.cpp, line 544

toggle_system:toggle_slot_script_id(number index)

Returns the toggle slot with the specified script_id.

Parameters:

1

number

index

Returns:

  1. battle_toggle_slot toggle_slot

defined in ../../common/EmpireBattle/Source/BattleScript/BattleScriptToggleSystem.cpp, line 564

toggle_system:toggle_slot_count()

Returns the size of the toggle slot list.

Returns:

  1. number count

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

toggle_system:map_barrier(number index)

Returns the map barrier at the specified index value in the collection. The list is 1-based, the map barrier at index 1 is the first map barrier in the list.

Parameters:

1

number

index

Returns:

  1. battle_map_barrier map_barrier

defined in ../../common/EmpireBattle/Source/BattleScript/BattleScriptToggleSystem.cpp, line 601

toggle_system:map_barrier_script_id(string script id)

Returns the map barrier with the specified script id.

Parameters:

1

string

script id

Returns:

  1. battle_map_barrier toggle slot

defined in ../../common/EmpireBattle/Source/BattleScript/BattleScriptToggleSystem.cpp, line 622

toggle_system:map_barrier_count()

Returns the size of the map barrier list.

Returns:

  1. number count

defined in ../../common/EmpireBattle/Source/BattleScript/BattleScriptToggleSystem.cpp, line 642

toggle_system:allow_army_interaction(boolean allow/forbids use of toggleables)

Allows/Stops all armies to interact with toggleables

Parameters:

1

boolean

allow/forbids use of toggleables

Returns:

  1. nil

defined in ../../common/EmpireBattle/Source/BattleScript/BattleScriptToggleSystem.cpp, line 659

toggle_system:disable_and_refund_all_buildings()

Disable and refunds all built buildings

Returns:

  1. nil

defined in ../../common/EmpireBattle/Source/BattleScript/BattleScriptToggleSystem.cpp, line 681


Map Barrier

Map Barrier objects represent map barriers on the battlefield. Map barriers are a special type of toggleable object that represent large barriers that block pathfinding on the battle map. They are distinct from barricades which are constructed within settlements. The visual style of a map barrier is often unique to its particular map.

Handles to map barrier objects may be obtained through the battle_toggle_system and battle_toggle_slot interfaces.

Back to top

Functionality

map_barrier:enabled()

Returns if the map barrier is enabled

Returns:

  1. boolean true/false

defined in ../../common/EmpireBattle/Source/BattleScript/BattleScriptToggleSystem.cpp, line 90

map_barrier:highlight([boolean show highlight])

Activates or deactivates a map barrier highlight.

Parameters:

1

boolean

optional, default value=true

show highlight

Returns:

  1. nil

defined in ../../common/EmpireBattle/Source/BattleScript/BattleScriptToggleSystem.cpp, line 106

map_barrier:enable(battle_army army)

Enables the map barrier. The army that is enabling the barrier must be specified.

Parameters:

1

battle_army

army

Returns:

  1. nil

defined in ../../common/EmpireBattle/Source/BattleScript/BattleScriptToggleSystem.cpp, line 119

map_barrier:disable(battle_army army)

Disables the map barrier. The army that is disabling the barrier must be specified.

Parameters:

1

battle_army

army

Returns:

  1. nil

defined in ../../common/EmpireBattle/Source/BattleScript/BattleScriptToggleSystem.cpp, line 138

map_barrier:position(battle_vector position)

Returns the position of the map barrier.

Parameters:

1

battle_vector

position

Returns:

  1. nil

defined in ../../common/EmpireBattle/Source/BattleScript/BattleScriptToggleSystem.cpp, line 157

map_barrier:record_key()

Returns the record key of the map barrier.

Returns:

  1. string record_key

defined in ../../common/EmpireBattle/Source/BattleScript/BattleScriptToggleSystem.cpp, line 178

map_barrier:composite_scenes()

Returns the composite_scenes of the map barrier.

Returns:

  1. battle_composite_scenes_list composite_scenes_list

defined in ../../common/EmpireBattle/Source/BattleScript/BattleScriptToggleSystem.cpp, line 198

map_barrier:has_toggle_slot()

Returns whether the map barrier is linked to a toggle slot.

Returns:

  1. boolean is linked to toggle slot

defined in ../../common/EmpireBattle/Source/BattleScript/BattleScriptToggleSystem.cpp, line 214

map_barrier:toggle_slot()

Returns the toggle slot linked with the barrier. If no toggleable is linked then nothing is returned.

Returns:

  1. battle_toggle_slot toggle slot

defined in ../../common/EmpireBattle/Source/BattleScript/BattleScriptToggleSystem.cpp, line 236


Toggle Slot

Toggle Slot objects represent toggle slots on the battlefield. They are abstract objects, linked to other object types like battle_map_barrier that represent physical objects on the battlefield. It is through the battle_toggle_slot interface that these objects can be activated and deactivated.

Back to top

Functionality

toggle_slot:is_held_by_alliance()

Returns whether the toggle slot is currently held by an alliance.

Returns:

  1. boolean is held by alliance

defined in ../../common/EmpireBattle/Source/BattleScript/BattleScriptToggleSystem.cpp, line 310

toggle_slot:holding_alliance()

Returns a handle to the holding alliance. If no alliance holds the toggleable slot then nothing is returned.

Returns:

  1. battle_alliance holding alliance

defined in ../../common/EmpireBattle/Source/BattleScript/BattleScriptToggleSystem.cpp, line 327

toggle_slot:has_map_barrier()

Returns whether the toggle slot is linked to a map barrier.

Returns:

  1. boolean is linked to map barrier

defined in ../../common/EmpireBattle/Source/BattleScript/BattleScriptToggleSystem.cpp, line 349

toggle_slot:map_barrier()

Returns the map barrier linked with the toggle slot. If no map barrier is linked then nothing is returned.

Returns:

  1. battle_map_barrier map barrier

defined in ../../common/EmpireBattle/Source/BattleScript/BattleScriptToggleSystem.cpp, line 371

toggle_slot:unique_ui_id()

Returns the unique id for this toggle slot that the UI system uses.

Returns:

  1. number ui id

defined in ../../common/EmpireBattle/Source/BattleScript/BattleScriptToggleSystem.cpp, line 395

toggle_slot:unique_id()

Returns the unique id for this toggle slot.

Returns:

  1. number id

defined in ../../common/EmpireBattle/Source/BattleScript/BattleScriptToggleSystem.cpp, line 413

toggle_slot:script_id()

Returns the script id of the toggle slot. If no script id has been set in the map data then a blank string is returned.

Returns:

  1. string script id

defined in ../../common/EmpireBattle/Source/BattleScript/BattleScriptToggleSystem.cpp, line 431

toggle_slot:highlight([boolean show highlight])

Activates or deactivates a highlight on a slot building place.

Parameters:

1

boolean

optional, default value=true

show highlight

Returns:

  1. nil

defined in ../../common/EmpireBattle/Source/BattleScript/BattleScriptToggleSystem.cpp, line 451

toggle_slot:position()

Returns the position

Returns:

  1. battle_vector position

defined in ../../common/EmpireBattle/Source/BattleScript/BattleScriptToggleSystem.cpp, line 464

toggle_slot:slot_type()

Returns the slot type of the toggle slot as a string. Slot types are listed in the toggle_system_types database table.

Returns:

  1. string slot type

defined in ../../common/EmpireBattle/Source/BattleScript/BattleScriptToggleSystem.cpp, line 481

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