# Kill the Bats # Citizens 2 (build #1045) # Denizen 0.9.3 (build #1417) # # This will ask the player to kill a few bats and will reward them for doing so. # # It uses the "listen" command to determine whether the player has killed # any bats, but unfortunately doesn't allow control over WHERE the bats have been killed. # # The quest repeat timeout constant value below will control how often the # player can repeat the quest. It's on 24 hours currently. # # NOTE: This requires an economy to deal with 'money' as a method of reward. # # @author mythanical # @script version 1.0.3 # @last-updated 12 January 2014 # @irc EsperNet IRC Network #denizen-dev # @Minecraft Server - minecraft.geek.nz # @Donate Bitcoin: 1Fzacc2gZ5NGRMXg5jWP6NcUkWei34xjzt # @Donate Litecoin: LhsaGa1QzmVLjMYwg4ZPTVnmSgnBDGc75U "Bat Killer": type: assignment default constants: # Number of bats that must be killed for quest to be completed BatsQty: 3 # The reward (money) for killing the bats RewardAmount: 300 # The time in between each repeat of the quest (currently set at 24 hours) Quest Repeat Timeout: 86400 # Reset all quest progress (this is in case quest gets stuck or if the 'kill listener' stops 'listening' Quest Reset Timeout: 86400 # Name of your town, used in some dialog options. Townname: 'Arrowin' interact scripts: - 10 Killing the Bats actions: on assignment: - trigger name:chat toggle:true - trigger name:click toggle:true - trigger name:proximity toggle:true - trigger name:damage toggle:true # Make the NPC so they can be killed by the player. They will respawn a few seconds later. - execute as_npc "npc sel <npc.id>" - execute as_npc "npc vulnerable" # When a player kills the NPC, narrate something. On my server, I run another script instead that # changes the alignment of the player for commiting such a heinous act. on death by player: - narrate "<red>You have killed <yellow><npc.name><red>. Are you pleased with yourself?" "Killing the Bats": type: interact steps: 1: proximity trigger: entry: script: # On player entering proximity range, run a script (located further down). - run "Batkiller Check Requirements" click trigger: script: # On clicking, run a slightly different script to check requirements before starting quest. - run "Batkiller Quest Requirement" damage trigger: script: # When you hit the NPC, it will run the script called Batkiller Warning (further below). - run "Batkiller Warning" 2: chat trigger: 'Start Questline': Trigger: /Yes/, I am interested. I'll start now. script: # If the player answer 'yes', this will set the quest flag to started and also start 'listening' for the player # killing bats and once the player killed the number of bats specified at the top of the script, it will run # the 'Batkiller Quest Completed' script. - engage - flag <player> BatKiller:Started "duration:<npc.constant[Quest Reset Timeout]>" - listen kill "id:Batkiller Listener" type:entity qty:<npc.constant[BatsQty]> target:bat "script:Batkiller Quest Completed" - chat "<yellow>Great! come back to me once you've killed <red><npc.constant[BatsQty]><yellow> bats." - narrate "<red> Exterminate Bats - Quest Started" - disengage 'Deny Questline': Trigger: /No/, I am not interested. script: # If the player says 'no', then display one of the following 3 messages and put them back at Step 1 for 'Killing # the Bats' script. - random { - chat "<yellow>Oh ok, don't come crying to me if the noise these bast..I mean bats make wake you up at night." - chat "<yellow>That is really unfortunate, but OK. Come back to me when you change your mind." - chat "<yellow>It would've been a great help if you could get rid of these plagued bats. Please come back later." } - zap step:1 proximity trigger: exit: script: # If they exit the proximity trigger for the NPC, put them back at Step 1 so they get presented with the # relevant options when they come back later. - zap step:1 click trigger: script: # This is simply to present the options again if the player accidentally clicks the NPC, rather than type a response. - run "Batkiller Quest Requirement" damage trigger: script: - run "Batkiller Warning" "Batkiller Check Requirements": type: task script: # The following options exist here # 1) If the player is holding a sword in their hand, the NPC will run the 'Deny Interaction' script until the player put # their weapon away. # 2) The next if statement checks to see if the quest has been flagged as 'Started', if so tell them to come back when all the bats # have been killed. # 3) Otherwise if the flag is set to 'ClaimReward', tell the player to come get the reward. # 4) Lastly, if none of the 'if' statements are met, simply present them with the general chat dialog. - if 267|268|272|276 contains <player.item_in_hand.id> run "Deny Interaction" else if <player.flag[BatKiller]> == Started chat "<yellow>Hi <white><player.name><yellow>, please come back to me when you've killed all <red><npc.constant[BatsQty]><yellow> bats!" else if <player.flag[BatKiller]> == ClaimReward chat "<white><player.name><yellow>, come over here! Come get your <gold>reward<yellow> for killing those pesky bats!" else if <player.flag[BatKiller]> == Claimed chat "<yellow>Thanks for your help <white><player.name><yellow>, please come back later to help me again." else run "Batkiller General Chat" "Batkiller General Chat": type: task script: # These are the general chats that come up when the player walks into proximity range. - ^random { - chat "<yellow>And then he said 'She ate the rat!'. Hahahaha.. oh, sorry. Didn't see you there <white><player.name><yellow>." - chat "<yellow>These sewers.. they get to you. Voices, chills..there are more than bats down here." - chat "<yellow>Some days I hate my job, but then I say 'No <white><npc.name><yellow>, you love your job' and then I love it again." - chat "<yellow>Rats, bats, cats and giant gnats. I kill them all.. it's great because I get paid to hunt for my own food!" - chat "<yellow>The smell in these sewers will get into your clothes. Remember to put your clothes in a bucket of water for 3 days, then wash it with soap." - chat "<yellow>Stay down here long enough, the sewers grow on you. Much like the moss on these bricks.." - chat "<yellow>Another day in the sewers..or night, I don't know anymore. Are you here to help?" } "Batkiller Warning": type: task script: # When you hit (damage) the NPC, they will respond with one of the following lines. - ^random { - chat "<red>Oucch! <yellow>Why would you do that? If I die, you WILL regret it!" - chat "<red>Aaarrggg! <yellow>What did I ever do to you? Don't hit me again!" - chat "<red>Wha..why are you hurting me? <yellow>Oh, these cuts..they hurt so much." - chat "<red>Please don't hurt me! <yellow>I have never done anything bad to you!" - chat "<red>Owwee! <yellow>Don't do something now that you will regret later.." } "Deny Interaction": type: task script: # If the player has a weapon, the NPC will say one of the following things. - ^random { - chat "<yellow>Oh, why do you come to me armed? Please put away your weapon first." - chat "<yellow>Is that a..weapon in your hand? Please don't hurt me! You might regret it." - chat "<white><npc.constant[Townname]><yellow> is a friendly town, please put your weapon away!" - chat "<yellow>It's courtesy to put your weapon away while talking to people in <white><npc.constant[Townname]><yellow>." - chat "<yellow>Why is a weapon necessary here? Are we engaging in some kind of fight?" } "Batkiller Quest Requirement": type: task script: # This part is for when the player clicks the NPC. The options that exist are the same as the # check requirements above except this time if the BatKiller flag is on 'ClaimReward', it will run the 'Batkiller Quest # Completed Reward' script further below. - if 267|268|272|276 contains <player.item_in_hand.id> run "Deny Interaction" else if <player.flag[BatKiller]> == Started chat "<yellow>Hi <white><player.name><yellow>, please come back to me when you've killed all <red><npc.constant[BatsQty]><yellow> bats!" else if <player.flag[BatKiller]> == Claimed chat "<yellow>Thanks for your help <white><player.name><yellow>, please come back in <red><player.flag[BatKiller].expiration.formatted><yellow> to help me again." else if <player.flag[BatKiller]> == ClaimReward run "Batkiller Quest Completed Reward" else run "Batkiller Present Quest" "Batkiller Present Quest": type: task script: # This part presents the player with the quest, giving them some details via random dialog options # and then asks them to answer 'yes' or 'no' before 'zapping' them to Step 2 in the script 'Killing the Bats' # where it's waiting for the player to type something. - random { - chat "<yellow>Hello there <white><player.name><yellow>! Can you please help me get rid of these darn bats?" - chat "<yellow>Oh hey <white><player.name><yellow>, there are some nasty bats in these sewers. Will you go kill some for me?" - chat "<yellow>Bats... bats everywhere! Their squeaky high-pitched noises driving me nuts. Kill some for me?" - chat "<yellow>These bats carry the plague! We need to exterminate them. Will you help me?" - chat "<yellow>Feel like slicing and dicing some bats? Grab yourself a sword and pretend you are a fruit ninja!" } - random { - chat "<yellow>I will pay you <gold><npc.constant[RewardAmount]><yellow> <player.money.currency> if you kill <red><npc.constant[BatsQty]><yellow> bats for me." - chat "<yellow>How does <gold><npc.constant[RewardAmount]><yellow> <player.money.currency> for <red><npc.constant[BatsQty]><yellow> bats sound to you?" - chat "<yellow>The reward for killing <red><npc.constant[BatsQty]><yellow> bats is <gold><npc.constant[RewardAmount]><yellow> <player.money.currency>. Interested?" } - narrate "<red>Say<&co>" - ^narrate " <blue>Yes<blue> <gray>or<red> No" - ^zap "s@Killing the Bats" step:2 "Batkiller Quest Completed": type: task script: # When the 'listen' command detects the necessary quantity of bats killed, it will run this scripts and also # update the flag to 'ClaimReward' which the NPC will check to decide if the user should be rewarded. - narrate "<red>Exterminate Bats - Quest Completed. Return to <aqua><npc.name><red> to claim your reward." - ^flag <player> BatKiller:ClaimReward "Batkiller Quest Completed Reward": type: task script: # This is the part where the flag expiry duration is determined from the constant value you set at the top of the script. After that # time, the flag expires and the quest can be done again. In this section the player is also rewarded (money) by the quantity specified # above. - ^flag <player> BatKiller:Claimed "duration:<npc.constant[Quest Repeat Timeout]>" - random { - chat "<yellow>Haha, good job <white><player.name><yellow>, you got those bats good! You can come back and help me again tomorrow." - chat "<yellow>Well done <white><player.name><yellow>, that will teach those pesky bats! You can come back and help me again tomorrow." - chat "<yellow>Fantastic <white><player.name><yellow>, but they will be back again tomorrow. Please come help me again and I'll pay you for the service." } - ^give money qty:<npc.constant[RewardAmount]> - ^narrate "<red><npc.name> pays you <gold><npc.constant[RewardAmount]><red> <player.money.currency>."
Your scripts are awesome, I love all of the included stuff! However, Quest Repeat Timeout needs to be changed to QuestRepeatTimeout, or else it will just keep giving you the reward script. Here's a copy with changes: http://pastebin.com/WkFBYp2n
Sorry, apologies for that! Instead of changing the the name I simply had to add quotes. Thank you
this looks great but I cant get it to work, the quest begins ok but does not count the bats killed, or zombies as I have changed it to zombies.
I tried again without changing anything and its still not counting bats killed. Any idea what could be causing this?
Having the same issue as the person above sadly. It's not registering when i kill the bats :/
Hi guys! Yes, there are currently issues with Listeners in Denizen. The devs know about it, just need some time to fix it up. I have logged a job for item (craft) listeners not working, but there are about 3 other listener types that aren't working either. https://github.com/aufdemrand/Denizen/issues/325
Kill listeners should now be working again! Please let me know if there are still any problems.
because im using 2 listeners im tring to create a quest stage check that check for 2 flags in one line but i cant seem to get it to work am i doing somwthing wrong? "slayer quest stage check": type: task script: - if "
whoops seems the tags did not paste in my bad here is a paste bin http://pastebin.com/481GrsMp
I'm not sure but I think the listeners are not working again? Here's my tweaked version of the script (modded for zombies) if anyone wants to look over my changes... http://pastebin.com/M26rFFc6
Found the listener actually is working after reviewing the server logs My question now is, how do I modify the script so that the player receives feedback as they kill their target?
this is the script of yours im canablizing for my privet 5 player server the bat killer kill quest in trying to change reward type to give the player 400xp any idea what that command line would be? changed qty of bats to 10 changed all chat lines from npc to a more interesting story about vampire bat killing her family... anyway im trying to give the player 400 XP but cant figure out the command line to do that any help would be greatly appreciated.