Skip to content

EquipItemTask ​

Inherits: BehaviorTask < Resource

Equip or unequip equipment items from the entity's inventory

Properties ​

intitem_id0
EquipTypeequip_optionEquipType.EQUIP
boolfail_if_item_not_foundtrue
boolfail_on_action_errortrue

Variables ​

ItemDefinitionEquipmenttarget_itemnull
boolaction_completedfalse

Methods ​

voidexecute_task_start()
voidexecute_task_complete()
voidexecute_task_interrupt()
voidexecute_task_fail()
voidset_item_id( new_item_id: int )
voidset_equip_action( action: EquipType )
boolis_item_equipped( check_item_id: int )
boolis_item_in_inventory( check_item_id: int )
boolwas_action_completed()

Enumerations ​

enum EquipType ​

The options of equip type: equip, unequip.

  • EQUIP = 0
  • UNEQUIP = 1

Property descriptions ​

Target

int item_id = 0 ​

The item ID to equip/unequip

EquipType equip_option = EquipType.EQUIP ​

What action to perform with the item

Behavior

bool fail_if_item_not_found = true ​

Whether to fail if the item is not found in inventory (for equip) or not equipped (for unequip)

bool fail_on_action_error = true ​

Whether to fail if the action cannot be completed

Variable descriptions ​

ItemDefinitionEquipment target_item = null ​

The item the entity equips or takes off.

bool action_completed = false ​

True once the item is equipped or taken off.

Method descriptions ​

void execute_task_start() ​

Execute the task - equip or unequip the specified item

void execute_task_complete() ​

Task completed successfully

void execute_task_interrupt() ​

Nothing to interrupt for equipment actions

void execute_task_fail() ​

Nothing to clean up for equipment actions

void set_item_id( new_item_id: int ) ​

Set the item ID to equip/unequip dynamically

void set_equip_action( action: EquipType ) ​

Set the equip action dynamically

bool is_item_equipped( check_item_id: int ) ​

Check if the specified item is currently equipped

bool is_item_in_inventory( check_item_id: int ) ​

Check if the specified item is in inventory

bool was_action_completed() ​

Get whether the last action was completed successfully