Solved Loop entity, location

  • 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.

Craaft3r

Member
Aug 6, 2022
10
0
1
Hi everyone! I'm trying to create a script that when executing the command does a check of all the entities, fetches the coordinates of each one and sends a message .. But I can't!

Code:
Code:
command /entity:
    trigger:
        loop all entities in radius 8 of player:
            loop-entity is zombie:
                set {_entity} to location of loop-entity
                set x-coordinate of {_entity} to {_x}
                set {_y} to y-position of {_entity}
                set {_z} to z-position of {_entity}
                send "%{_x}%, %{_y}%, %{_z}%" to player

Skript Version: 2.6.3
Minecraft Version: 1.19.1
 
Last edited:
1. you are setting the x-coordinate of _entity to a non existing variable
2. just do
Code:
loop all entities in radius 8 of player where [input is a zombie]:
 
1. you are setting the x-coordinate of _entity to a non existing variable
2. just do
Code:
loop all entities in radius 8 of player where [input is a zombie]:

Fixed for coordinates. The problem was the condition

This is better:
Code:
if "%loop-entity%" contains "zombie"

Do you know another method even for distant entities? If so, even better (Without using the radius)
 
You can use
Code:
loop all entities:
which loops all loaded entities

and you can use this for looping all entities in a world.

Code:
loop all entities in world "world":
 
You can use
Code:
loop all entities:
which loops all loaded entities

and you can use this for looping all entities in a world.

Code:
loop all entities in world "world":
I should make particles appear as the lighthouse in every position of the entities, so that the player can see where they are
 
looping all the entities is a bad ideas for many reasons, it will loop entities such as item frames and armor stands etc which you probably don't want to loop (this can be fixed with a filter anyway), even with that fixed you still shouldn't loop ALL OF THEM, chances are performance will drop. loop all the entities in a big radius like 50 and call it a day
 
You could indeed use this instead of you want only all zombies

Code:
Loop all zombies in radius x around player:

Loop all zombies in world "world":
 
You could indeed use this instead of you want only all zombies

Code:
Loop all zombies in radius x around player:

Loop all zombies in world "world":

Optimal! So as not to make a cycle of all entities present in the world. Do you know how I can convert this vanilla to skript?

Code:
console command "/particle glow_squid_ink %{_x}% %{_y}% %{_z}% 0.1 100 0.1 0 2500 force"
 
Status
Not open for further replies.