Date: 2015/05/19 21:37:59 UTC-07:00
Type: Denizen Script
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
Kill the Bats
# 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 0.9
# @denizen v0.85+
# @last-updated Feb 23 2013
# @irc EsperNet IRC Network #denizen-dev
# @Minecraft Server - minecraft.geek.nz
"Bat Killer":
type: assignment
default constants:
# Number of bats that must be killed for quest to be completed
BatsQty: 10
# The reward (money) for killing the bats
RewardAmount: 10
# 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 if 'kill listener' stops 'listening'
Quest Reset Timeout: 86400
# Name of your town, used in some dialog options.
Townname: 'Spawn'
interact scripts:
- 10 Killing the Bats
actions:
on assignment:
- trigger name:chat toggle:true radius:3
- trigger name:click toggle:true
- trigger name:proximity toggle:false
- 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 "trait health"
- 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).
- runtask "script:Batkiller Check Requirements"
click trigger:
script:
# On clicking, run a slightly different script to check requirements before starting quest.
- ^runtask "script:Batkiller Quest Requirement"
damage trigger:
script:
# When you hit the NPC, it will run the script called Warning (further below).
- ^runtask "script: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 now
- flag player "BatKiller:Started" "duration:<cons:Quest Reset Timeout>"
- listen kill "id:Batkiller Listener" type:entity qty:<cons:BatsQty> target:bat "script:Batkiller Quest Completed"
- chat "Great! come back to me once you've killed <red><cons:BatsQty><green> 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 3
- chat "Oh ok, don't come crying to me if the noise these bast..I mean bats make wake you up at night."
- chat "That is really unfortunate, but OK. Come back to me when you change your mind."
- chat "It would've been a great help if you could get rid of these plagued bats. Please come back later."
- ^zap 1 "script:Killing the Bats"
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 1 "script:Killing the Bats"
click trigger:
script:
# This is simply to present the options again if the player accidently clicks the NPC rather than type a response.
- ^runtask "script:Batkiller Quest Requirement"
damage trigger:
script:
- ^runtask "script: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> runtask "script:Deny Interaction"
else if "<flag.p:BatKiller>" == "Started" chat "Hi <player.name>, please come back to me when you've killed all <red><cons:BatsQty><green> bats!"
else if "<flag.p:BatKiller>" == "ClaimReward" chat "<player.name>, come over here! Come get your <gold>reward<green> for killing those pesky bats!"
else if "<flag.p:BatKiller>" == "Claimed" chat "Thanks for your help <player.name>, please come back later to help me again."
else runtask "script: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 7
- ^chat "And then he said 'She ate the rat!'. Hahahaha.. oh, sorry. Didn't see you there <player.name>."
- ^chat "These sewers.. they get to you. Voices, chills..there are more than bats down here."
- ^chat "Some days I hate my job, but then I say 'No <npc.name>, you love your job' and then I love it again."
- ^chat "Rats, bats, cats and giant gnats. I kill them all.. it's great because I get paid to hunt for my own food!"
- ^chat "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 "Stay down here long enough, the sewers grow on you. Much like the moss on these bricks.."
- ^chat "Another day in the sewers..or night, I don't know anymore. Are you here to help?"
"Warning":
type: task
script:
# When you hit (damage) the NPC, they will respond with one of the following 5 lines.
- ^random 5
- chat "<red>Oucch! <green>Why would you do that? If I die, you WILL regret it!"
- chat "<red>Aaarrggg! <green>What did I ever do to you? Don't hit me again!"
- chat "<red>Wha..why are you hurting me? <green>Oh, these cuts..they hurt so much."
- chat "<red>Please don't hurt me! <green>I have never done anything bad to you!"
- chat "<red>Owwee! <green>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 5
- ^chat "Oh, why do you come to me armed? Please put away your weapon first."
- ^chat "Is that a..weapon in your hand? Please don't hurt me! You might regret it."
- ^chat "<cons:Townname> is a friendly town, please put your weapon away!"
- ^chat "It's courtesy to put your weapon away while talking to people in <cons:Townname>."
- ^chat "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> runtask "script:Deny Interaction"
else if "<flag.p:BatKiller>" == "Started" chat "Hi <player.name>, please come back to me when you've killed all <red><cons:BatsQty><green> bats!"
else if "<flag.p:BatKiller>" == "Claimed" chat "Thanks for your help <player.name>, please come back later to help me again."
else if "<flag.p:BatKiller>" == "ClaimReward" runtask "script:Batkiller Quest Completed Reward"
else runtask "script: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 5
- ^chat "Hello there <player.name>! Can you please help me get rid of these darn bats?"
- ^chat "Oh hey <player.name>, there are some nasty bats in these sewers. Will you go kill some for me?"
- ^chat "Bats... bats everywhere! Their squeaky high-pitched noises driving me nuts. Kill some for me?"
- ^chat "These bats carry the plague! We need to exterminate them. Will you help me?"
- ^chat "Feel like slicing and dicing some bats? Grab yourself a sword and pretend you are a fruit ninja!"
- random 3
- ^chat "I will pay you <gold><cons:RewardAmount><green> dollars if you kill <red><cons:BatsQty><green> bats for me."
- ^chat "How does <gold><cons:RewardAmount><green> dollars for <red><cons:BatsQty><green> bats sound to you?"
- ^chat "The reward for killing <red><cons:BatsQty><green> bats is <gold><cons:RewardAmount><green> dollars. Interested?"
- ^narrate "<red>Say:"
- ^narrate " <blue>YES<blue> <gray>or<red> No"
- ^zap 2 "script:Killing the Bats"
"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 NPC 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:<cons:Quest Repeat Timeout>"
- random 3
- ^chat "Haha, good job <player.name>, you got those bats good! You can come back and help me again tomorrow."
- ^chat "Well done <player.name>, that will teach those pesky bats! You can come back and help me again tomorrow."
- ^chat "Fantastic <player.name>, but they will be back again tomorrow. Please come help me again and I'll pay you for the service."
- give money qty:<cons:RewardAmount>
- narrate "<red><npc.name> pays you <gold><cons:RewardAmount><red> gold coins."