#(benjid) For loop with all sheep
37 messages · Page 1 of 1 (latest)
(benjid) For loop with all sheep
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.
!t worldtag.entities
Returns a list of entities in this world.
Optionally specify an entity type matcher to filter down to.
ListTag(EntityTag)
thanks
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
Returns whether the entity is spawned.
data
ElementTag(Boolean)
would it be stupid to use <world["world"].entities> every tick?
!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).
For what purpose?
im making turrets and so would check around each turret for players and spawn arrows if someone is there
Sounds expensive, but I'm not sure if theres an alternative to checking every tick.
k thanks for helping
Returns a list of entities within a radius, with an optional search parameter for the entity type.
Result list is sorted by closeness (1 = closest, 2 = next closest, ... last = farthest).
finding
ListTag(EntityTag)
Is one option
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?
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?
Both?
Consider flagging the server everytime a turret is placed down or destroyed, so you can just loop through that server flag instead of searching the entire worlds entities.
Ah, I understood them trying to lookup entities around the turrets to shoot at, mb
I mean, that is the additional goal from what I see. So makes sense.
Then yeah you'd probably be better off just keeping track of all turrets ^
But I was still unsure, does worldtag.entities return ALL entities, or just loaded entities? I assume ALL since it's not specifying.
Probably loaded entities? the server can't really know about entities that aren't loaded, because well, they aren't loaded - but tias
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.
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