Denizen/0.7/Before Using Denizen

From Citizens Wiki

< Denizen‎ | 0.7

Revision as of 18:23, 5 February 2013 by AgentKid (talk | contribs) (AgentKid moved page Denizen/Before Using Denizen to Denizen/0.7/Before Using Denizen without leaving a redirect)

Welcome to Denizen! Grand adventure awaits, but let's get the basics out of the way first. On this page you will find instructions for installing Denizen, description of what the various files are used for, and a brief overview of what this is all about.

Getting Started

Denizen is in BETA! Expect a few bugs here and there! If you are having problems, /denizen debug is your friend! We're always willing to help out in #denizen-dev on EsperNET as well. If you do come across any errors beyond bad command syntax, please report them to the Github Issues page for Denizens.

Denizen is not a drag-and-go type of plugin. In fact, Denizen won't do anything unless you assign and define scripts to NPCs. It's highly customizable. With the new Repository in development, we hope there will be a wide array of par-baked scripts that you can easily download and customize to your server, but perhaps the most exciting part of Denizen is the ability to write your own scripts. In order to write awesome scripts, you will probably need to read the entirety of this wiki page and think outside the box! Someone is always around IRC to help out and provide suggestions, but please don't ask about the basics unless you have consulted here first.

Some Denizen commands and requirements REQUIRE you to have other plugins, such as Vault, installed with a compatible Permissions System and and Economy System. If the commands deals with money or permissions, chances are you will need Vault in order to utilize it. We're also getting ready to release command/requirement packs for Heroes and mcMMO, so stay tuned!

The easiest way to use Denizen for the first time is to download the Start-up Kit. This includes the default config file, sample scripts, and sample assignments to get you started. It is still recommended that you read as much of the wiki as you can take in to properly utilize Denizen's power and flexibility.


Down and dirty

By now, you probably just want to see how to add custom content, right? Here's a quick, down-and-dirty walk-through to get your first custom NPC up and going. First you should have the Start-up Kit, or at least an existing assignments.yml and script.yml. These are the files that you will be adding to in this walkthrough. Remember: The files should be placed in your server folder so that it resembles the format mentioned in File Structure. Once everything is in place, start up your server.


1: Make a NPC by using C2 commands to create a new NPC, and assign a trait. We will use Notch in this example. See also: /NPC Commands.

/npc create Notch --trait denizen

Note: You could alternatively use /trait denizen if working with an existing NPC.


2: Create a script for Notch. See also: Writing Denizen Scripts.
Create a new file in plugins/Denizen/scripts/ named Notch Cookies.yml. Next, copy the contents of the small script below. This script gives a small random greeting to Notch with an 'easter egg' surprise if you know the secret word.

'Notch Greeting':
  Type: Interact
  Requirements:
    Mode: None
  Steps:
    1:
      Click Trigger:
        Script:
        - RANDOM 3
        - CHAT 'I Like Cookies!'
        - CHAT 'MMmm.. cookies are my favorite!'
        - CHAT 'Cocoa and Wheat make me freak!'
      Chat Trigger:
        1:
          Trigger: 'I love /cookie/s!'
          Script: 
          - CHAT 'Me too!'
          - EMOTE 'gives <PLAYER> some cookies.'
          - GIVE COOKIE QTY:6
          - ZAP 2
    2:
      Click Trigger:
        Script:
        - CHAT 'How were the cookies?'


3: Assign notch some scripts. See also: Assigning Denizen Scripts.
Open your assignments.yml. If none exists, create it in your /plugins/Denizen folder. Insert the following into your YML file. If Denizens: is not at the top of this document, create it.

Denizens:
  # ...
    # ...
  Notch:
    Interact Scripts:
    - 10 Notch Greeting
    Texts:
      No Click Trigger: Stop poking me!
      Denizen Unavailable: Sorry! Busy eating cookies!
      No Chat Trigger: I only understand cookies.

This text gives Notch some simple messages for specified circumstances. It also assigns the Notch Cookies script that we just wrote in the section above.


4: Reload Denizen. See also: Denizen Reload.
This will ensure that the information has taken. First, in the console or your minecraft client, type /denizen reload. This will reload assignments.yml, config.yml, saves.yml, re-concantenate scripts, and perform some cleaning up of objects and such. This is a good time to check the console for any errors. If found, head on over to Troubleshooting.


5: Check Denizen NPC status. See also: Info-Click.
Info-Click your Denizen NPC by crouching and right-clicking it. This will output a couple of pages of information showing Citizens2 NPC stats, current Interact scripts, Trigger status, Bookmarks, and more. In the case of our example, Notch should have a single entry under Interact Scripts for Notch Cookies.


6: Click on Notch! Play out the script. It's that easy! Go up to Notch and chat 'cookie' for the super secret special surprise.


Note: This seems like as good of time as any to mention that if any interact script you are using have a 'proximity', 'location', or 'damage trigger', these must be turned on, per NPC. They are off by default as to keep performance as high as possible. See In Game Commands for more info.

Ready to dive deeper? start with either Denizen/Interact_Scripts or Denizen/Activity_Scripts