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 revisionBoth sides next revision
character [2020/05/07 10:53] justincharacter [2021/11/08 17:48] justin
Line 8: Line 8:
 |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]].| |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]].| |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^
 +|<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>.type|Type of [[entity]], in this case the constant value CHARACTER.|
 +|<character>.coord|[[Coordinate]] of the character.|
 +|<character>.direction|[[Cardinal direction]] (NORTH, SOUTH, WEST, EAST) in which the character is rotated. The default direction of an [[entity]] is SOUTH.|
 +|<character>.tiles|An [[array]] of [[tile|tiles]] that the character is currently occupying.|
 +|<character>.groups|An [[array]] of [[groups]] to which the character is assigned. The [[array]] will be empty if the object is not assigned to any [[groups]].|
 +|<character>.tags|An [[array]] of tags (as [[string|strings]]) for the character, as set in the [[Voxel Editor]] from the [[Model Properties]] panel.|
 +|<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>.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>.animations|An [[array]] of [[animation]] names defined for this character. The names will be [[string]] values.|
 +|<character>.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.|
  
 ~~NOTOC~~ ~~NOTOC~~
character.txt · Last modified: 2024/03/14 09:43 by justin