# This script asks the player to build an amount of an item.
'crafting1':
type: assignment
default constants:
# Item to Craft
item: wood_door
# Name of item
name: Door
# Amount of Item to Craft
qty: 6
# The amount of gold you get paid.
reward: 20
# Time before you can repeat the quest
questrepeattime: 600
# Time before the listener stops
questresettimeout: 86400
actions:
on assignment:
- trigger name:chat toggle:true
- trigger name:click toggle:true
- trigger name:proximity toggle:true
interact scripts:
- 10 crafting1_script
'crafting1_script':
type: interact
steps:
'1':
click trigger:
script:
- if "<player.flag[crafting1]>" == "complete" run "script:crafting1_rewardcheck"
else if "<player.flag[crafting1]>" == "claimed" chat "I don't need any help for <flag.p:crafting1.expiration>."
else if "<player.flag[crafting1]>" == "started" chat "Come back when you are done."
else run "script:crafting1_presentquest"
'2':
chat trigger:
'Yes':
trigger: /Yes/, I'll craft <cons:name>s for you.
script:
- engage
- flag player "crafting1:started" "duration:<cons:questresettimeout>"
- listen item "id:crafting1 Listener" type:craft item:<cons:item> qty:<cons:qty> "script:crafting1_finished"
- chat "Thankyou <player.name>, they just dont build them like they used to."
- narrate "<red>Craft <cons:qty> <cons:name>s."
- disengage
- zap "crafting1_script" 1
'No':
trigger: /No/, I can't do that right now.
script:
- chat "That's too bad, I could really use more <cons:name>s."
- zap "crafting1_script" 1
proximity trigger:
exit:
script:
- zap "crafting1_script" 1
'crafting1_finished':
type: task
script:
- flag player "crafting1:complete"
- narrate "<red>You have finished, return to <npc.name> to collect your reward."
'crafting1_rewardcheck':
type: task
script:
- if <player.inventory.contains[<cons:item>].qty[<cons:qty>]> run "script:crafting1_reward"
else chat "Now that you made <cons:name>s for me you need to bring them to me."
'crafting1_reward':
type: task
script:
- chat "This is perfect, <cons:name> is exactly what I needed."
- flag player "crafting1:claimed" "duration:<cons:questrepeattime>"
- take <cons:item> qty:<cons:qty>
- narrate "<yellow>You have been paid <cons:reward> gold."
- give money "qty:<cons:reward>"
'crafting1_presentquest':
type: task
script:
- chat "Hi there, my name is <npc.name>. I could really use help making some <cons:name>s."
- chat "Would you help me make <cons:qty> <cons:name>s for me? I'll pay you <cons:reward> gold."
- narrate "<red>Yes <white>or <blue>No."
- zap "crafting1_script" 2