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 Battle | |
Loaded in Frontend |
-
toggle_system:toggle_slot(
indexnumber
)
-
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
index
Returns:
toggle_slotbattle_toggle_slot
defined in ../../common/EmpireBattle/Source/BattleScript/BattleScriptToggleSystem.cpp, line 544
-
toggle_system:toggle_slot_script_id(
indexnumber
)
-
Returns the toggle slot with the specified script_id.
Parameters:
1
index
Returns:
toggle_slotbattle_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:
countnumber
defined in ../../common/EmpireBattle/Source/BattleScript/BattleScriptToggleSystem.cpp, line 584
-
toggle_system:map_barrier(
indexnumber
)
-
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
index
Returns:
map_barrierbattle_map_barrier
defined in ../../common/EmpireBattle/Source/BattleScript/BattleScriptToggleSystem.cpp, line 601
-
toggle_system:map_barrier_script_id(
script idstring
)
-
Returns the map barrier with the specified script id.
Parameters:
1
script id
Returns:
toggle slotbattle_map_barrier
defined in ../../common/EmpireBattle/Source/BattleScript/BattleScriptToggleSystem.cpp, line 622
-
toggle_system:map_barrier_count()
-
Returns the size of the map barrier list.
Returns:
countnumber
defined in ../../common/EmpireBattle/Source/BattleScript/BattleScriptToggleSystem.cpp, line 642
-
toggle_system:allow_army_interaction(
allow/forbids use of toggleablesboolean
)
-
Allows/Stops all armies to interact with toggleables
Parameters:
1
allow/forbids use of toggleables
Returns:
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:
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.
-
map_barrier:enabled()
-
Returns if the map barrier is enabled
Returns:
true/falseboolean
defined in ../../common/EmpireBattle/Source/BattleScript/BattleScriptToggleSystem.cpp, line 90
-
map_barrier:highlight([
show highlightboolean
])
-
Activates or deactivates a map barrier highlight.
Parameters:
1
optional, default value=true
show highlight
Returns:
nil
defined in ../../common/EmpireBattle/Source/BattleScript/BattleScriptToggleSystem.cpp, line 106
-
map_barrier:enable(
armybattle_army
)
-
Enables the map barrier. The army that is enabling the barrier must be specified.
Parameters:
1
army
Returns:
nil
defined in ../../common/EmpireBattle/Source/BattleScript/BattleScriptToggleSystem.cpp, line 119
-
map_barrier:disable(
armybattle_army
)
-
Disables the map barrier. The army that is disabling the barrier must be specified.
Parameters:
1
army
Returns:
nil
defined in ../../common/EmpireBattle/Source/BattleScript/BattleScriptToggleSystem.cpp, line 138
-
map_barrier:position(
positionbattle_vector
)
-
Returns the position of the map barrier.
Parameters:
1
position
Returns:
nil
defined in ../../common/EmpireBattle/Source/BattleScript/BattleScriptToggleSystem.cpp, line 157
-
map_barrier:record_key()
-
Returns the record key of the map barrier.
Returns:
record_keystring
defined in ../../common/EmpireBattle/Source/BattleScript/BattleScriptToggleSystem.cpp, line 178
-
map_barrier:composite_scenes()
-
Returns the composite_scenes of the map barrier.
Returns:
composite_scenes_listbattle_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:
is linked to toggle slotboolean
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:
toggle slotbattle_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.
-
toggle_slot:is_held_by_alliance()
-
Returns whether the toggle slot is currently held by an alliance.
Returns:
is held by allianceboolean
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:
holding alliancebattle_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:
is linked to map barrierboolean
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:
map barrierbattle_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:
ui idnumber
defined in ../../common/EmpireBattle/Source/BattleScript/BattleScriptToggleSystem.cpp, line 395
-
toggle_slot:unique_id()
-
Returns the unique id for this toggle slot.
Returns:
idnumber
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:
script idstring
defined in ../../common/EmpireBattle/Source/BattleScript/BattleScriptToggleSystem.cpp, line 431
-
toggle_slot:highlight([
show highlightboolean
])
-
Activates or deactivates a highlight on a slot building place.
Parameters:
1
optional, default value=true
show highlight
Returns:
nil
defined in ../../common/EmpireBattle/Source/BattleScript/BattleScriptToggleSystem.cpp, line 451
-
toggle_slot:position()
-
Returns the position
Returns:
positionbattle_vector
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:
slot typestring
defined in ../../common/EmpireBattle/Source/BattleScript/BattleScriptToggleSystem.cpp, line 481