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 Dec 1, 2014Thank you very much for this plugin! I made bunch of events, quests, logic challenges,items only by Denizen. Everything is possible with it!
-
View User Profile
-
Send Message
Posted Dec 1, 2014ahah MrRetrus you are not good in scripting (yes my english is very very bad...) My server version is 1.7.10 craftbukkit and all works perfectly ! (except of course SPAWN command... but I think that the command does not work because she not recognize...)
Thx McMonkey for yours answers, i will test this syntax tonight :)
(Yours videos are very very good ! thx for job !)
-
View User Profile
-
Send Message
Posted Nov 29, 2014I PM'ed you the link to the jar I use. Thanks!
-
View User Profile
-
Send Message
Posted Nov 29, 2014@BSidiocy
- repeat 2 { - spawn ghast <player.location> }
Also please check our modern scripting videos http://mcmonkey.org/denizen/vids thats a really outdated-looking script. Requirements, listeners,... lots of stuff we don't advocate using anymore.
-
View User Profile
-
Send Message
Posted Nov 29, 2014Hi .. Thanks for the reply.. anyway here's another one
Is this right? I tried it like this :l
Only 1 ghast is spawning and i want this to be weekly quest
im just following the beginners guide, You know .. not all players are pro at coding nor knowledgeable enough
Please help .. this is so confusing :< Im not a programmer.
-
View User Profile
-
Send Message
Posted Nov 28, 2014@mrretrus
Hm... any chance you can get get me a 1.5.2 CraftBukkit to work with (or cauldron or MCPC or whatever)? Due to the DMCA, I can't quite find one to build against.
-
View User Profile
-
Send Message
Posted Nov 28, 2014Thank you very much. I am actually trying to do some pretty epic hooks with otherdrops, denizens, all the ftb mods themselves, WG custom flags etc to make a full fledged RPG experience on FTB. Basically all I need is the ability to reference (if and where possible) mobs(*entities), biomes, items and blocks by ID and Meta. So that I can check against all mod implemented aspects and hook them into denizens as its my "server brain" that I use to handle the other plugins.
It looks like currently denizen can check enums for blocks and items, but theres issues with that- both not being able to define a subID for something non vanilla and also having it INCLUDE everything defined by the main enum, since forge assigns all ID's an enum of X+ID
For instance copper ore is ID 1475:3, but assigned enum X1475, and so are the other META's in this ID group. Any block with sub meta of 1475 like 1475:1 (Cobalt) or 1475:2(Apatite) will be recognized, which is bad.
Essentially if possible and you are willing, maybe see if its possible to work with wool- Targetting it in a listener by ID and sub meta instead of enum string? so for sure 35:1 would work but not 35:2
Thanks in advance :) Anything I can do to help if fine, Im always looking for ways to expand the versatility of plugins that I think are amazing (This one takes the cake obviously ;)
-
View User Profile
-
Send Message
Posted Nov 28, 2014@mrretrus
Oh god, I got nothing for you. Denizen is in beta, and was in /early beta/ back then... we didn't even have world scripts. I don't know that Denizen even *can* do what you're asking in that version... eck. Sorry.
If you want, I could see about compiling a special build for you.
@BSidiocy
- teleport <player> l@0,65,0,world
change the location to whatever the actual location of spawn is. Or, set it to a notable via l@notablename OR set it to an anchor via <npc.anchor[anchorname]>
-
View User Profile
-
Send Message
Posted Nov 28, 2014Hi .. can someone give me a sample teleport script? I want the player who talked to my npc to Teleport in to the place i want.. i tried - Teleport <player> <location:Spawn>
It doesn't work.. I've been trying different codes since the last 3 days .. I still doesn't know how..
Can someone help me? Im still abit confused about the scripts
I can make them talk but all the action scripts .. idk ..
Here's the code:
Please help ASAP!
-
View User Profile
-
Send Message
Posted Nov 26, 2014well I tried copying exactly what you have
http://pastebin.com/V5iFFEyn
This doesnt work right off the hop, no console errors it just doesnt say anything when I break any block. I am using an older version of denizen since its on a FTB server (1.5.2) using denizen-0.8.9-PRERELEASE
Would the layout be different in this version?
-
View User Profile
-
Send Message
Posted Nov 26, 2014@mrretrus
I am 100% certain that http://mcmonkey.org/denizen/vids/Your%20First%20World%20Script covers the block break event. Apply the general quest setup from the zombie kill video, but use the break block event covered in the video above, and compare the broken block to material "<m@35,4>" rather than m@sand. Or, in this case, 35:4 is, in fact, m@yellow_wool, a vanilla item. Assuming your mods don't switch around vanilla item IDs...
-
View User Profile
-
Send Message
Posted Nov 26, 2014I watched both of your videos and block breaking isnt covered. The "kill: zombie" is still referring to an ENUM. SO again- how can I use item meta without an enum- It has to be an ID with a META value. Im not trying to be rude btw im just asking because Ive been searchign for days, and now Im here getting answers that dont apply! "zombie" is not "35:4" whether its world triggered, listener, whatever- It still doesnt apply or answer my question :\
-
View User Profile
-
Send Message
Posted Nov 26, 2014@mrretrus
You start by not using a listener and doing it how I said instead. "Ugggghhh lol you must not be reading my answers"
A listener can't do that, the method I described can.
-
View User Profile
-
Send Message
Posted Nov 26, 2014uggghhhh lol You must not be reading my question- The question is how do I get block break data in a listener with META data. For example I know I can do block: wool, or block: 35
But how do I do block: 35:4?! I cant use names because enums dont apply to mod items only IDs- but some of them require META info. How do I use that in a listener? Putting block:35:4 obviously doesnt work, nor does putting it in parenthesis etc
-
View User Profile
-
Send Message
Posted Nov 26, 2014@speedsnip
An example is - spawn zombie <player.location>
If that's not what you're looking for, you really need to clarify better.
@mrretrus
There are two relevant videos: "Your First World Script" and "Putting It Together: A Kill Quest"
the first teaches you about *World Events* our replacement for listeners, the second shows how to use these word events for a quest to kill 5 zombies, which can easily be adapted to break 20 blocks.
It's a bit more involved than listeners, but gives you a much higher level of control.
-
View User Profile
-
Send Message
Posted Nov 26, 2014Um- Im not sure what Im supposed to be looking for in lieu of using a listener...? There was nothing on that page on making breaking blocks activate denizen tasks or listeners other than the kill listener.
Im trying to make a quest where you have to mine 20 copper ore (FTB) which has a specific ID with sub meta, so using an enum is impossible (It doesnt exist)
So thats why Im asking... how do you make a block break listener that can also have sub meta info?
-
View User Profile
-
Send Message
Posted Nov 26, 2014I know this page.. Can i have an exemple SPAWN action ? (and its not a listener)
- CHAT "... - LISTENER ... (player must kill 10 zombies) - SPAWN ... (normaly spawn any zombies...)
Thx
-
View User Profile
-
Send Message
Posted Nov 25, 2014@mrretrus
/why/ are you using a listener? http://mcmonkey.org/denizen/vids
@speedsnip
http://mcmonkey.org/denizen/cmds/spawn
-
View User Profile
-
Send Message
Posted Nov 25, 2014Can i have explain for commands SPAWN plz ?? how write command ? (exact syntax)
THX
-
View User Profile
-
Send Message
Posted Nov 25, 2014Kind of a specific item, but for listeners is it possible to use meta info? I cant use names since this is FTB. It works with ID's that dont have meta, but something like this doesnt work
- listen block type:break block:1475:3 qty:20 region:QCra1A script:QCra1A
Is there a way to get it to work with ID with a sub meta like how pink wool is 35:6?