======Character====== ---- A **character** is a resource type that can be used to represent the [[player_character|player]], an [[NPC]], or an [[enemy]]. Characters, similar to [[tile|tiles]] and [[object|objects]], are created in the [[Voxel Editor]]. Refer to the table below for more details around each of the usages for the character resource type. ^Usage^Details^ |Player Character|Any character created in the [[Voxel Editor]] can be used for your game's main [[player character]]. This is selected in the "General" section of the [[Game Configuration]]. The [[player character]] can also be overridden on a per [[map]] basis from the [[Map Properties]] panel.| |NPCs|A character can be used to represent an [[NPC]] by placing it into a [[map]] from the [[Map Editor]]. An [[NPC]] can have [[dialogue]] attached to it by selecting "Start Dialogue" for the "When Next to Player" or "When Player Interacts" [[npc_behavior|behavior]] setting, which allows the player to engage in a conversation with that [[NPC]].| |Enemies|A character can be configured as an [[enemy]] by placing it into a [[map]] from the [[Map Editor]] and then either selecting "Start Battle" for the "When Next to Player" or "When Player Interacts" [[npc_behavior|behavior]] setting or enabling the "Attackable in Real-Time" option from the [[Entity Properties]] panel. Character models are also used when configuring [[enemy|enemies]] from the [[Combat Editor]].| =====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. ^Property^Description^ |.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.| |.type|Type of [[entity]], in this case the constant value CHARACTER.| |.name|Name of the character, as set in the [[Voxel Editor]] from the [[Model Properties]] panel. This can be used to either retrieve or change the name of the 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.| |.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.| |.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]].| |.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]].| |.quests|An [[array]] of [[quest|quests]] currently assigned to the character. The [[array]] will contain [[string]] values, specifically the ID of each [[quest]]. The array will be empty if the character doesn't have any [[quest|quests]].| |.portrait|Portait [[image]] for the character, as set in the [[Voxel Editor]] from the [[Model Properties]] panel. This can be used to either retrieve or change the portrait [[image]] for the character.| |.coord|[[Coordinate]] of the character.| |.direction|[[Cardinal direction]] (NORTH, SOUTH, WEST, EAST) in which the character is rotated. The default direction of an [[entity]] is SOUTH.| |.tiles|An [[array]] of [[tile|tiles]] that the character is currently occupying.| |.groups|An [[array]] of [[groups]] to which the character is assigned. The [[array]] will be empty if the character is not assigned to any [[groups]].| |.tags|An [[array]] of tags (as [[string|strings]]) for the character, as set in the [[Voxel Editor]] from the [[Model Properties]] panel.| |.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]].| |.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.| |.model|Name of the character's model (e.g. "purple_slime").| |.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.| |.animation|Name of the [[animation]] currently playing for this character (as a [[string]]). Value will be null if no [[animation]] is playing.| |.animations|An [[array]] of [[animation]] names defined for this character. The names will be [[string]] values.| |.attach_points|An [[array]] of [[attach_points|attach point]] names defined for this character (across all [[animation]] frames). The names will be [[string]] values. The [[array]] will be empty if no [[attach points]] are defined.| |.attachment["x"]|[[Object]] attached to the character, where "x" is the [[attach_points|attach point]] ID.| |.effect["x"]|[[Effect]] attached to the character, where "x" is the [[attach_points|attach point]] ID.| |.textures|An [[array]] of texture names defined for this character. The names will be [[string]] values.| |.front_tile|[[Tile]] in front of the character relative to their current direction (if one is connected via navigation, otherwise null is returned).| |.back_tile|[[Tile]] behind the character relative to their current direction (if one is connected via navigation, otherwise null is returned).| |.left_tile|[[Tile]] to the left of the character relative to their current direction (if one is connected via navigation, otherwise null is returned).| |.right_tile|[[Tile]] to the right of the character relative to their current direction (if one is connected via navigation, otherwise null is returned).| |.north_tile|[[Tile]] to the north of the character (if one is connected via navigation, otherwise null is returned).| |.south_tile|[[Tile]] to the south of the character (if one is connected via navigation, otherwise null is returned).| |.west_tile|[[Tile]] to the west of the character (if one is connected via navigation, otherwise null is returned).| |.east_tile|[[Tile]] to the east of the character (if one is connected via navigation, otherwise null is returned).| ~~NOTOC~~