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 ​
int | player_class | 0 |
Array[int] | skill_trees | [] |
int | starting_level | 0 |
Dictionary | equipment_override | {} |
Dictionary | inventory | { ... } |
Methods ​
bool | has_class_definition() |
PlayerClassDefinition | get_class_definition() |
void | set_class_definition( new_class: int ) |
String | get_class_name() |
int | get_class_id() |
int | get_character_id() |
void | set_character_id( new_id: int ) |
String | get_character_name() |
void | set_character_name( new_name: String ) |
CompressedTexture2D | get_character_icon() |
void | set_character_icon( new_icon: CompressedTexture2D ) |
String | get_effective_display_name() |
CompressedTexture2D | get_effective_icon() |
int | get_effective_starting_level() |
Dictionary | get_effective_starter_equipment() |
bool | has_equipment_override() |
Dictionary | get_inventory() |
void | set_inventory( new_inventory: Dictionary ) |
void | add_inventory_item( item_id: int, quantity: int = 1 ) |
bool | remove_inventory_item( item_id: int, quantity: int = 1 ) |
void | clear_inventory_item( item_id: int ) |
int | get_inventory_item_quantity( item_id: int ) |
bool | has_inventory_item( item_id: int ) |
Dictionary | get_inventory_items() |
void | add_currency( currency_id: int, amount: int ) |
bool | remove_currency( currency_id: int, amount: int ) |
void | set_currency_amount( currency_id: int, amount: int ) |
int | get_currency_amount( currency_id: int ) |
bool | has_currency( currency_id: int ) |
Dictionary | get_currencies() |
void | clear_currency( currency_id: int ) |
void | clear_all_inventory() |
Array[String] | validate() |
bool | is_valid() |
String | get_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)