• Reference
  • LUA API
  • Classes
  • Destructible

Destructible

Destructible is one of the basic elements in the project, which can be directly created on the map, generally immovable, and can interact with skills.

Functions

create_destructible

Create destructible.

Parameters

VariableTypeDescription
type_idnumberID of the destructible object type.
pointtablePoint.
anglenumberFacing angle.
scale_xnumberScale.
scale_ynumberScale.
scale_znumberScale.
heightnumberHeight.
destructible.create_destructible(type_id, point, angle, scale_x, scale_y, scale_z, height)

destroy

Kill destructible.

Parameter

VariableTypeDescription
killer_unitunitKiller (unit).
destructible: destroy(killer_unit)

delete

Delete destructible.

destructible: delete()

resurrect

Revive destructible.

destructible:resurrect()

move_to_point

Move to target point.

Parameter

VariableTypeDescription
pointpointTarget point.
destructible: move_to_point(point)

set_hp

Set health.

Parameter

VariableTypeDescription
valuenumberLife value.
destructible: set_hp(value)

add_hp

Increase current health.

Parameter

VariableTypeDescription
valuenumberLife value.
destructible:add_hp(value)

set_max_hp

Set max health.

Parameter

VariableTypeDescription
valuenumberMaximum health.
destructible: set_max_hp(value)

add_max_hp

Increase max health.

Parameter

VariableTypeDescription
valuenumberMaximum health.
destructible:add_max_hp(value)

set_current_resource_number

Set the current number of resources.

Parameter

VariableTypeDescription
valuenumberResource number.
destructible: set_current_resource_number(value)

add_current_resource_number

Increase the current resource count.

Parameter

VariableTypeDescription
valuenumberResource number.
destructible:add_current_resource_number(value)

set_max_resource_number

Set the maximum number of resources.

Parameter

VariableTypeDescription
valuenumberResource number.
destructible: set_max_resource_number(value)

add_max_resource_number

Increase the maximum number of resources.

Parameter

VariableTypeDescription
valuenumberResource number.
destructible:add_max_resource_number(value)

set_name

Set the name of the destructible.

Parameter

VariableTypeDescription
namestrName.
destructible: set_name(name)

set_description

Set the description of the destructible.

Parameter

VariableTypeDescription
descriptionstrDescription.
destructible:set_description(description)

set_scale

Set the scale of the destructible.

Parameters

VariableTypeDescription
xnumberZoom factor.
ynumberZoom factor.
znumberZoom factor.
destructible: set_scale(x, y, z)

set_rotation

Set the destructible to face.

Parameter

VariableTypeDescription
anglenumberFacing angle.
destructible:set_rotation(angle)

set_height

Set the height of the destructible.

Parameter

VariableTypeDescription
heightnumberHeight.
destructible:set_height(height)

add_height

Increased height of destructibles.

Parameter

VariableTypeDescription
heightnumberHeight.
destructible:add_height(height)

set_lockable_by_ability

Whether the setting can be locked by the skill indicator.

Parameter

VariableTypeDescription
is_lockableboolWhether it can be locked by skill indicator.
destructible:set_lockable_by_ability(is_lockable)

set_attackable

Whether the setting can be attacked or not.

Parameter

VariableTypeDescription
is_attackableboolWhether it can be attacked.
destructible:set_attackable(is_attackable)

set_selectable

Whether the setting can be selected or not.

Parameter

VariableTypeDescription
is_selectableboolWhether it can be selected.
destructible:set_selectable(is_selectable)

set_gatherable

Whether the setting can be collected or not.

Parameter

VariableTypeDescription
is_gatherableboolWhether it can be gathered.
destructible:set_gatherable(is_gatherable)

add_tag

Add label.

Parameter

VariableTypeDescription
tagstrTag name.
destructible:add_tag(tag)

remove_tag

Remove label.

Parameter

VariableTypeDescription
tagstrTag name.
destructible: remove_tag(tag)

play_animation.

Play animation.

Parameters

VariableTypeDescription
anim_namestrAnimation name.
start_timenumberStart time.
end_timenumberEnd time.
is_loopboolWhether to loop.
speednumberPlayback speed.
destructible:play_animation(anim_name, start_time, end_time, is_loop, speed)

stop_animation

Stop animation.

Parameter

