Denizen

Meta Documentation | Issue Tracker | New Script Repository | Old Script Repository | Tutorial Videos | Forums
Development builds of this project can be acquired at the provided continuous integration server. These builds have not been approved by the BukkitDev staff. Use them at your own risk.
Denizen uses a pasting service provided by its developers to enable recording of debug sessions. This allows an easy and universal way to troubleshoot a script. It is only used on '/denizen submit', however this service is not endorsed by the BukkitDev staff. Use it at your own risk.
HEY!
This project is moved!
Please download from:
https://www.spigotmc.org/resources/denizen.21039/
View resources at:
This Bukkit page won't be updated much!
About
Hey there! Thanks for using Denizen for Bukkit and Citizens2. Looking for a quick starting guide? Here's the place!
So, what is Denizen? It's is best classified as a scripting platform. Denizen for Bukkit and Citizens2 utilizes the scripting, and various other components provided by DenizenAPI. The scripting component of Denizen features easy to use script containers, replaceable tags, commands, and a queue system. Built aside is a slew of components that deal with many kinds of event handlers, many additional NPC features, a fully-featured variable system (we call them 'flags'), and a rich object-oriented set of features. I encourage users to start small when first getting into Denizen, but rest assured there are tons of features to explore.
Denizen NPCs? Yep, that's right. Denizen is probably best known as a way to create scripted Citizen NPCs. In fact, this whole project started out as an extension to Citizens2. You can use it to make interactive NPCs with the use of Assignment Scripts and Interact Scripts. This is pretty easy to do, and there's a bunch of cool NPC specific (among many other) commands and tags that you can utilize as well.
Here's a small example I call 'cookies'. I normally like to comment my scripts, but this one below is presented without any as to show the flow.
Cookies: type: assignment interact scripts: - 100 Cookie Handler Cookie Handler: type: interact steps: 'Spreading the Word*': click trigger: script: - random 3 - chat 'I like cookies!' - chat 'MMmm.. cookies are favorite!' - chat 'Cocoa and wheat me freak!' chat trigger: 'Cookies': trigger: 'I love /cookie/s!' script: - chat 'Me too!' - narrate '<npc.name> gives you some cookies.' - give i@cookie qty:6 - zap 'step:Cookies given' 'Cookies given': click trigger: script: - chat 'How were the cookies?' - zap 'step:Spreading the Word'
It's a simple 2-step, multi-trigger script that creates a cookie loving NPC. For some reason I think it's funny to name the NPC 'Notch'. Making a NPC use this script couldn't be easier, either. Simply use a bukkit command while having the NPC selected. It looks like this:
/npc assignment --set cookies
Now clicking on your NPC will use Denizen Triggers to activate the script above. An instant Denizen NPC! Cookies is funny, but hardly useful, and it's my personal philosophy that NPCs should be useful. How 'bout a simple healer? This NPC will heal you, but only when you're seriously injured.
Basic Healer: type: assignment interact scripts: - 100 heal me, bro! Heal me, bro!: type: interact steps: "Need a heal?*": click trigger: script: - if '<player.health>' < '<m:<player.health.max> / 2>' { - look <player.location> - chat 'Woah dude, you are <player.health.formatted>! You could use a heal!' - chat 'Just give me another click to get some power!' - zap "Healin'" duration:30s } else { - look <player.location> - chat 'Nice an healthy. Keep it up!' } "Healin'": click trigger: script: - ^zap 'need a heal?' - ^engage - chat "Here goes nothin'!" - playeffect instant_spell <npc.location> qty:25 - playeffect heart <player.location> qty:25 offset:1 - heal <player> - disengage
How do you make a Healer NPC with this script? You guess it! Just select that NPC, and type:
/npc assignment --set 'basic healer'
It's not just for NPCs. I guess I already told you that, but Denizen has some other script types that open up possibilities that extend far beyond it's core functionality of utilizing NPCs. One of my favorite 'simple scripts' that I like to show people is one that my friend Blankiito showed me. The one below is slightly modified, but basically it enables a 'rogue-like feature' that makes a player invisible when sneaking. It's a simple concept, but perfectly illustrates the flow of a Denizen Script.
Rogue: type: world debug: false events: on player starts sneaking: - playeffect <p.location> magic_crit qty:10 - invisible <player> state:true on player stops sneaking: - invisible <player> state:false
Even small scripts can be incredibly useful for your server. Sometimes scripts can replace entire bukkit plugins, and since the 'code' is in Denizen Script, the end result is often times more flexible to you, the server operator. Have a plugin that run some commands every once in awhile? Replace it with a simple Denizen script.
Auto Save Event Handler: type: world debug: false events: on 5:00 in world: - announce 'Autosaving...' - execute as_server 'denizen save' - execute as_server 'citizens save' - execute as_server 'save-all'
Use Denizen to solve problems, or to make features easier to use. Example: If you're familiar with Citizens, you may have realized that WorldGuard's /butcher command is not friendly to mob-type NPCs. It removes them, too, which can be a pain! Why not write your own /butcher command?
Safer Butcher Handler: type: world debug: false events: on sbutcher command: - narrate 'Removing all mob entities within 15 blocks... your NPCs are safe!' - foreach <player.location.find.entities.within[15]> { - if <%value%.is_mob> remove %value% }
Denizen Quests are the best quests. If you're like me, this whole thing started by using the Quester for Citizens1. It featured a fairly simple questing structure to implement things like 'kill quests' and 'collection quests'. When Citizens went to version 2, that functionality was no longer 'core', but no worries Denizen can help! By utilizing Denizen's Player Listeners, simple questing can be done easily, and it's more robust because you can use all the other features implemented by Denizen, too!
So, how do you best get started? This is a question we get all the time. Because of the enormous amount of ways to use and customize Denizen, we suggest that you simply START SMALL! Checking out the videos, scripts, and articles on denizen-docs you're sure to find a comfortable place to start. While scripting, utilize the tools provided, such as the SublimeText2 grammar pack, and the reference and search for meta lookup on this site.
Like any programming language, there is a learning curve with code structure and syntax that will only be overcome by trial and error. While using some user-made scripts can be as easy as dragging-and-dropping, many scripts will likely require at least a basic understanding of the denizen-script structure to fully utilize their features. But don't worry! Denizen is purposefully made to be easy to read and easy to customize! Tags, commands and events are all very verbose, easy to follow. With a little bit of research we know you'll soon be drunken with power, just like us!
Videos
Other useful links
- Denizen Handbook (Outdated kind of, but has some useful information still.)
- User-made beginner's guide
- Citizens2 Wiki
-
View User Profile
-
Send Message
Posted Mar 9, 2013@DagumBoss
Can you give me a link to there IRC thing?
-
View User Profile
-
Send Message
Posted Mar 8, 2013This page is completely out of date. You'd better go to their IRC and get the right resources before writing all the scripts like I did.
-
View User Profile
-
Send Message
Posted Mar 8, 2013@humzaf
Again thanks for the advice but for some reason i'm still getting this error every time i assign a script on the console:
http:pastebin.com/b3as5xV4
-
View User Profile
-
Send Message
Posted Mar 8, 2013@lasdoug0910
Should be
Course I get an entirely different error on clicking him that's worldedit's problem, but that's another story.
-
View User Profile
-
Send Message
Posted Mar 7, 2013@Regalia @humzaf
Thanks for your advice, but what do you mean by keepin the quotation marks around "Fight Assignment?" Is this when I'm assigning the script to a citizen ingame?
When I assign it without the quotation marks, it says that it cannot find the script, and asks me to check if the script was loaded correctly. If I use quotation marks, it brings up that error. Any idea why?
Oh, and are all parts of the script still functioning in 0.88? Ad in, have they taken off any triggers or commands that I used I the script? Thanks a lot :)
-
View User Profile
-
Send Message
Posted Mar 7, 2013@humzaf
Whoops, you're right. The 'np' got snipped off the link Correct link
-
View User Profile
-
Send Message
Posted Mar 7, 2013@RegaIia
Thanks for all the advice and btw there isn't anything on the example you gave me.
-
View User Profile
-
Send Message
Posted Mar 7, 2013@humzaf
Your first two - chat lines are a space in too far. You need an additional You can't use semicolons in the speech, or at least I've not found a workaround that allows it. Your script is also devoid of any zaps, so there's nothing telling it to go from one step to the next.
One of the larger differences between .76 and .8 versions is that denizens are no longer their own trait. They're citizens that you assign a custom assignment to that reads denizen scripts. Take a look at the example here for a good example on how to set up the assignment.
@lasdoug0910 If you're getting that on assignment, make sure you're still putting the quotation marks around "Fight Assignment"
Still waiting on news for the sentry triggers...Would really like to keep working with this, but I've sadly hit a standstill until I can reuse these triggers
-
View User Profile
-
Send Message
Posted Mar 7, 2013@humzaf
Can anyone help?
-
View User Profile
-
Send Message
Posted Mar 6, 2013Hi, I'm using the 0.88 prerelease version of Denizen, and for some reason, everytime I try to run my script:
http://pastebin.com/5Ez9FSKB
I get this error on the console:
http://pastebin.com/rXPStbCy
If anyone can help it would be much appreciated :) Thanks!
-
View User Profile
-
Send Message
Posted Mar 6, 2013Yo, any way to get just ONE line of text in the book text function? <P> does two lines, and I can't seem to find the singular version.. there's little to no documentation of this, and my efforts scouring the source code (do note I don't even know java!) resulted in failure.
EDIT: Found it! It's <n>! And I found it sourcecode scouring, haha. I was just looking in the wrong places, it was in the Scribe event, not the Text Replacement Area Thing.
-
View User Profile
-
Send Message
Posted Mar 6, 2013@RegaIia
This is the Script i'm working on:
http:pastebin.com/3w004gqd
If i should change or add anything please let me know.
-
View User Profile
-
Send Message
Posted Mar 5, 2013@humzaf The scripts from .76 to .8+ differ. If you're still using the old scripts, they won't work without a small bit of reconfiguring. A link to the only real documentation is posted above.
Again, reposting my question since it seems to have fallen down pretty far at this point. Sorry for the duplicate.
Is there any fix towards making the Npcdeath triggers register in the scripts again? It does show that they should register with the dev builds, but unless the formatting has changed all I'm seeing is it not running and Sentry's page saying they do not work with .8 until it updates.
-
View User Profile
-
Send Message
Posted Mar 5, 2013I also can't get Denizen to load.
-
View User Profile
-
Send Message
Posted Mar 5, 2013@dirbrian
When is someone going to help us? I haven't seen any helping going on for days.
Please someone HELP!!!!!!
-
View User Profile
-
Send Message
Posted Mar 4, 2013Not working for me either. neither is it showing up on my server but its not duplicating the config files or folder from the denizen.jar
unfortuantely Quests plugin isn't working either, only other plugin i can find thats similar is MineQuest
-
View User Profile
-
Send Message
Posted Mar 4, 2013@humzaf
I fixed it by getting the v0.88 build on denizen but now i have a new problem.
I made a script and when i try to set it onto an NPC this shows up on the console happens: http:pastebin.com/b3as5xV4
I hope you can help, Please and thank you, oh and if you need info like how does the script look like and stuff to help me you can just ask me here
-
View User Profile
-
Send Message
Posted Mar 4, 2013So randomly, with me making absolutely no changes to any of the files or scripts, every denizen on my server stopped working. Those with the click trigger just respond with "I have nothing else for you right now", and those with death triggers etc, just fail to run their scripts, essentially breaking a central server mechanic. I've tried updating to the latest Citizens, upon which Denizen breaks entirely, and I've tried every BukkitDev version of Denizen. The thing I find odd is that it happened with me making absolutely no changes, no reload, just working one second and not the next.
-
View User Profile
-
Send Message
Posted Mar 3, 2013Hi everyone, i am using Denizen version: B: Denizen 0.7.6-FINAL for CB 1.4.7-R0.1 Jan 23, 2013
I am getting this error and i am hoping you guys can tell me how to fix it, i used pastebin so i won't pile it into your comments:
http:pastebin.com/QgNiBm9Z
-
View User Profile
-
Send Message
Posted Mar 2, 2013How can other plugins commands be run with citizens2/denizen npcs?