"simplekill":
type: assignment
default constants:
# Number of zombies that must be killed for quest to be completed
zombiesQty: 10
# The reward (money) for killing the zombies
RewardAmount: 5
# The time in between each repeat of the quest (currently set at 24 hours)
Quest Repeat Timeout: 300
# Reset all quest progress (this is in case quest gets stuck if 'kill listener' stops 'listening'
Quest Reset Timeout: 86400
interact scripts:
- 10 simplekill_script
actions:
on assignment:
- trigger name:chat toggle:true radius:5
- trigger name:click toggle:true
- trigger name:proximity toggle:true
"simplekill_script":
type: interact
steps:
1:
click trigger:
script:
# On clicking, run a slightly different script to check requirements before starting quest.
- run "simplekill Quest Requirement"
2:
chat trigger:
'yes':
trigger: /Yes/, I will.
script:
- engage
- flag player "simplekill:started" "duration:<cons:Quest Reset Timeout>"
- listen kill "id:simplekill listener" type:entity qty:<cons:zombiesQty> target:zombie "script:simplekill complete"
- chat "Thanks. Remember, they aren't people any more."
- narrate "<red>Quest Started."
- disengage
proximity trigger:
exit:
script:
- ^zap "script:simplekill_script" 1
click trigger:
script:
# This is simply to present the options again if the player accidently clicks the NPC rather than type a response.
- run "simplekill Quest Requirement"
"simplekill 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 simplekill flag is on 'ClaimReward', it will run the 'simplekill Quest
# Completed Reward' script further below.
- if "<player.flag[simplekill]>" == "Started" chat "<yellow>Hi <white><player.name><yellow>, please come back to me when you've killed all <red><cons:zombiesQty><yellow> zombies!"
else if "<player.flag[simplekill]>" == "Claimed" chat "<yellow>Thanks for your help <white><player.name><yellow>, please come back in <red><flag.p:simplekill.expiration><yellow> to help me again."
else if "<player.flag[simplekill]>" == "ClaimReward" run "simplekill Quest Completed Reward"
else run "simplekill Present Quest"
"simplekill 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 'simplekill'
# where it's waiting for the player to type something.
- ^chat "Oh good, will you help me kill these zombies <player.name>?"
- ^chat "<yellow>The reward for killing <red><cons:zombiesQty><yellow> zombies is <gold><cons:RewardAmount><yellow> gold coins. Interested?"
- ^narrate " <blue>Yes<blue> <gray>or<red> No"
- ^zap "script:simplekill_script" 2
"simplekill complete":
type: task
script:
# When the 'listen' command detects the necessary quantity of zombies 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>Quest Completed. Return to <aqua><npc.name><red> to claim your reward."
- ^flag player "simplekill:ClaimReward"
"simplekill 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 "simplekill:Claimed" "duration:<cons:Quest Repeat Timeout>"
- ^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:<cons:RewardAmount>"
- narrate "<red><npc.name> pays you <gold><cons:RewardAmount><red> gold coins."