Date: 2015/07/24 20:10:03 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
# Name: Kill Quest
# Author(s): mythanical & xenmai
# Version: 0.2 - 25 July 2015
#
# Notes:
# - Updated version based on mythanical's "Kill the Bats" script, that can be found here: http://scripts.citizensnpcs.co/view/aw2t6c.
# - This quest requires an economy to deal with 'money' as a method of reward.
"Killer Npc":
type: assignment
default constants:
# Type of mob that must be killed in this quest.
MobType: bat
# Number of mobs that must be killed in order to complete the quest.
MobQty: 3
# The reward (money) for killing the mobs.
RewardAmount: 300
# The time in between each repeat of the quest (1 day = 86400 seconds).
Quest Repeat Timeout: 86400
# The time until it resets all quest progress (in case quest gets stuck).
Quest Reset Timeout: 86400
# Name of your town, used in some dialog options.
Townname: 'Arrowin'
interact scripts:
- 10 Kill Quest
actions:
on assignment:
- trigger name:chat toggle:true
- trigger name:click toggle:true
- trigger name:proximity toggle:true
"Kill Quest":
type: interact
steps:
1:
proximity trigger:
entry:
script:
# On player entering proximity range, run a script (located further down).
- run "Killer Npc Check Requirements"
click trigger:
script:
# On clicking, run a slightly different script to check requirements before starting quest.
- run "Kill Quest Requirement"
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 mobs and once the player killed the number of mobs specified at the top of the script, it will run
# the 'Mobkiller Quest Completed' script.
- engage
- flag player KillQuest:Started "duration:<npc.constant[Quest Reset Timeout]>"
- flag player KillQuestCounter:0
- chat "<yellow>Great! come back to me once you've killed <red><npc.constant[MobQty]><yellow> <npc.constant[MobType]>s."
- narrate "<red> Exterminate <npc.constant[MobType]s - 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 Mobs' script.
- random {
- chat "<yellow>Oh ok, don't come crying to me if the noise these <npc.constant[MobType]>s make wake you up at night."
- chat "<yellow>That is really unfortunate, but OK. Come back to me if you change your mind."
- chat "<yellow>It would've been a great help if you could get rid of these plagued <npc.constant[MobType]>s. 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 "Kill Quest Requirement"
"Kill Quest Listener":
type: world
events:
# This event adds checks when the player kills a mob and adds 1 to its counter if he has started the quest and the mob is the correct type.
# When the counter reaches the needed amount, it runs the completed quest script.
on player kills entity:
- if <player.flag[KillQuest].is[==].to[Started]> && <context.entity.entity_type.is[==].to[<npc.constant[MobType]>]> {
- flag player KillQuestCounter:++
- if <player.flag[KillQuestCounter]> == <npc.constant[MobQty]> {
- run "Kill Quest Completed"
}
}
"Killer Npc 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 mobs
# 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[KillQuest]> == Started chat "<yellow>Hi <white><player.name><yellow>, please come back to me when you've killed all <red><npc.constant[MobQty]><yellow> <npc.constant[MobType]>s!"
else if <player.flag[KillQuest]> == ClaimReward chat "<white><player.name><yellow>, come over here! Come get your <gold>reward<yellow> for killing those pesky <npc.constant[MobType]>s!"
else if <player.flag[KillQuest]> == Claimed chat "<yellow>Thanks for your help <white><player.name><yellow>, please come back later to help me again."
else run "Killer Npc General Chat"
"Killer Npc 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 mobs 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, mobs, 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?" }
"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?" }
"Kill 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 MobKiller flag is on 'ClaimReward', it will run the 'Mobkiller Quest
# Completed Reward' script further below.
- if 267|268|272|276 contains <player.item_in_hand.id> run "Deny Interaction"
else if <player.flag[KillQuest]> == Started chat "<yellow>Hi <white><player.name><yellow>, please come back to me when you've killed all <red><npc.constant[MobQty]><yellow> mobs!"
else if <player.flag[KillQuest]> == Claimed chat "<yellow>Thanks for your help <white><player.name><yellow>, please come back in <red><player.flag[MobKiller].expiration.formatted><yellow> to help me again."
else if <player.flag[KillQuest]> == ClaimReward run "Kill Quest Completed Reward"
else run "Killer Npc Present Quest"
"Killer Npc 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 Mobs'
# 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 mobs?"
- chat "<yellow>Oh hey <white><player.name><yellow>, there are some nasty mobs in these sewers. Will you go kill some for me?"
- chat "<yellow>Mobs... mobs everywhere! Their squeaky high-pitched noises driving me nuts. Kill some for me?"
- chat "<yellow>These mobs carry the plague! We need to exterminate them. Will you help me?"
- chat "<yellow>Feel like slicing and dicing some mobs? 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[MobQty]><yellow> mobs for me."
- chat "<yellow>How does <gold><npc.constant[RewardAmount]><yellow> <player.money.currency> for <red><npc.constant[MobQty]><yellow> mobs sound to you?"
- chat "<yellow>The reward for killing <red><npc.constant[MobQty]><yellow> mobs is <gold><npc.constant[RewardAmount]><yellow> <player.money.currency>. Interested?" }
- narrate "<red>Say<&co>"
- ^narrate " <blue>Yes<blue> <gray>or<red> No"
- ^zap "s@Kill Quest" step:2
"Kill Quest Completed":
type: task
script:
# When the 'listen' command detects the necessary quantity of mobs 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 Mobs - Quest Completed. Return to <aqua><npc.name><red> to claim your reward."
- ^flag player KillQuest:ClaimReward
"Kill 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 KillQuest:Claimed "duration:<npc.constant[Quest Repeat Timeout]>"
- random {
- chat "<yellow>Haha, good job <white><player.name><yellow>, you got those <npc.constant[MobType]>s good! You can come back and help me again in some hours."
- chat "<yellow>Well done <white><player.name><yellow>, that will teach those pesky <npc.constant[MobType]>s! You can come back and help me again in some hours."
- chat "<yellow>Fantastic <white><player.name><yellow>, but they will be back again soon. 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>."