NPCs

In Ranvier all NPCs for an area are defined in a single file within the area folder: npcs.yml

Example File

bundles/ranvier-areas/areas/limbo/npcs.yml

- id: rat
  keywords: ['rat']
  name: 'Rat'
  level: 2
  description: "The rat's beady red eyes dart frantically, its mouth foaming as it scampers about."
  script: '1-rat'
  items: ['limbo:sliceofcheese']
  quests: ['limbo:onecheeseplease']
  attributes:
    health: 100
    speed: 2.5
  damage: 1-7
- id: wiseoldman
  keywords: ["wise", "old", "man"]
  name: "Wise Old Man"
  description: "A wise looking old man sits on the ground with legs crossed."
- id: 3
  keywords: ["dummy", "target", "practice"]
  level: 2
  name: "Training Dummy"
  behaviors:
    lootable:
      table:
        pools:
        - "limbo:junk"
        - "limbo:sliceofcheese": 25

Here we have two NPCs. The rat can enter combat, has a custom script, a default inventory, hands out a quest and has some extra attributes. The old man is the most basic NPC you can have.

Definition Fields

field type (default)


id string
required NPC id, unique among the NPCs of the current area
name string
required String displayed when the player sees the NPC in the room
keywords string
required Keywords that the player can use to target this NPC, keywords do not need to be unique
description string
required String displayed when the player looks directly at the NPC
script string
Name of custom script to attach to this NPC (See Scripting)
behaviors Object<string,Object>
List of behaviors to attach to this NPC. The key is the behavior name, the value is the configuration object for that behavior. (See Scripting for creating behaviors)
metadata object
A place to put other data you want to access inside scripts/behaviors/commands/etc. that doesn't fit into one of the existing properties. See Character.getMeta and Character.setMeta. Note: changes to metadata while the server is running will be lost when the server is shut down.
attributes object
Arbitrary list of attributes to attach to this NPC. Unlike items, these attributes will be turned into an AttributesMap (see src/Attributes and src/Character, so these are not arbitrary.
items array<EntityReference>
List of Entity References representing the NPC's default inventory
quests array<EntityReference>
List of Entity References representing the quests that this character gives out (See Quests)