Denizen/0.7/Before Using Denizen: Difference between revisions

From Citizens Wiki

< Denizen‎ | 0.7

No edit summary
No edit summary
 
(34 intermediate revisions by 4 users not shown)
Line 1: Line 1:
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===
<div style="margin-right:2.0em; padding:10px; font-family:museo-sans; font-size:110%;">


Denizen is in BETA! Expect a few bugs here and there! If you are having problems, [[#Debug_Mode|<code>/denizen debug</code>]] is your friend! We're always willing to help out in [irc://irc.esper.net #denizen-dev on EsperNET] as well. If you do come across any errors beyond bad command syntax, please  report them to the [http://www.github.com/aufdemrand/Denizen/issues Github Issues page for Denizens].
For more up-to-date information and full details on specific features (individual commands or tags, for example), check the [https://one.denizenscript.com/denizen/cmds/ Meta Documentation].
 
If you want a full tutorial to help get you set up, check out the [https://one.denizenscript.com/denizen/cmds/denizen/vids Tutorial Videos] on youtube or the [https://guide.denizenscript.com/ Beginner's Guide] text website.
 
If you need quick help, visit our [https://discord.gg/Q6pZGSR Discord group].
 
<br><br><br>
 
<span style="font-family:natalya-alternate-one; font-size:300%; margin-right:-7px; margin-left:-10px;">This wiki is outdated, please view the tutorial videos/guide, meta documentation, or Discord group (all linked above) for up-to-date information!</span>


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! I'm 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 [http://dev.bukkit.org/server-mods/vault/ 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.
<s>


The easiest way to use Denizen for the first time is to download the [http://dl.dropbox.com/u/44002922/Start-up%20Kit.zip Start-up Kit] with sample .yml configuration files and scripts. This includes the default config file, sample scripts, and sample assignments to get you started.
<div style="font-family:camingodos-web;">
<div style="float:right;margin-left:2.0em; padding:10px; font-family:camingodos-web; font-size:110%; ">__TOC__</div>


Denizen relies on a few files to run properly, so let's first go over the file structure.
<div style="margin-right:2.0em; margin-top:35px; padding:10px; font-family:camingodos-web; font-size:110%;">
<span style="font-family:natalya-alternate-one; font-size:650%; margin-right:-7px; margin-left:-10px;">W</span>elcome 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.
</div>
</div>


=== File Structure ===
===Getting Started===
[[File:Figure 1 - Denizen file structure.png|center|Denizen File Structure]]
<div style="margin-right:2.0em; padding:10px; font-family:camingodos-web; font-size:110%;">Denizen is in BETA! Expect a few bugs here and there! If you are having problems, [[Denizen/0.7/In_Game_Commands#Debug_Mode|<code>/denizen debug</code>]] is your friend! We're always willing to help out in [irc://irc.esper.net #denizen-dev on EsperNET] as well. If you do come across any errors beyond bad command syntax, please  report them to the [http://www.github.com/aufdemrand/Denizen/issues Github Issues page for Denizens].
<div style="margin-right:2.0em; padding:10px; font-family:museo-sans; font-size:110%;">
 
Denizen requires the use of a few different YML files to operate properly. This includes a config.yml, assignments.yml, scripts, and saves.yml.  
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 [http://scripts.citizensnpcs.com|Script 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 [http://dev.bukkit.org/server-mods/vault/ 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 [[Denizen/0.7/Start-up kit|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.
</div>
</div>


==== denizen.jar ====
<div style="margin-right:2.0em; padding:10px; font-family:museo-sans; font-size:110%;">
I've gotten a few questions about where to place the Denizen JAR file. It should be treated like any other bukkit plugin and be placed in your craftbukkit/plugins/ folder. Please note that while a lot of plugins will automatically generate a folder to go along with it, Denizen does not, and this should be either created by hand and populated, or generated by copying the [[Denizen/Start-up Kit|Start-up Kit]] with sample .yml configuration files and scripts.
</div>


==== config.yml ====
=== Down and dirty ===
<div style="margin-right:2.0em; padding:10px; font-family:museo-sans; font-size:110%;">
<div style="margin-right:2.0em; padding:10px; font-family:camingodos-web; font-size:110%;">
The Denizen config.yml contains nodes to alter the stock behavior and look of Denizen. You'll notice that Denizen does not create its own config.yml. Why is this? Denizen stores its entire config inside memory, so it's not necessary to have a copy inside the Denizen folder unless you need to change the defaults. You can use the config.yml to override those defaults. Not having Denizen write to the config.yml itself (as well as scripts files) ensures that upon a <code>/denizen reload</code>, the config.yml, between a save and reload, is never changed when you don't want it to. This also keeps code comments inside the YML files stay intact, exactly the way you left them from last edit allowing you to leave yourself and others detailed notes and ideas.
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/0.7/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.
 


This file can be reloaded from disk to Denizen memory at any time by using <code>/denizen reload</code>. Some changes in the config.yml may require a restart of the server. This includes <code>interact_delay_in_ticks</code>, but is not limited to that config node.
'''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]].
<pre>/npc create Notch --trait denizen</pre>
Note: You could alternatively use <tt>/trait denizen</tt> if working with an existing NPC.


See: [[Denizen/config.yml]] for a stock copy and explanation of all available options.
</div>


==== assignments.yml ====
'''2:''' Create a script for Notch. See also: [[Denizen/0.7/Writing_Scripts|Writing Denizen Scripts]]. <br>
<div style="margin-right:2.0em; padding:10px; font-family:museo-sans; font-size:110%;">
Create a new file in <tt>plugins/Denizen/scripts/</tt> named <tt>Notch Cookies.yml</tt>. 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.
This YML is where you can define all the options and information for your Denizen NPCs. This will be explained further along in this document, but the most common information in this file is [Interact Script Assignments], [Activity Script Schedule], and [Custom Interact Texts].


This file can be reloaded from disk into Denizen memory at any time by using <code>/denizen reload</code>
<pre>
'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?'
</pre>


</div>


===={{color|red|white|saves.yml}}====
'''3:''' Assign notch some scripts. See also: [[Denizen/0.7/Assigning_Scripts|Assigning Denizen Scripts]]. <br>
<div style="margin-right:2.0em; padding:10px; font-family:museo-sans; font-size:110%;">
Open your assignments.yml. If none exists, create it in your <tt>/plugins/Denizen</tt> folder. Insert the following into your YML file. If <tt>Denizens:</tt> is not at the top of this document, create it.
This file is not meant to be edited by hand, Denizen will create and populate this file automatically as needed. It stores important information such as player progression, flags, Denizen location and block bookmarks, active activity script progression and more. If you absolutely need to make changes by hand, it's best to stop the server, edit, and then restart your server, as this file is constantly being written to by Denizen which will overwrite any changes you make.


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.
<pre>
</div>
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.
</pre>


===={{color|red|white|read-only-scripts.yml}}====
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.
<div style="margin-right:2.0em; padding:10px; font-family:museo-sans; font-size:110%;">
This is another files that Denizen creates and should not be edited by hand. This is a combination of the files contained in the scripts folder that Denizen reads from.


This file is populated on a server restart, or by using the <code>/denizen reload</code> command.
</div>


==== /scripts/ folder ====
'''4:''' Reload Denizen. See also: [[Denizen/0.7/In_Game_Commands#Denizen_Reload|Denizen Reload]]. <br>
<div style="margin-right:2.0em; padding:10px; font-family:museo-sans; font-size:110%;">
This will ensure that the information has taken. First, in the console or your minecraft client, type <tt>/denizen reload</tt>. 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 [[Denizen/0.7/Troubleshooting|Troubleshooting]].
This folder is where Denizen will read all the script information from. Upon a server load or <code>/denizen reload</code>, 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 <code>.yml</code>. 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 <code>read-only-scripts.yml</code>, so there will be an issue if two scripts are named the same.


</div>
'''5:''' Check Denizen NPC status. See also: [[Denizen/0.7/In_Game_Commands#Info-Click|Info-Click]]. <br>
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 <tt>Notch Cookies</tt>.


==How it works==
Denizen is an extension of Citizens 2.0 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 [[Commands|Citizens commands]]. Scripts are assigned in the assignments.yml file mentioned above. The scripts themselves can be placed in any file in the /scripts/ folder.


There are 2 major types of script:
'''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.
*Interact Scripts - these scripts run commands when a player interacts with a Denizen in some way. Different commands can be run based on player and world conditions.
*Activity Scripts - these scripts give the Denizen continuous jobs or activities to make them feel more alive.


It is highly suggested you start with the [[Denizen/Start-up kit|Start-up Kit]]. This contains some scripts and a pre-configured assignments.yml. Place the provided files in the locations mentioned above, and start up your server.


*The first thing to do is make a NPC by using the [[Commands|/npc commands]].  
''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 [[Denizen/0.7/In_Game_Commands|In Game Commands]] for more info.
*Name your NPC something that matches an assignment in the assignments.yml.
*Next assign the 'denizen' trait using the /trait command.
*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 for performance reasons. See [[Denizen/In_Game_Commands]] for more info.
Ready to dive deeper? start with either [[Denizen/0.7/Interact_Scripts]] or [[Denizen/0.7/Activity_Scripts]]
</div>
</div>


Ready to dive deeper? start with either [[Denizen/Interact_Scripts]] or [[Denizen/Activity_Scripts]]
[[Category:Denizen 0.7]]</s>

Latest revision as of 16:10, 24 March 2020

For more up-to-date information and full details on specific features (individual commands or tags, for example), check the Meta Documentation.

If you want a full tutorial to help get you set up, check out the Tutorial Videos on youtube or the Beginner's Guide text website.

If you need quick help, visit our Discord group.




This wiki is outdated, please view the tutorial videos/guide, meta documentation, or Discord group (all linked above) for up-to-date information!


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/0.7/Interact_Scripts or Denizen/0.7/Activity_Scripts