Paste #20620: Untitled Paste

Date: 2015/10/05 03:23:06 UTC-07:00
Type: Denizen Script

View Raw Paste Download This Paste
Copy Link


DHGM:
  type: assignment
  interact scripts:
    - 1 DHGMInteract
  actions:
    on assignment:
      - trigger name:click state:true
      - trigger name:chat state true
      - trigger name:proximity state:true radius:3
      - narrate "The Dragonhold Guild Master is active."
    on exit proximity:
      #- narrate format:GMChat "Goodbye, <&a><player.name><&r>."
      - if <s@DHGMInteract.step[<player>]||1> != 1 {
        - zap step:1 script:DHGMInteract
      }

DHGMInteract:
  type: interact
  steps:
    1:
      click trigger:
        script:
          - narrate format:GMChat "Hi there <&9><player.name><&r>."
          - if <player.has_flag[Guild]> {
            - if <player.flag[Guild]> == dragonhold {
              - narrate format:GMChat "It's good to see you again! I hope you're doing assignments!"
            }
            else {
              - narrate format:GMChat "Sorry, but you are a member of a different guild."
            }
          }
          else {
            - narrate format:GMChat "Are you interested in joining our guild?"
            - narrate format:GMChat "If you accept, when you die you will revive in our city! <&nl>You will also be able to do assignments for great <&e>rewards<&r>."
            - narrate "Acceptable responses are <&a>Yes <&r>or <&a>No<&r>."
            - zap step:JoiningGuild
          }
          # TODO leave guild
    JoiningGuild:
      chat trigger:
        1:
          trigger: /Yes/, I would love to join!
          script:
            - narrate format:GMChat "Fantastic, I will send the assignment manager a memo with your details!
            - narrate format:GMChat "You're now able to assignments for us and will revive in our wonderful city!"
            - narrate format:GMChat "I hope to see you around!
            - flag <player> Guild:Dragonhold
            - zap step:1
        2:
          trigger: /No/ thanks. I have other interests.
          script:
            - narrate format:GMChat "That's okay, maybe another day..."
            - zap step:1
        3:
          trigger: /regex:.+/
          script:
            - narrate format:GMChat "I'm sorry I have no idea what you mean..."
            - zap step:1

DHQG:
  type: assignment
  interact scripts:
    - 1 DHQGInteract
  actions:
    on assignment:
      - narrate "The Dragonhold QuestGiver is active."
      - trigger name:click state:true
      - trigger name:chat state:true
      - trigger name:proximity state:true radius:3
    on exit proximity:
      - if <s@DHQGInteract.step[<player>]||1> != 1 {
        - zap step:1 script:DHQGInteract
      }

DHQGInteract:
  type: interact
  steps:
    1:
      click trigger:
        script:
          - narrate format:QGChat "Hello <&9><player.name><&r>!"
          - if <player.has_flag[Guild]> {
            - if <player.flag[Guild]> == dragonhold {
              - if <player.has_flag[Quest]> {
                - inject CheckQuest
              }
              else {
                - narrate format:QGChat "Are you interested in doing an assignment for the guild?"
                - narrate format:QGChat "You will be rewarded greatly upon completion!"
                - narrate "Acceptable responses are <&a>Yes <&r>or <&a>No<&r>."
                - zap step:AcceptAssignment
              }
            }
            else {
              - narrate format:QGChat "Uh.. Is there something I can do for you?"
            }
          }
          else {
            - narrate format:QGChat "Talk to the guild master upstairs to join our guild!"
          }
    AcceptAssignment:
      chat trigger:
        1:
          trigger: /Yes/ I am!
          script:
            - narrate format:QGChat "Fantastic, just let me check what we have for you!"
            - narrate format:QGChat "Okay, the Quests we have available for you are:"
            - define avquest li@Zombies
            - execute as_server "tellraw <player.name> ['',{'text':'                      - '},{'text':'Slay some Zombies!','color':blue,'hoverEvent':{'action':'show_text','value':{'text':'Kill 10 zombies.<&nl>Reward: $1000'}}}]"
            - if !<player.has_flag[weaponsquestcooldown]> {
              - define avquest <def[avquest].include[<&a>Weapons<&r>]>
              - execute as_server "tellraw <player.name> ['',{'text':'                      - '},{'text':'Craft some weaponry','color':blue,'hoverEvent':{'action':'show_text','value':{'text':'Craft the guild 5 iron swords.<&nl>Reward: $1000 and 1 Chocolate Bar'}}}]"
            }
            - if !<player.has_flag[supplyquestcooldown]> {
              - define avquest <def[avquest].include[<&a>Supply<&r>]>
              - execute as_server "tellraw <player.name> ['',{'text':'                      - '},{'text':'Supply some resources','color':blue,'hoverEvent':{'action':'show_text','value':{'text':'Supply 32 oak logs and 128 cobblestone.<&nl>Reward: $1500'}}}]"
            }
            - define avquest <def[avquest].include[cancel]>
            - narrate "Hover over each quest with your cursor for quest info!"
            - narrate "Acceptable responses are <&a><def[avquest].formatted.replace[, and].with[<&r> or<&a>].replace[,].with[<&r>,<&a>]><&r>."
            - zap step:ChooseAssignment
        2:
          trigger: /No/, not at the moment.
          script:
            - narrate format:QGChat "That's okay, you can always come back later."
            - zap step:1
    ChooseAssignment:
      chat trigger:
        1:
          trigger: I want to kill some /Zombies/!
          script:
            - narrate format:QGChat "Awesome, I knew you were a bad ass zombie killer!"
            - narrate format:QGChat "We've had some problems with zombies<&nl>                      attacking the citizens and we need you<&nl>                      to kill <&9>10 <&b>Zombies<&r> to help cull their population."
            - narrate format:QGChat "You can kill them anywhere in the world,<&nl>                      just come back to me for the reward!"
            - flag <player> Quest:zombies
            - zap step:1
        2:
          trigger: I want to craft /weapons/ for the guild!
          script:
            - if <player.has_flag[weaponsquestcooldown]> {
              - narrate "<&c>You must wait <player.flag[weaponsquestcooldown].expiration.formatted> before doing this quest again!"
              - queue clear
            }
            - narrate format:QGChat "Sounds good. Our blacksmith has injured his back!"
            - narrate format:QGChat "If you could bring me <&9>5 <&b>iron swords<&r><&nl>                      I will reward you greatly!"
             # - narrate format:QGChat "Oh, and remember, you <&l><&n>must<&r> craft them!"
            - flag <player> Quest:weapons
            - zap step:1
        3:
          trigger: I can /supply/ some resources!
          script:
            - if <player.has_flag[supplyquestcooldown]> {
              - narrate "<&c>You must wait <player.flag[supplyquestcooldown].expiration.formatted> before doing this quest again!"
              - queue clear
            }
            - narrate format:QGChat "Excellent, we need some more materials to build<&nl>                      some houses and to expand Dragonhold!"
            - narrate format:QGChat "Could you bring me 32 oak logs and 128 cobblestone?"
            - flag <player> Quest:supply
            - zap step:1
        4:
          trigger: I want to /cancel/.
          script:
            - random {
              - narrate format:QGChat "Stop messing me around!"
              - narrate format:QGChat "Thanks for wasting my time..."
              - narrate format:QGChat "I have work to do, don't waste my time!"
            }
            - zap step:1
        5:
          trigger: /regex:.+/
          script:
            - narrate format:QGChat "I am sorry, I have no idea what you mean.."
            - zap step:1



