Paste #38810: DH Kalthaxu

Date: 2017/01/06 15:26:55 UTC-08:00
Type: Denizen Script

View Raw Paste Download This Paste
Copy Link


#Ensure all Cadavers are despawned at start of battle and before!

DHKalthaxu:
    type: assignment
    actions:
        on assignment:
        - trigger name:proximity toggle:true radius:30
        - trigger name:damage toggle:true
        - ^execute as_npc "npc select <npc.id>"
        - ^execute as_npc "npc look"
        - ^execute as_npc "npc health --respawndelay 11s"
        - flag npc respawnpoint:<npc.location>
        - if <npc.has_trait[sentinel]> == true queue clear
        - ^execute as_npc "trait sentinel"
        - ^execute as_npc "npc name"
        - ^execute as_npc "sentinel addtarget PLAYERS"
        - ^execute as_npc "sentinel armor 0.9"
        - ^execute as_npc "sentinel health 30"
        - ^execute as_npc "sentinel healrate 0"
        - ^execute as_npc "sentinel targettime 300"
        - ^execute as_npc "sentinel chaserange 60"
        - equip hand:i@diamond_sword[enchantments=KNOCKBACK,2] offhand:i@shield[base_color=BLACK;patterns=li@GRAY/FLOWERS|SILVER/RHOMBUS_MIDDLE|BLACK/SKULL|SILVER/GRADIENT_UP|BLACK/BORDER]

        on hit on player:
        - ^if <player.is_blocking>
            {
            - ^actionbar "<&c>Your shield has been shattered!"
            - ^equip <player> offhand:i@air
            - ^playsound <player> sound:ITEM_SHIELD_BREAK
            }
        - if <util.random.int[1].to[100]> < 25 queue clear

        on kill:
          - flag server KalthaxuPlayers:<-:<player>
          - narrate "You died!" targets:<player>

        on damaged:
        - if <context.damager> MATCHES PLAYER
            {
            - playsound <context.damager> sound:ENTITY_BLAZE_HURT
            - wait 2s
            - if <npc.is_spawned> == false queue clear
            - run KalthaxuTP
            }

        on enter proximity:
        - playsound <player> sound:ENTITY_BLAZE_AMBIENT
        - if <npc.has_flag[locationreset]> == true
            {
            - flag npc locationreset:!
            }

        on exit proximity:
        - if <location[<npc.location>].find.players.within[30].formatted> == ''
            {
            - if <npc.is_spawned> == false queue clear
            - define npcloc <npc.flag[respawnpoint]>
            - chunkload <npc.location.chunk> duration:3m
            - chunkload <location[%npcloc%].chunk> duration:3m
            - if <location[<npc.location>].distance[%npcloc%]> == 0 queue clear
            - flag npc locationreset
            - wait 2m
            - if <location[<npc.location>].distance[%npcloc%]> > 9
                {
                - if <location[<npc.location>].find.players.within[4].formatted> == ''
                    {
                    - spawn <npc> <npc.flag[respawnpoint]>
                    - flag npc locationreset:!
                    - queue clear
                    }
                }
            - if <npc.has_flag[locationreset]> == false queue clear
            - flag npc locationreset:!
            - spawn <npc> <npc.flag[respawnpoint]>
            }

        on death:
        - define killer <context.killer>
        - if <context.killer.name> == ARROW && <server.has_flag[<context.killer>]> define killer <server.flag[<context.killer>]>
        - if %killer% MATCHES PLAYER
          {
          - playsound %killer% sound:ENTITY_BLAZE_DEATH
          - define loot <util.random.int[2000].to[5000]>
          - flag p@%killer% Credits:+:%loot%
          - narrate "<&c>You have recovered <&b>%loot%<&c> credits!" targets:%killer%
          - run KalthaxuDeath
          }
        - define npcloc <npc.flag[respawnpoint]>
        - chunkload <location[%npcloc%].chunk> duration:16m
        - wait 15m
        - spawn <npc> <npc.flag[respawnpoint]>

