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
-
toggle_system:toggle_slot_script_id(
indexnumber
)
-
Returns the toggle slot with the specified script_id.
Parameters:
1
index
Returns:
toggle_slotbattle_toggle_slot
-
toggle_system:toggle_slot_count()
-
Returns the size of the toggle slot list.
Returns:
countnumber
-
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
-
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
-
toggle_system:map_barrier_count()
-
Returns the size of the map barrier list.
Returns:
countnumber
-
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
-
toggle_system:disable_and_refund_all_buildings()
-
Disable and refunds all built buildings
Returns:
nil
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
-
map_barrier:highlight([
show highlightboolean
])
-
Activates or deactivates a map barrier highlight.
Parameters:
1
optional, default value=true
show highlight
Returns:
nil
-
map_barrier:enable(
armybattle_army
)
-
Enables the map barrier. The army that is enabling the barrier must be specified.
Parameters:
1
army
Returns:
nil
-
map_barrier:disable(
armybattle_army
)
-
Disables the map barrier. The army that is disabling the barrier must be specified.
Parameters:
1
army
Returns:
nil
-
map_barrier:position(
positionbattle_vector
)
-
Returns the position of the map barrier.
Parameters:
1
position
Returns:
nil
-
map_barrier:record_key()
-
Returns the record key of the map barrier.
Returns:
record_keystring
-
map_barrier:composite_scenes()
-
Returns the composite_scenes of the map barrier.
Returns:
composite_scenes_listbattle_composite_scenes_list
-
map_barrier:has_toggle_slot()
-
Returns whether the map barrier is linked to a toggle slot.
Returns:
is linked to toggle slotboolean
-
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
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
-
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
-
toggle_slot:has_map_barrier()
-
Returns whether the toggle slot is linked to a map barrier.
Returns:
is linked to map barrierboolean
-
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
-
toggle_slot:unique_ui_id()
-
Returns the unique id for this toggle slot that the UI system uses.
Returns:
ui idnumber
-
toggle_slot:unique_id()
-
Returns the unique id for this toggle slot.
Returns:
idnumber
-
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
-
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
-
toggle_slot:position()
-
Returns the position
Returns:
positionbattle_vector
-
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