Paste #14004: Untitled Paste

Date: 2015/02/23 17:20:04 UTC-08:00
Type: Denizen Script

View Raw Paste Download This Paste
Copy Link


MSMayor:
  type: assignment

  default constants:
    ZombiesQty: 10
    ZombieKillerRepeatTimer: 600
    TownName: 'Misty Shores'

  interact scripts:
  - 10 MSZombieKillerInteract

  actions:
    on assignment:
    - ^flag global msmayor_npc:<npc>
    - ^flag <npc> spawnpoint:l@-1330.47,70.0,-64.747,survive
    - ^adjust <npc> skin:Tasuit
    - ^trigger name:chat toggle:true radius:5 cooldown:30
    - ^trigger name:click toggle:true
    - ^trigger name:proximity toggle:true radius:5
    - ^trigger name:damage toggle:false
    - ^vulnerable state:true
    - ^health 100 target:<npc>
    - ^heal <npc>
    - ^lookclose state:true range:5 realistic
    - ^execute as_server "npc select <npc.id>"
    - ^execute as_server "npc respawn 3600"
    - ^execute as_server "denizen save"

    on push:
    - walk <npc> <npc.flag[spawnpoint]>

    on spawn:
    - health 100 target:<npc>
    - heal <npc>
    - walk <npc> <npc.flag[spawnpoint]>

    on death:
    - ^announce "<red>The Mayor of <npc.constant[TownName]> has been slain!!"

    # on mob enter proximity:

    on enter proximity:
    - random 6
    - chat "And then he said 'She ate the rat!'. Hahahaha.. oh, sorry. Didn't see you there <player.name.display><&e>." targets:<player>
    - chat "Ahhhhh <&b><npc.constant[Townname]><&e>.. it grows on you. Beautiful town, nice people and pesky zombies!!" targets:<player>
    - chat "Some days I hate my job, but then I say 'No <&a><npc.name.nickname><&e>, you love your job' and then I love it again." targets:<player>
    - chat "Rats, Zombies, cats and giant gnats. I kill them all.. it's great because I get paid to hunt for my own food!" targets:<player>
    - chat "The smell from those zombies will get into your clothes. Remember to put your clothes in a bucket of water for 3 days, then wash it with soap." targets:<player>
    - chat "Stay in <&b><npc.constant[Townname]> <&e>long enough and it will grow on you. Much like the moss on these bricks.." targets:<player>



MSZombieKillerInteract:
  type: interact
  steps:
    1:
      click trigger:
        script:
        - if valueof <s@MSZombieKillerInteract.cooldown[<player>].in_seconds.is[MORE].than[0]> {
          - ^chat "Thanks for your help <player.name.display><&e>!  Please come back later if you feel up to killing more zombies." targets:<player>
          - ^narrate "<&b>You must wait <&2><s@MSZombieKillerInteract.cooldown[<player>].formatted> <&b>before you may attempt this quest again!" targets:<player>
          - ^queue clear
          }
          else {
          - random 5
          - chat "Hello there <player.name.display><&e>! Can you please help me get rid of these darn zombies?" targets:<player>
          - chat "Oh hey <player.name.display><&e>, there are some nasty zombies around the town again. Will you go kill some for me?" targets:<player>
          - chat "Zombies... Zombies everywhere! Their squeaky high-pitched noises driving me nuts. Kill some for me?" targets:<player>
          - chat "These Zombies carry the plague! We need to exterminate them. Will you help me?" targets:<player>
          - chat "Feel like slicing and dicing some Zombies? Grab yourself a sword and pretend you are a fruit ninja!" targets:<player>
          - wait 1
          - random 2
          - chat "I will pay you some gold coins if you kill <npc.constant[ZombiesQty]> zombies for me." targets:<player>
          - chat "How does some gold coins sound for <npc.constant[ZombiesQty]> zombies sound to you?" targets:<player>
          - wait 1
          - narrate "<&6>Please answer <&e>Yes<&6> or <&e>No"
          }
      chat trigger:
        1:
          trigger: /Yes/, I am interested.
            script:
            - engage
            - ^flag player MSZombieKillerCount:0
            - ^chat "Great! come back to me once you've killed <cons:ZombiesQty> <&e>zombies."
            - wait 1
            - ^narrate "<&d>---------------------------------------------"
            - ^narrate "<&6>Quest added <&8>| <&6><&o><npc.constant[TownName]> ZombieKiller"
            - ^narrate "<&6> * Kill <&e><cons:ZombiesQty> Zombies"
            - ^narrate "<&d>---------------------------------------------"
            - ^zap s@MSZombieKillerInteract 2
            - disengage
        2:
          trigger: /No/, I am not interested.
            script:
            - random 3
            - chat "Oh ok, don't come crying to me if the noise these bast..I mean Zombies make wake you up at night." targets:<player>
            - chat "That is really unfortunate, but OK. Come back to me when you change your mind." targets:<player>
            - chat "It would've been a great help if you could get rid of these plagued Zombies. Please come back later." targets:<player>
            - zap s@MSZombieKillerInteract 1
    2:
      click trigger:
        script:
        - if flagged MSZombieKillerCount >= <npc.constant[ZombiesQty]> {
          - ^run s@timed_effect_static d:<npc.location>|heart|25|0|0.5|10
          - ^define money <util.random.int[100].to[300].asint>
          - random 3
          - chat "Haha, good job <player.name.display><&e>, you got those Zombies good! You can come back and help me in a little while." targets:<player>
          - chat "Well done <player.name.display><&e>, that will teach those pesky Zombies! You can come back and help me again in a little while." targets:<player>
          - chat "Fantastic <player.name.display><&e>, but they will be back soon. Please come help me again and I'll pay you for the service." targets:<player>
          - ^give exp qty:35
          - ^give money qty:%money%
          - wait 1
          - ^narrate "<&d>---------------------------------------------"
          - ^narrate "<&6>Quest <&8>| <&6><&o>Kill <cons:ZombiesQty> zombies <&8>| <&d>COMPLETE"
          - ^narrate "<&6>Reward <&8>| <&e>$%money% <&8>| <&e>35 exp"
          - ^narrate "<&d>---------------------------------------------"
          - announce "<player.name.display> <&6>has completed the <&b><npc.constant[TownName]> <&6>ZombieKiller quest!"
          - ^cooldown <npc.constant[ZombieKillerRepeatTimer]> s@MSZombieKillerInteract
          - ^flag npc money:!
          - ^flag player MSZombieKillerCount:!
          - ^zap s@MSZombieKillerInteract 1
          }
          else {
          - chat "Please return once you've killed all <npc.constant[ZombiesQty]> zombies!" targets:<player>
          }