Skip to content

CreateItemTask ​

Inherits: BehaviorTask < Resource

Emit signals for item creation instead of directly creating items Allows external systems to handle item creation logic (inventory, drops, rewards, etc.) Focuses on single item creation with configurable quantity

Properties ​

intitem_id0
intquantity1
booltarget_selftrue
boolvalidate_item_existstrue
boolfail_on_invalid_itemtrue

Variables ​

boolsignal_emittedfalse
boolitem_validatedfalse
Stringvalidation_error""

Methods ​

voidexecute_task_start()
voidexecute_task_complete()
voidexecute_task_interrupt()
voidexecute_task_fail()
voidset_item( new_item_id: int, new_quantity: int = 1 )
boolis_item_valid()
Stringget_item_name()
Stringget_task_description()
boolwas_signal_emitted()
boolwas_item_validated()
Stringget_validation_error()
Dictionaryget_configuration()

Property descriptions ​

Item Configuration

int item_id = 0 ​

Item ID to create (0 = no item)

int quantity = 1 ​

Quantity to create (must be positive)

Target

bool target_self = true ​

Whether to target the executing entity (true) or emit signal with null entity (false)

Validation

bool validate_item_exists = true ​

Whether to validate that the item ID exists in the database before emitting signal

bool fail_on_invalid_item = true ​

Whether to fail the task if item validation fails

Variable descriptions ​

bool signal_emitted = false ​

True once the task emitted its signal.

bool item_validated = false ​

True once the item was checked.

String validation_error = "" ​

Why the item did not pass the check.

Method descriptions ​

void execute_task_start() ​

Starts the task.

void execute_task_complete() ​

Called when the task finishes well.

void execute_task_interrupt() ​

Called when something interrupts the task.

void execute_task_fail() ​

Called when the task fails.

void set_item( new_item_id: int, new_quantity: int = 1 ) ​

Set the item and quantity to request

bool is_item_valid() ​

Check if the configured item ID exists in the database

String get_item_name() ​

Get the item name for display purposes

String get_task_description() ​

Get a description of what this task will do

bool was_signal_emitted() ​

Check if signal was emitted in last execution

bool was_item_validated() ​

Check if item was validated in last execution

String get_validation_error() ​

Get validation error from last execution

Dictionary get_configuration() ​

Get the current configuration as a dictionary