CheckQuest:
  type: task
  script:
    - if <player.flag[Quest]> == zombies {
      - if <player.flag[QuestKillCount]||0> < 10 {
        - narrate format:QGChat "You have killed <&9><player.flag[QuestKillCount]||0><&r>/<&9>10<&r> zombies!"
        - narrate format:QGChat "Please come back when you're done."
      }
      else {
        - narrate format:QGChat "You did good, our citizens feel much safer."
        - wait 10t
        - narrate format:QGChat "Here is your reward!"
        - give money qty:1000
        - narrate "You have been rewarded with <&b>$1000<&r>!"
        - flag player quest:!
        - flag player questkillcount:!
      }
    }
    else if <player.flag[Quest]> == weapons {
      #- if <player.flag[QuestCraftCount]||0> < 5 {
        #- narrate format:QGChat "You've crafted <&9><player.flag[QuestCraftCount]||0><&r>/<&9>5<&r> weapons!"
      - define quantity <player.inventory.qty[iron_sword]>
      - if <def[quantity]> < 5 {
        - narrate format:QGChat "You have <&9><def[quantity]><&r>/<&9>5<&r> iron swords.."
        - narrate format:QGChat "Please come back when you're finished."
      }
      else {
        - narrate format:QGChat "Great, thanks for making those swords!"
        - take iron_sword qty:5
        - narrate format:QGChat "Here is your reward!"
        - give money qty:1000
        - give chocolate
        - narrate "You have been rewarded with <&b>$1000<&r> and a <&b>Chocolate Bar<&r>!"
        - flag player quest:!
        - flag player weaponsquestcooldown duration:1d
      }
    }
    else if <player.flag[Quest]> == supply {
      - if <player.inventory.contains[cobblestone].qty[128]> && <player.inventory.contains[log].qty[32]> {
        - narrate format:QGChat "Thanks for getting those materials."
        - take i@cobblestone qty:128
        - take i@log qty:32
        - wait 10t
        - narrate format:QGChat "Here is your reward!"
        - give money qty:1500
        - narrate "You have been rewarded with <&b>$1500<&r>!"
        - flag player quest:!
        - flag player supplyquestcooldown duration:1d
      }
      else {
        - narrate format:QGChat "You don't have those materials yet...<&nl>                      You have <&9><player.inventory.qty[cobblestone]><&r>/<&9>128<&r> cobblestone<&nl>                      and <&9><player.inventory.qty[log]><&r>/<&9>32<&r> logs!"
        - narrate format:QGChat "Please come back when you have them all."
      }
    }

QuestChecks:
  type: world
  events:
    on player kills zombie:
      - if <player.has_flag[Quest]> && <player.flag[Quest]> == zombies {
        - define killcount <player.flag[QuestKillCount]||0>
        - if <def[killcount]> < 10 {
          - define killcount <def[killcount].add_int[1]>
          - flag <player> QuestKillCount:<def[killcount]>
          - if <def[killcount]> < 10 {
            - narrate format:QWChat "You have killed <&9><def[killcount]><&r>/<&9>10<&r> zombies!"
          }
          else {
            - narrate format:QWChat "You have killed all 10 zombies. Return for the reward."
          }
        }
      }