VariableTypeDescription
anim_namestrAnimation name.
destructible: stop_animation(anim_name)

replace_model

Replace model.

Parameter

VariableTypeDescription
model_idnumberModel ID.
destructible:replace_model(model_id)

cancel_replace_model

Cancel replace model.

Parameter

VariableTypeDescription
model_idnumberModel ID.
destructible: cancel_replace_model(model_id)

set_visible

Show/hide destructibles.

Parameter

VariableTypeDescription
is_visibleboolWhether to display.
destructible:set_visible(is_visible)

is_lockable_by_ability

Whether the destructible object can be selected by skill indicators or not.

Return value

TypeDescription
boolWhether it can be selected by the skill indicator.
destructible:is_lockable_by_ability()

is_attackable

Whether the destructible object can be attacked.

Return value

TypeDescription
boolWhether it can be attacked.
destructible:is_attackable()

is_selectable

Whether the destructible object can be selected.

Return value

TypeDescription
boolWhether it can be selected.
destructible: is_selectable()

is_collectable

Whether the destructible object can be harvested.

Return value

TypeDescription
boolWhether it can be collected.
destructible: is_collectable()

is_visible

Whether the destructible is visible or not.

Return value

TypeDescription
boolIs it visible.
destructible:is_visible()

is_alive

Whether the destructible is alive or not.

Return value

TypeDescription
boolIs it alive or not.
destructible: is_alive()

has_tag

Whether the destructible has a tag or not.

Parameters

VariableTypeDescription
tagTag name.

Return value

TypeDescription
boolWhether to have this tag.
destructible:has_tag(tag)

get_destructible_type

Get the destructible type.

Return value

TypeDescription
destructible_typeDestructible object type ID.
destructible: get_destructible_type()

get_destructible_name

Get the name of the destructible.

Return value

TypeDescription
strName of the destructible.
destructible: get_destructible_name()

get_destructible_description

Get destructible description.

Return value

TypeDescription
strDestructible object description.
destructible: get_destructible_description()

get_destructible_current_hp

Get the health of a destructible.

Return value

TypeDescription
numberLife value.
destructible: get_destructible_current_hp()

get_destructible_source_name

Get the resource name of the destructible.

Return value

TypeDescription
strResource name.
destructible: get_destructible_source_name()

get_destructible_max_hp

Get the maximum health of a destructible.

Return value

TypeDescription
numberLife value.
destructible: get_destructible_max_hp()

get_current_source_number

Get the current resource count of the destructible.

Return value

TypeDescription
numberNumber of resources.
destructible: get_current_source_number()

get_max_source_number

Get the maximum number of resources for destructibles.

Return value

TypeDescription
numberNumber of resources.
destructible: get_max_source_number()

get_resource_type

Get the player property of the destructible.

Return value

TypeDescription
strPlayer attribute name.
destructible: get_resource_type()

get_item_type

Get the item type of the destructible.

Return value

TypeDescription
numberItem type ID.
destructible: get_item_type()

get_model

Get the model of the destructible.

Return value

TypeDescription
numberModel ID.
destructible: get_model()

get_height

Get the height of the destructible.

Return value

TypeDescription
numberHeight.
destructible: get_height()

get_rotation

Get the facing angle of the destructible.

Return value

TypeDescription
numberFacing angle.
destructible: get_rotation()

get_position

Get the position of the destructible object.

Return value

TypeDescription
pointPoint where the destructible object is located.
destructible: get_position()

get_name_by_type

Get the name of the destructible type.

Parameter

VariableTypeDescription
typenumberType ID of the destructible.

Return value

TypeDescription
strName of the destructible type.
destructible. get_name_by_type(type)

get_description_by_type

Get the description of the destructible type.

Parameter

VariableTypeDescription
typenumberType ID of the destructible.

Return value

TypeDescription
strDescription of the destructible type.
destructible. get_description_by_type(type)

get_model_by_type

Get the model of the destructible type.

Parameter

VariableTypeDescription
typenumberType ID of the destructible.

Return value

TypeDescription
numberModel ID of the destructible type.
destructible. get_model_by_type(type)

destructible_in_event

Destructibles in events.

Parameter

VariableTypeDescription
datatableData in the event.

Return value

TypeDescription
destructibleDestructible in the event.
up. destructible_in_event(data)

Event

Destroyable triggers need to be contained in a group to use group variables.