treelopper1:
type: assignment
default constants:
# The Type of Blocks to be Broken
item: log
# The Number of Blocks that need to be Broken.
qty: 24
# The amount of gold you get paid.
reward: 15
# Time before you can repeat the quest
questrepeattime: 86400
# Time before the listener stops
questresettimeout: 86400
actions:
on assignment:
- trigger name:click toggle:true
- trigger name:chat toggle:true
- trigger name:proximity toggle:true
- execute as_op "npc look"
- chat "You got it boss"
interact scripts:
- 10 treelopper1_script
"treelopper1_script":
type: interact
steps:
'1':
click trigger:
script:
- if "<player.flag[treelopper1]>" == "complete" run "script:treelopper1_rewardcheck"
else if "<player.flag[treelopper1]>" == "claimed" chat "I don't need any help for <flag.p:treelopper1.expiration>."
else if "<player.flag[treelopper1]>" == "started" chat "Come back when you are done."
else run "script:treelopper1_presentquest"
'2':
chat trigger:
'Yes':
trigger: /Yes/, I'll get <cons:item>s for you.
script:
- engage
- flag player "treelopper1:started" "duration:<cons:questresettimeout>"
- listen block "id:treelopper1 Listener" type:break block:<cons:item> qty:<cons:qty> region:treetest "script:treelopper1_finished"
- chat "Thankyou <player.name>, I'll be waiting for more <cons:item>s."
- narrate "<red>Break <cons:qty> <cons:item>s."
- disengage
- zap "treelopper1_script" 1
'No':
trigger: /No/, I can't do that right now.
script:
- chat "That's too bad, I could really use more <cons:item>s."
- zap "treelopper1_script" 1
proximity trigger:
exit:
script:
- zap "treelopper1_script" 1
'treelopper1_finished':
type: task
script:
- flag player "treelopper1:complete"
- narrate "<red>You have finished, return to <npc.name> to collect your reward."
'treelopper1_rewardcheck':
type: task
script:
- if <player.inventory.contains[<cons:item>].qty[<cons:qty>]> run "script:treelopper1_reward"
else chat "Now that you have <cons:item>s for me you need to bring them to me."
'treelopper1_reward':
type: task
script:
- chat "This is perfect, exactly what I needed."
- flag player "treelopper1:claimed" "duration:<cons:questrepeattime>"
- take <cons:item> qty:<cons:qty>
- narrate "<yellow>You have been paid <cons:reward> gold."
- give money "qty:<cons:reward>"
'treelopper1_presentquest':
type: task
script:
- chat "Hi there, my name is <npc.name>. I could really use help getting some <cons:item>s."
- chat "Would you help me get <cons:qty> <cons:item>s for me? I'll pay you <cons:reward> gold."
- narrate "<red>Yes <white>or <blue>No."
- zap "treelopper1_script" 2