User Tools

Site Tools


character

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
character [2024/10/21 20:30] justincharacter [2025/03/11 20:24] (current) justin
Line 10: Line 10:
  
 =====Scripting===== =====Scripting=====
-Refer to the table below for a list of character properties that can be accessed from a [[script]]. If the property's value can be changed using an [[script_syntax|assignment statement]], it will be noted in the description.+Refer to the table below for a list of character functions and properties that can be accessed from a [[script]]. If property's value can be changed using an [[script_syntax|assignment statement]], it will be noted in the description. 
 + 
 +^Function^Description^ 
 +|<character>.get_item_count("x")|Gives the count of a specific [[item]] in the [[character|character's]] [[inventory]], where "x" is a [[string]] containing the ID of the [[item]]. For example, you can use **player.get_item_count("ITEM_0001")** to check how many of "ITEM_0001" the player possesses.| 
 ^Property^Description^ ^Property^Description^
 |<character>.id|Entity ID of the character, as set in the [[Map Editor]] from the [[Entity Properties]] panel. This can be used to either retrieve or change the ID of the character.| |<character>.id|Entity ID of the character, as set in the [[Map Editor]] from the [[Entity Properties]] panel. This can be used to either retrieve or change the ID of the character.|
Line 17: Line 21:
 |<character>.behavior|[[npc_behavior|Behavior]] for the character, as set in the [[Map Editor]] from the [[Entity Properties]] panel. The character's [[npc_behavior|behavior]] can be changed by assigning a [[string]] value to this property containing the [[npc_behavior|behavior]] preset name. When accessing this property, a [[codex]] will be returned, allowing modification of individual [[npc_behavior|behavior]] settings. See [[NPC Behavior]] for more details.| |<character>.behavior|[[npc_behavior|Behavior]] for the character, as set in the [[Map Editor]] from the [[Entity Properties]] panel. The character's [[npc_behavior|behavior]] can be changed by assigning a [[string]] value to this property containing the [[npc_behavior|behavior]] preset name. When accessing this property, a [[codex]] will be returned, allowing modification of individual [[npc_behavior|behavior]] settings. See [[NPC Behavior]] for more details.|
 |<character>.stat["x"]|Value of a stat for the character, where "x" is a [[string]] containing the ID of the stat. This can be used to either retrieve or change the stat's value.| |<character>.stat["x"]|Value of a stat for the character, where "x" is a [[string]] containing the ID of the stat. This can be used to either retrieve or change the stat's value.|
-|<character>.attack_cooldown|Override for the character's attack cooldown. This value will be null by default, which indicates that the character's attack will use either the global cooldown (see "Attack Cooldown (Player)setting in the [[Combat Editor]]) or the character model's cooldown if set to a custom value (see "Attack Cooldown" in the [[Voxel Editor]]).|+|<character>.attack_cooldown|Override for the character's attack cooldown. This value will be null by default, which indicates that the character's attack will use either the global cooldown (see "Attack Cooldown" settings in the [[Combat Editor]])the character model's cooldown, or their equipped [[weapons|weapon's]] cooldown. If a value is assigned to this property, it will override their current cooldown.|
 |<character>.skills|An [[array]] of [[skill|skills]] currently possessed by the character. The [[array]] will contain [[string]] values, specifically the ID of each [[skill]]. The array will be empty if the character doesn't possess any [[skill|skills]]. This can be used in a "contains" [[conditional expression]] to check if a character has a specific [[skill]].| |<character>.skills|An [[array]] of [[skill|skills]] currently possessed by the character. The [[array]] will contain [[string]] values, specifically the ID of each [[skill]]. The array will be empty if the character doesn't possess any [[skill|skills]]. This can be used in a "contains" [[conditional expression]] to check if a character has a specific [[skill]].|
 |<character>.statuses|A [[codex]] of [[status_effect|status effects]] currently applied to the character. Each key is a status effect ID (e.g. "STATUS_0001") and its corresponding value is a [[codex]] of that status effect's properties. The [[codex]] will be empty if the character doesn't have any [[status_effect|status effects]] applied. This can be used in a "contains" [[conditional expression]] to check if a character has a specific [[status effect]].| |<character>.statuses|A [[codex]] of [[status_effect|status effects]] currently applied to the character. Each key is a status effect ID (e.g. "STATUS_0001") and its corresponding value is a [[codex]] of that status effect's properties. The [[codex]] will be empty if the character doesn't have any [[status_effect|status effects]] applied. This can be used in a "contains" [[conditional expression]] to check if a character has a specific [[status effect]].|
Line 29: Line 33:
 |<character>.interact_cursor|Interaction cursor for the character, as set in the [[Map Editor]] from the [[Entity Properties]] panel. This can be used to either retrieve or change the interaction cursor for the character. Valid values include "default", "walk", "interact", "speak", "attack", or any custom cursor defined in your [[game configuration]].| |<character>.interact_cursor|Interaction cursor for the character, as set in the [[Map Editor]] from the [[Entity Properties]] panel. This can be used to either retrieve or change the interaction cursor for the character. Valid values include "default", "walk", "interact", "speak", "attack", or any custom cursor defined in your [[game configuration]].|
 |<character>.property["x"]|Custom property stored on the character, where "x" is a [[string]] containing the name of the property. This can be used to either retrieve or change the property's value.| |<character>.property["x"]|Custom property stored on the character, where "x" is a [[string]] containing the name of the property. This can be used to either retrieve or change the property's value.|
 +|<character>.properties|All custom properties defined for the character. As it's a [[codex]], its keys can be iterated using a “for” loop (refer to the [[codex]] documentation for an example).|
 |<character>.model|Name of the character's model (e.g. "purple_slime").| |<character>.model|Name of the character's model (e.g. "purple_slime").|
 |<character>.frame|Current [[animation]] frame (as a [[number]], with the first frame being 1). This can be used to either retrieve or change the model's current frame. If this property is changed and an [[animation]] is playing, the [[animation]] will first be stopped.| |<character>.frame|Current [[animation]] frame (as a [[number]], with the first frame being 1). This can be used to either retrieve or change the model's current frame. If this property is changed and an [[animation]] is playing, the [[animation]] will first be stopped.|
character.1729567842.txt.gz · Last modified: 2024/10/21 20:30 by justin