Skip to content

NPCs (Map)

jjppof edited this page Dec 24, 2023 · 10 revisions

NPCs

These are the properties that can be set when creating an NPC in Tiled. NPC properties set here will override those ones in database file.

Properties

  • key_name [string]: the NPC key name that you registered in NPC db.
  • label [string]: a unique key name for this NPC instance. Useful to identify this specific NPC in Game Events, for example. Optional property.
  • npc_type [string]: the type of the npc, it can be "normal", "inn", "shop", "healer" or "sprite".
  • storage_keys [object]: some properties can also be set by storage values. The value of each property below should receive a storage value key name as value. The properties specified on this storage_keys property override the original ones set outside of it.
    • active: [storage_key_name]: whether this NPC is active or not.
    • position: [storage_key_name]: the x and y position of this NPC.
    • action: [storage_key_name]: the NPC action, examples: "idle", "walk", "dash"...
    • animation: [storage_key_name]: the NPC animation, examples "right", "up", "down"...
    • base_collision_layer: [storage_key_name]: see base_collision_layer in this doc to see what this property does.
    • affected_by_reveal: [storage_key_name]: see affected_by_reveal in this doc to see what this property does.
    • visible: [storage_key_name]: whether this NPC is visible or not.
    • movement_type: [storage_key_name]: see movement_type in this doc to see what this property does.
    • move_freely_in_event: [storage_key_name]: see move_freely_in_event in this doc to see what this property does.
    • interaction_pattern: [storage_key_name]: see interaction_pattern in this doc to see what this property does.
  • active [boolean]: if true, this npc is enabled, it will be shown on the map and also be able to interact with. Default is true.
  • voice_key [string]: the NPC voice key. These keys are set in SFX json db file.
  • avatar [string]: the NPC avatar image key name.
  • movement_type [string]: it determines how the npc is going to move. It can be "idle" or "random".
  • move_freely_in_event [boolean]: if true, the NPC can randomly walk while a game event is happening.
  • 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.
  • x [number]: the tile x position.
  • y [number]: the tile y position.
  • 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.
  • enable_footsteps [boolean]: if true, the NPC will be able to let footprints in the ground in maps that allows it. Default is false;
  • 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. Optional property. Value is in px.
  • 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. Optional property. Value is in px.
  • 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". Optional property. Value is in px.
  • action [string]: initial action key name. Examples: "idle", "walk", "dash"...
  • animation [string]: initial animation key name. Examples "right", "up", "down"...
  • message [string]: the dialog message that this NPC will begin when interacting with it. This text can be enhanced with placeholders
  • thought_message [string]: the thought message that this NPC will display when interacting with it when using Mind Read psynergy. This text can be enhanced with placeholders
  • back_interaction_message [string]: the dialog message that this NPC will begin when interacting with it from the back. Events and shops won't be activated when this variable is set. This text can be enhanced with placeholders
  • shop_key [string]: the key of the shop that this NPC owns.
  • inn_key [string]: the key of the inn that this NPC owns.
  • healer_key [string]: the key of the healer establishment that this NPC owns.
  • base_collision_layer [number]: the collision layer index where this NPC is.
  • affected_by_reveal [boolean]: if set to true, this NPC can have its visibility toggled by Reveal psynergy.
  • sprite_misc_db_key [string]: if this property is defined, this NPC will use a sprite info from misc_animation_db database instead of npc_db database.
  • visible [boolean]: if set to true, this NPC will be visible. Default is true.
  • allow_interaction_when_inactive [boolean]: if set to true, the hero will be able to interact with this NPC even if it's inactive. Default is false.
  • events [array]: list of Game Events objects that will be fired in sequence after the message dialog set in "message" property (in the case it's set) is shown. See Game Event section to have more info. Optional property.
  • after_psynergy_cast_events [object]: an object of psynergy keys that is associated with a list of Game Events. If the specified psynergy is cast on this NPC, the associated list of Game Events will be fired. Optional property.
    • [psynergy key name] [array]: list of Game Events that will be fired after the specified psynergy is cast. Required property.
  • force_char_stop_in_event [boolean]: if set to true, it will force this NPC to stop while in a game event (no movement). Default is true.
  • force_idle_action_in_event [boolean]: if set to true, it will force this NPC to assume idle action if it's forced to stop while in a game event (see force_char_stop_in_event property). Default is true.
  • allow_only_front_interaction [boolean]: if set to true, the hero will only be able to interact with this NPC when he's in front of it. Default is false.
Clone this wiki locally