# +---------------- # | Helpful Citizen .. configurable and easy to use 'helpful citizens'! # | Version 1.0 by aufdemrand # | see: Helpful Citizens for Denizen on youtube helpful citizen configuration: type: task debug: false # Copy this node and its contents to make a new # configuration. Use the NPC constant 'configuration' # to select which node to use. Mind the spacing! # Below is an example of the four types of 'helpful citizens' # that you can utilize. default giver: # Givers give a random item every once in awhile, as customized below. type: giver # Just define the item, and a simple phrase for the giver to say! items: - i@shirt off back/Here, take this shirt off my back. - i@feather/I found this feather, please have it! - i@ladder[quantity=2]/This may come in handy! # ...and a cooldown... cooldown: 23h # ...and some random cooldown text. cooldown text: - "You look good today!" - "I'm always on the lookout for loot." - "Nice seeing you, <player.name>!" - "I look for treasure during the <t[<player.world.time.period.is[==].to[night]>]:night time! || day time!>" default teller: # Tellers are kind of like givers, but they give advice instead. type: teller # Simply specify advice... advice: - "Use 'tab' to autocomplete a username!" - "A stick and two stone make a simple stone sword!" - "The secret word is 'please'." # ...and of course, a cooldown... cooldown: 10s # ...and what to say on cooldown! cooldown text: - "I'm all out of advice for now!" - "I always keep my ears open for some good advice!" default healer: # Healers do just that -- heal a player upon interaction. type: healer # You must give the healer a condition. Use 'true' to make # the healer heal all the time. condition: <player.health.is[less].than[10]> # Specify possible heal amounts, and a simple phrase for # the healer to say upon that selection. heal: - <player.health.max>/I was able to help! - 5/I did what I could! - 0/I seem to be all out of mana! # Condition not met? The healer will use these phrases. healthy text: - "You're doing fine, lad!" # Finally, set a cooldown... cooldown: 10s # ...and some cooldown text! cooldown text: - "You're young and healthy. Much respect!" - "Keep up the good work!" - "Battle bruises can easily be healed!" - "It's a hard job, but someone has to do it!" default magician: # Magicians can be really powerful! type: magician # First, define some spells, and a simple phrase for when # the spell is used. spells: - teleportation/You've been teleported somewhere unknown! - invisible/You're now invisible! - show/I love magic! # And define a small script for each spell... teleportation: - teleport <player> <player.location.find.surface_blocks[grass|gravel|dirt|mycel|stone].within[25].random.as_location.add[0,1,0]> invisible: - cast invisibility <player> duration:1m show: - look <npc.eye_location.add[0,5,0]> - firework # Lastly, specify a cooldown... cooldown: 10s # ...and some cooldown text! cooldown text: - "I'm on cooldown!" - "There's only so much magic to go around!" - "I need rest." my teller: # Tellers are kind of like givers, but they give advice instead. type: teller # Simply specify advice... advice: - "Hello!" - "Hi!" # ...and of course, a cooldown... cooldown: 10s # ...and what to say on cooldown! cooldown text: - "See ya!" # --------- # Copy/paste your custom configurations in this spot below! Mind the spacing! # --------- # | /// START HANDLERS /// # | No need to change anything below, unless you want to change the functionality of this script # | which is, of course, encouraged and applauded! If not, there's a ton of functionality to mess # | with above by making new configurations! # Small example of a custom item. The default giver configuration uses # this to give away. shirt off back: type: item debug: false material: m@leather_chestplate color: c@blue display name: the shirt off his back lore: - "<tern[<npc.name.is[!==].to[null]>]:'<npc.name>' || Someone><reset><white> once gave you" - <white>>the shirt off his back. - <white>his is that shirt. # The main script for the NPC in the form of an assignment script. Helpful Citizen: type: assignment debug: false default constants: configuration: default teller actions: on unavailable: - narrate 'You tap <npc.name> on the shoulder.' on click: - engage duration:3s - look <npc> <player.eye_location> - define type '<proc[helpful citizen helper].context[type]>' # # Check type of citizen: # ----> GIVER - if '%type%' == 'giver' { - if !<player.flag[helpful_<npc.constant[configuration]>_<npc.id>_cooldown]> { - define items '<proc[helpful citizen helper].context[items]>' - flag <npc> helpful_citizen_items:! - flag <npc> helpful_citizen_items:|:%items% - define item <npc.flag[helpful_citizen_items].as_list.random.split[/].get[1]> - chat '<el@val[%items%].split[/].get[2]>' - animate <npc> arm_swing - give '%item%' - narrate '<yellow>[!]<blue> You have recieved <%item%.qty> "<t[<%item%.has_display>]:<%item%.display> || <%item%.material.name>>"!' - flag <player> helpful_<npc.constant[configuration]>_<npc.id>_cooldown:true 'duration:<proc[helpful citizen helper].context[cooldown] || 5s>' } else { - chat '<proc[helpful citizen helper].context[cooldown text]>' } - queue clear } # ----> TELLER - if '%type%' == 'teller' { - if !<player.flag[helpful_<npc.constant[configuration]>_<npc.id>_cooldown]> { - define advice '<proc[helpful citizen helper].context[advice]>' - chat '%advice%' - flag <player> helpful_<npc.constant[configuration]>_<npc.id>_cooldown:true 'duration:<proc[helpful citizen helper].context[cooldown] || 5s>' } else { - chat '<proc[helpful citizen helper].context[cooldown text]>' } - queue clear } # ----> HEALER - if '%type%' == 'healer' { - if !<player.flag[helpful_<npc.constant[configuration]>_<npc.id>_cooldown]> { - if '<proc[helpful citizen helper].context[condition]>' == 'true' { - define pair '<proc[helpful citizen helper].context[heal]>' - define value '<el@val[%pair%].split[/].get[1]>' - chat '<el@val[%pair%].split[/].get[2]>' - animate <npc> arm_swing - playeffect ender_signal qty:10 <npc.eye_location.add[0,-1,0]> - heal <player> %value% - narrate '<yellow>[!]<blue> You have recieved %value% HPs!' - flag <player> helpful_<npc.constant[configuration]>_<npc.id>_cooldown:true 'duration:<proc[helpful citizen helper].context[cooldown] || 5s>' } else { - chat '<proc[helpful citizen helper].context[healthy text]>' } } else { - chat '<proc[helpful citizen helper].context[cooldown text]>' } - queue clear } # ----> MAGICIAN - if '%type%' == 'magician' { - if !<player.flag[helpful_<npc.constant[configuration]>_<npc.id>_cooldown]> { - define pair '<proc[helpful citizen helper].context[spells]>' - define script '<npc.constant[configuration]>.<el@val[%pair%].split[/].get[1]>' - animate <npc> arm_swing - run instantly 's@helpful citizen configuration' p:%script% - chat '<el@val[%pair%].split[/].get[2]>' - flag <player> helpful_<npc.constant[configuration]>_<npc.id>_cooldown:true 'duration:<proc[helpful citizen helper].context[cooldown] || 5s>' } else { - chat '<proc[helpful citizen helper].context[cooldown text]>' } - queue clear } - if <player.is_op> narrate 'I need a configuration!' else look <player.eye_location> # This set of helper scripts fetches information from the configurations. Helpful Citizen Helper: type: procedure definitions: node debug: false script: - flag <npc> nodes:! - flag <npc> 'nodes:|:<s@helpful citizen configuration.constant[<npc.constant[configuration]>.%node%]>' - if <npc.flag[nodes]> != null determine <npc.flag[nodes].as_list.random> else determine 'You take a look at <npc.name>.'
And the video link for the search impaired: http://youtu.be/KzaMEiM5DGk