User Tools

Site Tools


character

This is an old revision of the document!


Character


A character is a resource type that can be used to represent the player, an NPC, or an enemy. Characters, similar to tiles and 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.

UsageDetails
Player CharacterAny 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.
NPCsA 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” behavior setting, which allows the player to engage in a conversation with that NPC.
EnemiesA 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” behavior setting or enabling the “Attackable in Real-Time” option from the Entity Properties panel. Character models are also used when configuring 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 assignment statement, it will be noted in the description.

PropertyDescription
<character>.idEntity 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>.typeType of entity, in this case the constant value CHARACTER.
<character>.coordCoordinate of the character.
<character>.directionCardinal direction (NORTH, SOUTH, WEST, EAST) in which the character is rotated. The default direction of an entity is SOUTH.
<character>.tilesAn array of tiles that the character is currently occupying.
<character>.groupsAn array of groups to which the character is assigned. The array will be empty if the object is not assigned to any groups.
<character>.tagsAn array of tags (as strings) for the character, as set in the Voxel Editor from the Model Properties panel.
<character>.interact_cursorInteraction 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>.modelName of the character's model (e.g. “purple_slime”).
<character>.frameCurrent 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>.animationsAn array of animation names defined for this character. The names will be string values.
<character>.attach_pointsAn array of 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.
character.1636422490.txt.gz · Last modified: 2021/11/08 17:48 by justin