Teleport after distance

  • 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 comminuty!

    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.

naujan

Member
Oct 9, 2022
3
0
1
23
I want something that if player is 15 block away from last spawned entity, players teleports to it.
I tried:

set {_loc} to location of last spawned entiry
if distance between player and {_loc} is higher that 15:
teleport player to {_loc}

but it doesnt work.
 
Hi!
u write "entiry" instead of "entity"
so it should be
set {_loc} to location of last spawned entity
 
on load: set {bb::%player%} to false on break of stone: chance of 3%: set {boss} to zombie head named "&cWladca zombie" if player has not enough space for {boss}: drop {boss} at event-block else: give player {drop} on place of zombie head: if name of player's tool is "&cWladca zombie": loop blocks under event-block: if loop-block is gold block: set event-block to air set loop-block to air summon zombie at location of event-block set helmet of last spawned entity to golden helmet of unbreaking 10 apply speed 2 to last spawned entity for 999 days set max health of last spawned mob to 2000 set health of last spawned mob to 2000 set {_mhp} to maximum health of last spawned entity set {_hp} to health of last spawned entity set display name of last spawned mob to "&c&lWladca zombie &8[&e %{_hp}%&7/&e%{_mhp}%&8]" on step on all blocks: set {_loc} to location of last spawned entity if distance between player and {_loc} is higher or equal to 15: teleport player to {_loc} send "&cNie uciekaj!" on place: if {bb::%player%} is true: cancel event send "&cNie mozesz budowac podczas walki!" on damage: if attacker is player: if victim is zombie: if display name of victim contains "&c&lWladca zombie": set {_mhp} to maximum health of last spawned entity set {_hp} to health of last spawned entity set display name of last spawned mob to "&c&lWladca zombie &8[&e %{_hp}%&7/&e%{_mhp}%&8]" else if victim is zombie: if display name of victim contains "&c&lWladca zombie": damage victim by 0 hearts if attacker is zombie: if victim is player: if display name of attacker contains "&c&lWladca zombie": damage victim by 1 hearts apply slowness 2 to victim for 8 seconds apply blindness 1 to victim for 8 seconds on death of zombie: if attacker is player: if displayname of victim contains "&c&lWladca zombie": send "&c&lZabiles wladce zombie!" to attacker give attacker chest named "&4&kX &5&lMagiczna Skrzynia &4&kX" set {bb::%attacker%} to false clear {_loc}
 
'last spawned entity' expression return only spawned entity by you with skript in current event. In yours code 'last spawned entity' is always '<none>'. Use another event for handle entity spawn, or create global variable where you put entity
 
Status
Not open for further replies.