SpawnProtection


Author: NLBlackEagle
Created: 2014-07-05T05:49:46-0400
Edited: 2014-08-13T15:03:31-0400
Denizen Version: 0.9.5 (build 1507)
Views: 14
Downloads: 808
Likes: 0


WGET
Description:
[UPDATE]: Fixed a issue with multi spawnprotections executing.

[UPDATE]: Now also work with NPC's trying to hit players.

The Npc will hit the player once if it is a sentry and back off. After 10 seconds it will reingage.
The meganism for this part of the script uses the sentry ignore add and remove commands.
During the SpawnProtection the player will also be automaticly healed each 0.5 seconds.

You dont need to make any changes for this update. Put it in your scripts file and it will work!

--------------------------------------------------------------------------------------------------------------------

This script doesnt needs any changes to be made.

Players will get spawnprotection for 10 seconds when they die and execute the /back command. command. They wont be able to take or deal damage during this period.

#The Npc will hit the player once if it is a sentry and back off. After 15 seconds it will reingage.
#The meganism for this part of the script uses the sentry ignore add and remove commands.
#During the SpawnProtection the player will also be automaticly healed each 0.5 seconds.
 
#You dont need to make any changes for this update. Put it in your scripts file and it will work!
 

Spawnprotection:
    type: world
    debug: false
    events:
        on player death:
        - flag spawnprotectiondeath:true duration:20s
        on back command:
        - if <player.flag[spawnprotectionactive]> == null {
          - if <player.flag[spawnprotectiondeath]> == true  {
            - flag spawnprotectionactive:true
            - run s@SpawnProtectionInvincible
            }
          }
        on player damaged:
        - if <context.entity.as_player.flag[spawnprotection]> == true {
          - determine CANCELLED
          }
        on entity damages player:
        - if <context.entity.as_player.flag[spawnprotection]> == true {
          - determine CANCELLED
          }
        on player damages entity:
        - if <context.entity.as_player.flag[spawnprotection]> == true {
          - determine CANCELLED
          }
        on entity targets player:
        - if <context.target.as_player.flag[spawnprotection]> == true {
          - determine CANCELLED
          }
        on player damages player:
        - if <context.entity.as_player.flag[spawnprotection]> == true {
          - determine CANCELLED
          }
        on npc damages player:
        - if <context.entity.as_player.flag[spawnprotection]> == true {
          - run s@NPCSpawnProtection player:<context.entity>
          }
        on player damages npc:
        - if <context.entity.as_player.flag[spawnprotection]> == true {
          - determine CANCELLED
          }

NPCSpawnProtection:
    type: task
    debug: false
    script:
    - ^execute as_npc "npc select <npc.id>"
    - ^execute as_npc "sentry ignore add player:<player.name>"
    - ^wait 5
    - ^execute as_npc "npc select <npc.id>"
    - ^execute as_npc "sentry ignore remove player:<player.name>"
 
 

SpawnProtectionInvincible:
    type: task
    debug: false
    script:
    - cooldown 10s s:SpawnProtectionInvincible
    - ^flag <player> SpawnProtection:true
    - ^narrate ""
    - ^narrate "<bold>You have 10 seconds spawn protection"
    - ^narrate ""
    - ^playeffect <player.location.add[0,0,0]> effect:ENCHANTMENT_TABLE qty:100
    - ^heal <player>
    - ^wait 0.5
    - ^playeffect <player.location.add[0,0,0]> effect:ENCHANTMENT_TABLE qty:100
    - ^heal <player>
    - ^wait 0.5
    - ^playeffect <player.location.add[0,0,0]> effect:ENCHANTMENT_TABLE qty:100
    - ^heal <player>
    - ^wait 0.5
    - ^playeffect <player.location.add[0,0,0]> effect:ENCHANTMENT_TABLE qty:100
    - ^heal <player>
    - ^wait 0.5
    - ^playeffect <player.location.add[0,0,0]> effect:ENCHANTMENT_TABLE qty:100
    - ^heal <player>
    - ^wait 0.5
    - ^playeffect <player.location.add[0,0,0]> effect:ENCHANTMENT_TABLE qty:100
    - ^heal <player>
    - ^wait 0.5
    - ^playeffect <player.location.add[0,0,0]> effect:ENCHANTMENT_TABLE qty:100
    - ^heal <player>
    - ^wait 0.5
    - ^playeffect <player.location.add[0,0,0]> effect:ENCHANTMENT_TABLE qty:100
    - ^heal <player>
    - ^wait 0.5
    - ^playeffect <player.location.add[0,0,0]> effect:ENCHANTMENT_TABLE qty:100
    - ^heal <player>
    - ^wait 0.5
    - ^playeffect <player.location.add[0,0,0]> effect:ENCHANTMENT_TABLE qty:100
    - ^heal <player>
    - ^wait 0.5
    - ^playeffect <player.location.add[0,0,0]> effect:ENCHANTMENT_TABLE qty:100
    - ^heal <player>
    - ^wait 0.5
    - ^playeffect <player.location.add[0,0,0]> effect:ENCHANTMENT_TABLE qty:100
    - ^heal <player>
    - ^wait 0.5
    - ^playeffect <player.location.add[0,0,0]> effect:ENCHANTMENT_TABLE qty:100
    - ^heal <player>
    - ^wait 0.5
    - ^playeffect <player.location.add[0,0,0]> effect:ENCHANTMENT_TABLE qty:100
    - ^heal <player>
    - ^wait 0.5
    - ^playeffect <player.location.add[0,0,0]> effect:ENCHANTMENT_TABLE qty:100
    - ^heal <player>
    - ^wait 0.5
    - ^playeffect <player.location.add[0,0,0]> effect:ENCHANTMENT_TABLE qty:100
    - ^heal <player>
    - ^wait 0.5
    - ^playeffect <player.location.add[0,0,0]> effect:ENCHANTMENT_TABLE qty:100
    - ^heal <player>
    - ^wait 0.5
    - ^playeffect <player.location.add[0,0,0]> effect:ENCHANTMENT_TABLE qty:100
    - ^heal <player>
    - ^wait 0.5
    - ^playeffect <player.location.add[0,0,0]> effect:ENCHANTMENT_TABLE qty:100
    - ^heal <player>
    - ^wait 0.5
    - ^playeffect <player.location.add[0,0,0]> effect:ENCHANTMENT_TABLE qty:100
    - ^heal <player>
    - ^wait 0.5
    - ^narrate "<bold>Spawn protection ended."
    - ^flag <player> SpawnProtection:null
    - ^flag spawnprotectionactive:null




Comments
No one has posted a comment! Post one below: