Denizen/0.7/Before Using Denizen: Difference between revisions
Aufdemrand (talk | contribs) |
Aufdemrand (talk | contribs) |
||
Line 73: | Line 73: | ||
THIS SECTION UNDER CONSTRUCTION | THIS SECTION UNDER CONSTRUCTION | ||
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 [[Denizen/Start-up kit|Start-up Kit]]. | 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 [[Denizen/Start-up kit|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|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: [[Commands|/NPC Commands]]. | '''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: [[Commands|/NPC Commands]]. | ||
Line 95: | Line 94: | ||
- CHAT 'I Like Cookies!' | - CHAT 'I Like Cookies!' | ||
- CHAT 'MMmm.. cookies are my favorite!' | - CHAT 'MMmm.. cookies are my favorite!' | ||
- CHAT 'Cocoa | - 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?' | |||
</pre> | |||
Revision as of 21:26, 8 September 2012
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 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. In order to write awesome scripts, you will 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.
File Structure
denizen.jar
config.yml
This file can be reloaded from disk to Denizen memory at any time by using /denizen reload. Some changes in the config.yml may require a restart of the server. This includes interact_delay_in_ticks, but is not limited to that config node.
See: Denizen/config.yml for a stock copy and explanation of all available options.
assignments.yml
This file can be reloaded from disk into Denizen memory at any time by using /denizen reload
saves.yml
To reiterate: This file saves periodically, and automatically, upon progression and a server stop, and should only be edited by hand when the server is off or Denizen is disabled.
read-only-scripts.yml
This file is populated on a server restart, or by using the /denizen reload
command.
/scripts/ folder
/denizen reload
, the files are combined and put into the read-only-scripts.yml for the Denizen to read from. This allows better organization of scripts to be maintained, since the amount of scripts can easily get into the triple digits.
The files in the plugins/Denizen/scripts/ folder can be named whatever you please, as long as they end in .yml
. Be sure not to duplicate script names from file to file as this will cause problems. All scripts in the scripts folder are merged into read-only-scripts.yml
, so there will be an issue if two scripts are named the same.
How it works
Denizen is an extension of Citizens2 that adds an incredible amount of interactivity and automation. In Denizen, scripts are assigned to Citizens NPCs that make them do things. These NPCs must have been given the Denizen Trait to function. See: Citizens commands. Scripts are assigned in the assignments.yml file mentioned above. The scripts themselves can be placed in any .yml file in the Denizen/scripts/ folder.
There are 2 major types of scripts when working with NPCs:
- Interact Scripts - run commands when a player interacts with a Denizen in a variety of different ways. Different commands can be run based on player and world conditions using requirements.
- Activity Scripts - give the Denizen continuous jobs or activities to make them feel more alive. Note: As of version 0.7, this is brand new, so hang tight for more Activities!
There are also TASK Scripts, which can be utilized by other scripts and plugins. See: Task Scripts
Down and dirty
THIS SECTION UNDER CONSTRUCTION
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?'
- Name your NPC something that matches an assignment in the assignments.yml. See also:
- Next assign the 'denizen' trait using the /trait command.
- Double check assignments by crouching and right-clicking the NPC.
- The Denizen is now set to run its scripts!
If any interact script you are using has a 'proximity', 'location', or 'damage trigger', these must be turned on. 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