Skip to content

CharacterDefinition ​

Inherits: EntityDefinition < DatabaseResource < Resource

Inherited by: CustomCharacterDefinition

Character Definition - Unique template for creating player characters References a PlayerClassDefinition and inherits visual/audio from EntityDefinition

Properties ​

intplayer_class0
Array[int]skill_trees[]
intstarting_level0
Dictionaryequipment_override{}
Dictionaryinventory{ ... }

Methods ​

boolhas_class_definition()
PlayerClassDefinitionget_class_definition()
voidset_class_definition( new_class: int )
Stringget_class_name()
intget_class_id()
intget_character_id()
voidset_character_id( new_id: int )
Stringget_character_name()
voidset_character_name( new_name: String )
CompressedTexture2Dget_character_icon()
voidset_character_icon( new_icon: CompressedTexture2D )
Stringget_effective_display_name()
CompressedTexture2Dget_effective_icon()
intget_effective_starting_level()
Dictionaryget_effective_starter_equipment()
boolhas_equipment_override()
Dictionaryget_inventory()
voidset_inventory( new_inventory: Dictionary )
voidadd_inventory_item( item_id: int, quantity: int = 1 )
boolremove_inventory_item( item_id: int, quantity: int = 1 )
voidclear_inventory_item( item_id: int )
intget_inventory_item_quantity( item_id: int )
boolhas_inventory_item( item_id: int )
Dictionaryget_inventory_items()
voidadd_currency( currency_id: int, amount: int )
boolremove_currency( currency_id: int, amount: int )
voidset_currency_amount( currency_id: int, amount: int )
intget_currency_amount( currency_id: int )
boolhas_currency( currency_id: int )
Dictionaryget_currencies()
voidclear_currency( currency_id: int )
voidclear_all_inventory()
Array[String]validate()
boolis_valid()
Stringget_display_name()

Property descriptions ​

Class Configuration

int player_class = 0 ​

PlayerClassDefinition this character is based on (required)

Skill Trees

Array[int] skill_trees = [] ​

Skill trees of this character, on top of the trees of the class (a general tree that is not tied to a class). Ids of the skill_tree type

Starting Configuration

int starting_level = 0 ​

Starting level for this character (if 0, starts at level 1)

Equipment Override

Dictionary equipment_override = ​

Starting equipment override (if empty, uses class starter_equipment) Format: Dictionary[int, int] where key is "SlotName:instance" and value is item_id

Starting Inventory

Dictionary inventory ​

Character's starting inventory - items & currency for new character

Method descriptions ​

bool has_class_definition() ​

Check if has class definition

PlayerClassDefinition get_class_definition() ​

Get class definition

void set_class_definition( new_class: int ) ​

Set class definition

String get_class_name() ​

Get class name

int get_class_id() ​

Get class ID

int get_character_id() ​

Get character ID

void set_character_id( new_id: int ) ​

Set character ID

String get_character_name() ​

Get character name

void set_character_name( new_name: String ) ​

Set character name

CompressedTexture2D get_character_icon() ​

Get character icon

void set_character_icon( new_icon: CompressedTexture2D ) ​

Set character icon

String get_effective_display_name() ​

Get effective display name (falls back to class if empty)

CompressedTexture2D get_effective_icon() ​

Get effective icon (falls back to class if null)

int get_effective_starting_level() ​

Get effective starting level (falls back to 1 if 0)

Dictionary get_effective_starter_equipment() ​

Get effective starter equipment (uses override if set, otherwise class equipment)

bool has_equipment_override() ​

Check if has equipment override

Dictionary get_inventory() ​

Get inventory with proper structure

void set_inventory( new_inventory: Dictionary ) ​

Set inventory

void add_inventory_item( item_id: int, quantity: int = 1 ) ​

Add item to inventory

bool remove_inventory_item( item_id: int, quantity: int = 1 ) ​

Remove item from inventory

void clear_inventory_item( item_id: int ) ​

Clear specific item from inventory

int get_inventory_item_quantity( item_id: int ) ​

Get item quantity

bool has_inventory_item( item_id: int ) ​

Check if inventory has item

Dictionary get_inventory_items() ​

Get all inventory items

void add_currency( currency_id: int, amount: int ) ​

Add currency

bool remove_currency( currency_id: int, amount: int ) ​

Remove currency

void set_currency_amount( currency_id: int, amount: int ) ​

Set currency amount

int get_currency_amount( currency_id: int ) ​

Get currency amount

bool has_currency( currency_id: int ) ​

Check if has currency

Dictionary get_currencies() ​

Get all currencies

void clear_currency( currency_id: int ) ​

Clear specific currency

void clear_all_inventory() ​

Clear entire inventory

Array[String] validate() ​

Validate character configuration

bool is_valid() ​

Check if character is valid

String get_display_name() ​

Get display name for editor (includes ID)