Mobs dont attack spawner?

  • Welcome to skUnity!

    Welcome to skUnity! This is a forum where members of the Skript community can communicate and interact. Skript Resource Creators can post their Resources for all to see and use.

    If you haven't done so already, feel free to join our official Discord server to expand your level of interaction with the community!

    Now, what are you waiting for? Join the community now!

  • LOOKING FOR A VERSION OF SKRIPT?

    You can always check out skUnity Downloads for downloads and any other information about Skript!

Status
Not open for further replies.

iStopcontact

Member
Feb 18, 2017
115
2
18
Hello guys, i am working on my own pvp plugin.
And now I have some kits with mob spawn eggs.
Is it possible to make a skript that the player who spawns the mob, doesnt get attacked by it.
But the other players can get attacked by the mob.
 
code_language.skript:
on rightclick with zombie spawn egg:
    cancel event
    spawn a zombie at location of player
    set name of last spawned zombie to "&b%player%'s Zombie"
    add last spawned entity to {target.%player%::*}

on entity target:
    loop {target.%target%::*}:
        if loop-value is event-entity:
            cancel event
          
on join:
    delete {target.%player%::*}

If you want to teleport all entities that move away from you (Only entities spawned by you)
code_language.skript:
on any move:
    set {_delay} to difference between {delay.%player%} and now
    if {_delay} is less than 2 seconds:
        loop {target.%player%::*}:
            if distance between loop-value and player is more than 10: #DISTANCE OF 10 BLOCKS BETWEEN PLAYER AND ENTITY
                teleport loop-value to player
    else:
        set {delay.%player%} to now
 
Last edited by a moderator:
code_language.skript:
on rightclick with zombie spawn egg:
    cancel event
    spawn a zombie at location of player
    set name of last spawned zombie to "&b%player%'s Zombie"
    add last spawned entity to {target.%player%::*}

on entity target:
    loop {target.%target%::*}:
        if loop-value is event-entity:
            cancel event
         
on join:
    delete {target.%player%::*}

If you want to teleport all entities that move away from you (Only entities spawned by you)
code_language.skript:
on any move:
    set {_delay} to difference between {delay.%player%} and now
    if {_delay} is less than 2 seconds:
        loop {target.%player%::*}:
            if distance between loop-value and player is more than 10: #DISTANCE OF 10 BLOCKS BETWEEN PLAYER AND ENTITY
                teleport loop-value to player
    else:
        set {delay.%player%} to now
When i add this to my server it give me a error when i reload the skript: http://prntscr.com/emc1xp
 
Status
Not open for further replies.