Paste #19699: DailyWGQuest

Date: 2015/08/25 07:04:18 UTC-07:00
Type: Denizen Script

View Raw Paste Download This Paste
Copy Link


WGAssign:
    type: assignment
    interact scripts:
    - 10 DailyWGQuest

DailyWGQuest:
    type: interact
    steps:
        start*:
            click trigger:
                script:
                - chat "Welcome to the Warrior's Guild!"
                - wait 2
                - chat "We take great pride in keeping the streets free from monsters."
                - wait 3
                - chat "I invite you to join our ranks, and keep our townsfolk safe."
                - wait 2
                - chat "Do you accept?"
                - wait 1
                - narrate "<white>You can say, <green>Yes<white> or <green>No<white>."
            chat trigger:
                1:
                    trigger: /Yes/, I will join you.
                    script:
                    - chat "Great! I offer daily assignments to the Guild members."
                    - wait 3
                    - chat "Please come back when you'd like your first."
                    - ^zap step:return
                    - ^flag server WGMembers:->:<player>
                2:
                    trigger: /No/, I will not join you.
                    script:
                    - chat "We will make due without you..."
        return:
            click trigger:
                script:
                - random {
                  - chat "Welcome back to the Warrior's Guild!"
                  - chat "The Guild welcomes you back."
                  - chat "Glad to see you are still alive."
                  }
                - wait 3
                - chat "Are you ready for an assignment?"
            chat trigger:
                1:
                    trigger: /Yes/, I am.
                    script:
                    - random {
                      - chat "Great to hear!"
                      - chat "Wonderful!"
                      - chat "The town will be so greatfull!"
                      }
                    - wait 1
                    - chat "I need you to slay 10 zombies around town."
                    - ^flag player WGCount:0
                    - ^listen kill type:entity target:zombie qty:1 script:WGCheck
                    - wait 1
                    - chat "Return to me when you have finished."
                    - ^zap step:waiting
                2:
                    trigger: /No/, I am not.
                    script:
                    - chat "Please return when you are..."
        waiting:
            click trigger:
                script:
                - chat "You've only killed <player.flag[WGCount].asint>/10 zombies."
                - wait 1
                - chat "Return to the guild once you have finished!"
        reward:
            click trigger:
                script:
                - chat "Very well done <player.name>."
                - wait 2
                - chat "Here is a reward for helping the town."
                - wait 1
                - ^narrate "<red>You receieved <gold>100 coins<red> from <npc.name>!"
                - ^give money qty:100
                - ^flag player WGCooldown duration:24h
                - ^zap step:cooldown
        cooldown:
            click trigger:
                script:
                - chat "The guild has no more assignments for today."
                - wait 2
                - chat "Come back tomorrow and check again!"

WGCheck:
    type: task
    script:
    - flag player WGCount:++
    - narrate "**You've killed <player.flag[WGCount].asint>/10 zombies.**"
    - if <player.flag[WGCount].asint> >= 10 run WGReward
      else run WGContinue

WGContinue:
    type: task
    script:
    - ^listen kill type:entity target:zombie qty:1 script:WGCheck

WGReward:
    type: task
    script:
    - narrate "Return to the Warrior's Guild to claim your reward."
    - zap script:DailyWGQuest step:reward

WGWorld:
    type: world
    events:
        on time changes in w@world:
        - if <server.flag[WGMembers]> == "null" queue clear
        - foreach <server.flag[WGMembers].as_list> {
          - if !<%value%.as_player.flag[WGCooldown]> && <s@DailyWGQuest.step[%value%]> != "return" {
            - zap script:DailyWGQuest step:return player:%value%
            - if <%value%.as_player.is_online> {
              - narrate player:%value% "<red>The Warrior's Guild needs your help."
              - narrate player:%value% "<red>Return to them soon!"
              }
            }
          }