Building

A building script object represents a single building on the battlefield. This might be something as big as a garrisonable building or a section of wall fortification, or it could be as small as a crate or a barrel. Building script objects can be used to query or modify the subject building, and can also be passed to certain functions that take a building as an argument.

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

Creation

A building script object may be sourced from the battle_buildings list object.

Back to top

Querying

building:position()

Returns a battle_vector representing the position of the building. The vector will be positioned at the pivot point of the building, which is not necessarily at its centre.

Returns:

  1. battle_vector building position

defined in ../../common/EmpireBattle/Source/BattleScript/BattleEditorScriptInterface.cpp, line 1748

building:central_position()

Returns a battle_vector representing the centre position of the building.

Returns:

  1. battle_vector centre position

defined in ../../common/EmpireBattle/Source/BattleScript/BattleEditorScriptInterface.cpp, line 1766

building:orientation()

Returns the orientation of the building in degrees.

Returns:

  1. number orientation

defined in ../../common/EmpireBattle/Source/BattleScript/BattleEditorScriptInterface.cpp, line 1786

building:alliance_owner_id()

Returns the number of the battle_alliance that owns the building. If nobody owns this building then -1 is returned.

Returns:

  1. number alliance owner id

defined in ../../common/EmpireBattle/Source/BattleScript/BattleEditorScriptInterface.cpp, line 1807

building:name()

Returns the name of the building.

Returns:

  1. string name

defined in ../../common/EmpireBattle/Source/BattleScript/BattleEditorScriptInterface.cpp, line 1828

building:category()

Returns the category of this building, from the battlefield_building_categories database table.

Returns:

  1. string building category

defined in ../../common/EmpireBattle/Source/BattleScript/BattleEditorScriptInterface.cpp, line 1846

building:health()

Returns the health of the building as a unary value (between 0 and 1).

Returns:

  1. number health

defined in ../../common/EmpireBattle/Source/BattleScript/BattleEditorScriptInterface.cpp, line 1865

building:has_gate()

Returns whether this building contains a gate or not.

Returns:

  1. boolean contains gate

defined in ../../common/EmpireBattle/Source/BattleScript/BattleEditorScriptInterface.cpp, line 1884

building:is_fort_wall()

Returns whether this building is a fort wall or not.

Returns:

  1. boolean is fort wall

defined in ../../common/EmpireBattle/Source/BattleScript/BattleEditorScriptInterface.cpp, line 1903

building:is_fort_tower()

Returns whether this building is a fort tower or not.

Returns:

  1. boolean is fort tower

defined in ../../common/EmpireBattle/Source/BattleScript/BattleEditorScriptInterface.cpp, line 1922

building:is_selectable()

Returns whether this building is selectable or not. Qualifying buildings can be selected and issued orders, such as certain towers.

Returns:

  1. boolean is selectable

defined in ../../common/EmpireBattle/Source/BattleScript/BattleEditorScriptInterface.cpp, line 1942

building:next()

Returns the next fort wall building, if this building is part of a wall. If this building is not part of a wall then nil is returned.

Returns:

  1. battle_building next building

defined in ../../common/EmpireBattle/Source/BattleScript/BattleEditorScriptInterface.cpp, line 1961

building:previous()

Returns the previous fort wall building, if this building is part of a wall. If this building is not part of a wall then nil is returned.

Returns:

  1. battle_building previous building

defined in ../../common/EmpireBattle/Source/BattleScript/BattleEditorScriptInterface.cpp, line 1984

Back to top

Showing and Hiding

building:hide()

Hides the building, making it invisible.

Returns:

  1. nil

defined in ../../common/EmpireBattle/Source/BattleScript/BattleEditorScriptInterface.cpp, line 2010

building:show()

Shows the building after it has been hidden with building:hide.

Returns:

  1. nil

defined in ../../common/EmpireBattle/Source/BattleScript/BattleEditorScriptInterface.cpp, line 2023

Back to top

Modifying

building:change_on_fire(boolean set on fire)

Sets the building on fire or not (if it is able to burn).

Parameters:

1

boolean

set on fire

Returns:

  1. nil

defined in ../../common/EmpireBattle/Source/BattleScript/BattleEditorScriptInterface.cpp, line 2039

building:change_immune_to_catching_fire(boolean is flammable)

Sets whether the building can burn or not.

Parameters:

1

boolean

is flammable

Returns:

  1. nil

defined in ../../common/EmpireBattle/Source/BattleScript/BattleEditorScriptInterface.cpp, line 2062

building:change_immune_to_fire_damage(boolean takes damage)

Sets whether the building takes damage from burning or not.

Parameters:

1

boolean

takes damage

Returns:

  1. nil

defined in ../../common/EmpireBattle/Source/BattleScript/BattleEditorScriptInterface.cpp, line 2078

building:change_is_destructible(boolean takes damage)

Sets whether the building takes damage at all.

Parameters:

1

boolean

takes damage

Returns:

  1. nil

defined in ../../common/EmpireBattle/Source/BattleScript/BattleEditorScriptInterface.cpp, line 2094

building:destroy()

Destroys the building.

Returns:

  1. nil

defined in ../../common/EmpireBattle/Source/BattleScript/BattleEditorScriptInterface.cpp, line 2111

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