#########################################################################################################################################

DHKalCadaver:
    type: assignment
    actions:
        on assignment:
        - trigger name:proximity toggle:true radius:30
        - trigger name:damage toggle:true
        - ^execute as_npc "npc select <npc.id>"
        - ^execute as_npc "npc look"
        - ^execute as_npc "npc health --respawndelay 11s"
        - if <npc.has_trait[sentinel]> == true queue clear
        - ^execute as_npc "trait sentinel"
        - ^execute as_npc "npc name"
        - ^execute as_npc "sentinel addtarget PLAYERS"
        - ^execute as_npc "sentinel armor 0.4"
        - ^execute as_npc "sentinel speed 0.8"
        - ^execute as_npc "sentinel targettime 300"
        - ^execute as_npc "sentinel chaserange 40"

        on hit on player:
        - if <util.random.int[1].to[100]> < 50 queue clear
        - actionbar "<&c>You have been poisoned"
        - cast poison d:5 p:1 <player>

        on damaged:
        - if <context.damager> MATCHES PLAYER
            {
            - playsound <context.damager> sound:ENTITY_BLAZE_HURT
            - if <npc.can_see[<context.damager>]> == false
                {
                - attack target:<context.damager>
                - wait 5s
                - attack <npc> target:cancel
                }
            }

        on enter proximity:
        - playsound <player> sound:ENTITY_ZOMBIE_AMBIENT

        on death:
        - define killer <context.killer>
        - if <context.killer.name> == ARROW && <server.has_flag[<context.killer>]> define killer <server.flag[<context.killer>]>
        - if %killer% MATCHES PLAYER
            {
            - playsound %killer% sound:ENTITY_BLAZE_DEATH
            - define loot <util.random.int[5].to[15]>
            - flag p@%killer% Credits:+:%loot%
            - narrate "<&c>You have recovered <&b>%loot%<&c> credits!" targets:%killer%
            }
        - flag server kalkillcount:+:1
        - if <server.flag[kalkillcount]> == 4
            {
            - flag server kalkillcount:!
            - run KalthaxuTP
            }

#######################################################################################################################################################

KalthaxuTP:
  type: task
  script:
  - define CenterTP l@716.4829909339679,52.0,209.4827083244251,90.0,-177.17944,pvpmap
  - define SouthTP l@716.5141676712896,57.0,221.50450771490475,5.9999957,-179.87964,pvpmap
  - define WestTP l@704.4603542754791,57.0,209.5028900425203,-0.30001023,-89.13037,pvpmap
  - define NorthTP l@716.5185440571789,57.0,198.50060357067485,-2.5500035,-358.833,pvpmap
  - define EastTP l@728.4855232572958,57.0,209.50389899756567,2.7,-270.93237,pvpmap
  - random 5
  - teleport n@695 %CenterTP%
  - teleport n@695 %SouthTP%
  - teleport n@695 %WestTP%
  - teleport n@695 %NorthTP%
  - teleport n@695 %EastTP%
  - if <n@695.location.y> > 55 queue clear
  - narrate "<&8>Kalthaxu:<&7> Arrise my pretties!" targets:<server.flag[KalthaxuPlayers].as_list>
  - flag server kalkillcount:!
  - spawn <n@696> %SouthTP%
  - spawn <n@697> %NorthTP%
  - spawn <n@698> %WestTP%
  - spawn <n@699> %EastTP%

#######################################################################################################################################################

KalthaxuDeath:
  type: task
  script:
  - foreach <server.flag[KalthaxuPlayers]>
      {
      - ^teleport <%value%> l@711.4758678835883,64.0,122.5558274442147,2.6999984,0.42937255,pvpmap
      - ^cast blindness remove <%value%>
      }
  - flag server KalthaxuPlayers:!