Skip to content

NPCs (DB)

jjppof edited this page Oct 16, 2022 · 1 revision

Database file for NPCs. See an example. This json file is an array of objects, each object corresponds to an NPC type. NPC properties set in the map will override these ones.

Properties

  • key_name [string]: the NPC unique key name.
  • voice_key [string]: the NPC voice key. These keys are set in SFX json db file.
  • avatar [string]: the NPC avatar image key name.
  • anchor_x [number]: x anchor of the sprite. 0 is 0%, 1 is 100%, see.
  • anchor_y [number]: y anchor of the sprite. 0 is 0%, 1 is 100%, see.
  • scale_x [number]: x scale of the sprite. 0 is 0%, 1 is 100%, see.
  • scale_y [number]: y scale of the sprite. 0 is 0%, 1 is 100%, see.
  • body_radius [number]: the radius of the colliding body.
  • move_freely_in_event [boolean]: if true, the NPC can randomly walk while a game event is happening.
  • collision_body_bevel [number]: collision bodies of NPCs are not a circle by default. Use this property to set the bevel of the edges of the collision body.
  • interaction_pattern [string]: this is the pattern on how the hero will interact with this NPC. It can be "cross", "tik_tak_toe", "simple_interaction" or "no_interaction". "cross" means that the hero and NPC will only assume cardinal directions on interaction. "tik_tak_toe" means that the hero and NPC will assume cardinal and ordinal directions on interaction. "simple_interaction" means that the hero can interact, but won't change direction, this is useful when directions don't matter for this NPC. If "no_interaction", the hero won't be able to interact with this NPC.
  • no_shadow [boolean]: if true, the NPC is going to have no shadow.
  • ignore_physics [boolean]: if true, the NPC won't have a collision body.
  • ignore_world_map_scale [boolean]: if true, this NPC in world map won't have its scale changed.
  • walk_speed [number]: the NPC walk speed.
  • dash_speed [number]: the NPC dash speed.
  • climb_speed [number]: the NPC climb speed.
  • max_distance [number]: only works if this NPC movement type is "random". Sets this NPC max distance to step from starting point.
  • step_duration [number]: only works if this NPC movement type is "random". Sets this NPC step duration in ms.
  • wait_duration [number]: only works if this NPC movement type is "random". Sets this NPC wait duration in ms till start next step.
  • base_step [number]: only works if this NPC movement type is "random". Sets this NPC base/minimal step size.
  • step_max_variation [number]: only works if this NPC movement type is "random". Sets this NPC max step size variation, this will be added to "base_step".
  • talk_range [number]: max necessary distance between this NPC and Hero to start an interaction.
  • initial_action [string]: initial action key name.
  • action_aliases [object]: a dictionary that indicates an alias for an action name.
    • [alias_name]: [action_name]: replace alias_name by the action alias and action_name by the original action name.
  • actions [object]: an object of objects describing the animations of this NPC. The key of each internal object should be the action key:
    • animations [array]: array of animations or directions key name (e.g. "up", "down"...).
    • frame_rate [number|array|array of array]: the animations frame rate. If all animations have the same frame rate, just set a number for it. If each animation has a different frame rate, set it as an array with the animations property array length indicating a frame rate for each animation. If each frame of an animation has a different frame rate, but all the animations follow the same pattern, set it as an array of an array containing a frame rate for each frame (eg. [[x, y, z]], for 3 frames). Finally, if all animations have different patterns of frame rate, set it as an array with animations property array length and, in each position of this array, set an array with the frame rate for each frame (eg. [[a, b, c], [x, y, z]], for 2 animations of 3 frames).
    • frames_count [number|array]: if it's an array, it has to have the same length as animations property array, for each animation specify the number of frames it has. But, if all animations have the same number of frames, just specify a number for it.
    • loop [boolean|array]: if it's an array, it has to have the same length as animations property array, for each animation specify if the animation is going to loop or not. But, if all positions have the same behavior, just specify a boolean for it.
    • spritesheet [object]: the spritesheet paths for this action:
      • image [string]: the spritesheet image relative path.
      • json [string]: the spritesheet json relative path.
Clone this wiki locally