Paste #16036: DailyQuesting

Date: 2015/05/31 05:31:29 UTC-07:00
Type: Denizen Script

View Raw Paste Download This Paste
Copy Link


DailyGuildQuest:
    type: assignment
    interact scripts:
    - 10 DailyWGQuest

DailyWGQuest:
    type: interact
    steps:
        start*:
            click trigger:
                script:
                - narrate "<red><npc.name>:<white>Welcome to the Warrior's Guild!"
                - wait 1
                - narrate "<red><npc.name>:<white>We take great pride in keeping the streets free from monsters."
                - wait 1.2
                - narrate "<red><npc.name>:<white>I invite you to join our ranks, and keep our townsfolk safe."
                - wait 0.3
                - narrate "<red><npc.name>:<white>Do you accept?"
                - wait 0.1
                - narrate "<white>You can say, <green>Yes<white> or <green>No<white>."
            chat trigger:
                1:
                    trigger: /Yes/, I will join you.
                    script:
                        - narrate "<red><npc.name>:<white>Great! I offer daily assignments to the Guild members."
                        - wait 3
                        - narrate "<red><npc.name>:<white>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:
                        - narrate "<npc.name>:<white>We will make due without you..."

        return:
            click trigger:
                script:
                - random {
                  - narrate "<red><npc.name>:<white>Welcome back to the Warrior's Guild!"
                  - narrate "<red><npc.name>:<white>The Guild welcomes you back."
                  - narrate "<red><npc.name>:<white>Glad to see you are still alive."
                  }
                - wait 1
                - narrate "<red><npc.name>:<white>Are you ready for an assignment?"
                - wait 1
                - narrate "You can say <green>Yes<white> or <green>No"

            chat trigger:
                1:
                trigger: /Yes/, I am.
                script:
                - random {
                - ^zap step:zombiequest
                - ^zap step:swordquest
                }

                2:
                trigger: /No/, I am not.
                script:
                - narrate "<red><npc.name>:<white>Please return when you are..."

        zombiequest:
            script:
                - random {
                - narrate "<red><npc.name>:<white>Great to hear!"
                - narrate "<red><npc.name>:<white>Wonderful!"
                - narrate "<red><npc.name>:<white>The town will be so greatfull!"
                }
                - wait 1
                - narrate "<red><npc.name>:<white>I need you to slay 50 zombies around town."
                - ^flag player WGCount:0
                - ^listen kill type:entity target:zombie qty:50 script:WGCheck
                - wait 1
                - narrate "<red><npc.name>:<white>Return to me when you have finished."
                - ^zap step:waiting

        swordquest:
            script:
                - random {
                - narrate "<red><npc.name>:<white>Good to hear!"
                - narrate "<red><npc.name>:<white>Awesome!"
                - narrate "<red><npc.name>:<white>Our guild would welcome your help!"
                }
                - wait 1
                - narrate "<red><npc.name>:<white>I need you to bring me 10 iron swords."
                - wait 0.5
                - narrate "<red><npc.name>:<white>These swords will be for the knights of the guild."
                - wait 1
                - narrate "<red><npc.name>:<white>I shall wait for you to bring me the swords."
                - ^zap step:swordswait

        swordswait:
            click trigger:
                script:
                    if <player.inventory.contains[IRON_SWORD].qty[10]>{
                        - ^take IRON_SWORD qty:10
                        - narrate "<red><npc.name>:<white>Thank you for your help!"
                        - wait 0.24
                        - narrate "<red><npc.name>:<white>Here's your reward."
                        - wait 0.1 
                        - narrate "<red>You have recieve <gold>$2500<red> from <npc.name>!"
                        - ^give money qty:2500
                        - ^flag player WGCooldown duration:2m
                        - ^zap step:cooldown
                    } else {
                        - narrate "<red><npc.name>:<white>You don't have enough swords!"
                        - wait 0.2
                        - narrate "<red><npc.name>:<white>Come back when you have enough swords."
                        }

        waiting:
            click trigger:
                script:
                - narrate "You've only killed <player.flag[WGCount].asint>/50 zombies."
                - wait 1
                - narrate "<red><npc.name>:<white>Return to the guild once you have finished!"
        reward:
            click trigger:
                script:
                - narrate "<red><npc.name>:<white>Well done <player.name>."
                - wait 2
                - narrate "<red><npc.name>:<white>Here is a reward for helping the us."
                - wait 1
                - ^narrate "<red>You receieved <gold>$5000<red> from <npc.name>!"
                - ^give money qty:5000
                - ^flag player WGCooldown duration:2m
                - ^zap step:cooldown
        cooldown:
            click trigger:
                script:
                - narrate "<green>The guild has no more assignments for today."
                - wait 2
                - narrate "<green>Come back tomorrow and check again!"

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

WGContinue:
    type: task
    script:
    - ^listen kill type:entity target:zombie qty:50 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!"
              }
            }
          }