Data Storage: Difference between revisions

From Citizens Wiki

(Fixed talk-close)
Line 17: Line 17:
       {{H:title|Type of NPC. Either PLAYER or the mob type|type: PLAYER}}
       {{H:title|Type of NPC. Either PLAYER or the mob type|type: PLAYER}}
       {{H:title|Owner of the NPC. Can be set to "server".|owner: Steve}}
       {{H:title|Owner of the NPC. Can be set to "server".|owner: Steve}}
       {{H:title|Should the NPC look at the player when he comes near it?|look-close: true}}
       {{H:title|Should the NPC look at the player when he comes near it?|lookclose: true}}
       {{H:title|Location block. Stores the location of the NPC|location:}}
       {{H:title|Location block. Stores the location of the NPC|location:}}
         {{H:title|World that the NPC is located in|world: world}}
         {{H:title|World that the NPC is located in|world: world}}

Revision as of 13:14, 13 August 2012

Data storage in Citizens2 is handled in one of two ways: YAML flatfile, or a SQL database.

saves.yml

saves.yml is used by default to store all data on created NPCs.

Structure

Mouseover to view info:

# Citizens NPC Storage
npc:
  '0':
   name: My_First_NPC
   traits:
     age:
       age: 0
       locked: true
     spawned: true
     type: PLAYER
     owner: Steve
     lookclose: true
     location:
       world: world
       x: '92.65002360423462'
       y: '3.0'
       z: '-264.5621058817138'
       yaw: '87.90003967285156'
       pitch: '21.14999008178711'
     text:
       talk-close: true
       random-talker: true
       0: Hello, there. I'm My_First_NPC.
     waypoints:
       waypoints:
         '0':
           location:
             world: MyWorld
             x: 60
             y: 64
             z: 80
             pitch: 90
             yaw: 0
         '1':
           location:
             world: MyWorld
             x: 65
             y: 64
             z: 82
             pitch: 45
             yaw: 0

Database

Database usage can be configured inside of the config.yml. Database usage requires more setup, but may be quicker, more secure and more resilient when dealing with large numbers of NPCs.

Configuration

A quote from the config.yml (mouseover to view info):

database:
 password: 
 username: 
 url: 
 driver: 

See also: Configuration