#(benjid) For loop with all sheep

37 messages · Page 1 of 1 (latest)

sudden granite
#

Just the title ig. How can i loop though all loaded sheep (or any other entity)

halcyon ventureBOT
#

(benjid) For loop with all sheep

halcyon ventureBOT
#

Hi I'm AutoThreadBot! Don't mind me, I'll just be adding the helper team to this thread so they can see it. A human will get to you soon.

dull igloo
#

!t worldtag.entities

pallid lotusBOT
sudden granite
#

thanks

dull igloo
#

Hmm.

#

It doesn't say if they're loaded or not.

#

Assuming that entities pulls all known entities in the world, you may have to filter for

#

!t entitytag.is_spawned

pallid lotusBOT
sudden granite
#

would it be stupid to use <world["world"].entities> every tick?

dull igloo
#

!xy

pallid lotusBOT
# dull igloo !xy
Info: xy

Your question seems to be an XY Problem - you're asking about your attempted solution rather than your original problem.
Read in detail about the XY Problem here: http://xyproblem.info/

For an example of an XY Problem we've seen in Denizen, the question "how do I make an event for when a flag expires" has no answer, but the same question asked with full background detail will be something more like "I have this script: [LINK HERE], which sets a 3 minute cooldown flag on a player for when they use an ability. I want the player to be notified when the cooldown completes - how do I do this?" which we can then answer quite effectively (in this example, all that was needed was a simple wait command, no events or flag-listening or anything).

dull igloo
#

For what purpose?

sudden granite
#

im making turrets and so would check around each turret for players and spawn arrows if someone is there

dull igloo
#

Sounds expensive, but I'm not sure if theres an alternative to checking every tick.

sudden granite
#

k thanks for helping

wary python
#

I mean

#

!t find_entities

pallid lotusBOT
wary python
#

Is one option

dull igloo
#

Would that really be more viable assuming they want to find all of their custom turret entities? Is worldtag.entities not a better solution to just grab them all?

wary python
#

Although performance wise, I'd say it depends on the amount of turrets

#

Wait, are they trying to find the turrets themselves, or entities around the turrets to shoot?

dull igloo
#

Both?

dull igloo
wary python
#

Ah, I understood them trying to lookup entities around the turrets to shoot at, mb

dull igloo
#

I mean, that is the additional goal from what I see. So makes sense.

wary python
dull igloo
#

But I was still unsure, does worldtag.entities return ALL entities, or just loaded entities? I assume ALL since it's not specifying.

wary python
#

Probably loaded entities? the server can't really know about entities that aren't loaded, because well, they aren't loaded - but tias

dull igloo
#

Yep. Loaded entities only.

#

But yeah, either flag the server when spawning or deleting your turrets for easier looping, or just check the worlds entities.

summer thicketBOT
#
Thread Closing Reminder

Has your issue been resolved, or your question been answered?
If so, please use the </resolved:1028673926114594866> command to close your thread.
Or </invalid:1028673926898909185> if it's not possible to resolve.

If not yet resolved, please reply below to tell us what you still need.

(Note that if there is no reply for a few days, this thread will eventually close itself.)

#

@sudden granite