I need to get all the coordinates of a type of object in two lists, one x and one y. They should correlate. This sounds pretty easy, but the proximity “output all objects found” isn’t working very well, and I want this to be in the same object that you’re scanning for.
Summary: get a list of all the coordinates for a specific type of objects, with no other object, all the code should be in the object you’re getting the coordinates from.
I was hoping @CodeAlpaca could help me out.
i had to do this to create a system targetting the enemy closest to end of a td path
instead of doing proximity just have the objects always sending their x and y coords to the object that is storing them (use push input on the correlating list)
also, have an always (placed below the lists for ordering) constantly setting the lists to an empty one
you can use a switch to make sure the always doesn’t output if the x and y coords aren’t updated (switch turns itself off, and x or y coord message turns it on)
Yeah, I tried that, but it didn’t work. The numbers were right, but the numbers were switching spots every time there was a new message, so it didn’t correlate.
I’ll try this again, but I’m pretty sure it doesn’t work.
Yeah, it doesn’t work for me. the numbers switch around, or the X has one more value than the Y row. Could you test it out and give me the bundle you’re using?
didn’t know you needed it to correlate
you can assign ids to them and have a 3rd variable
that will also shift around but it will show which one it should be
Idk what that means, could you make an example game or explain further?
give each object an id (or just use starting value) and use that in the lists to figure out which coords to use
Does it have to be in range? Because you could just message the values, which would be much better for performance than proximity
Didn’t read the rest of the conversation here first.
So sounds like something is being done incorrectly, if you’re sending the X and Y it should all line up perfectly. Could you send a screenshot/link? You could even use a Global instead with the + input instead of messages if you wanted.
Also, what is the purpose of this? Because maybe with more context a different solution is possible.
First doesn’t work
Ok actually this seems to be working:
I still don’t know when to input “all” to the list, I don’t want the actual list to be flashing, so I want it to transfer to another list when it is filled, how do I do that… The timing is weird…
Also oop that link to push was NOT meant to be there
Actually this works!
can’t believe that thing where one list shows something different, and if you just set it to another list, you can actually see what the values are… It’s so annoying
Move the List setting it to empty below the other Lists.
But it should work either way (though it’s all ways hard to judge frame order just by looking at it). I’m not sure why you have that system if setting the Lists to be blank, seems like you should just do it every frame no matter what.
I’ll make a quick example in a sec, trying to solve an issue Teddy had rn
Just a very simple setup like this is all that’s needed.
Also updated the Example to have a version with a Text List. Once again another really simple system. [“X1&Y1”, “X2&Y2”, “X3&Y3”]
Very easy to get the values from that as well, just Split the text with “&”
XD I swear I already tried that and the values were switching around!
Anyway, I changed up your code a bit to fix some other problems:
Yeah I think the problem you encountered before was a issue with the Frame Order of resetting the list before the values were gotten
hey @CodeAlpaca can you help me again, sorry
How do I make it so that it only makes the list the 4 closest values closest to itself?
Like the 4 closest X values, then the 4 closest Y values. Or the 4 closest values in terms of distance from self - e.g. (32x, 32y) is the object and then the distance equation would be applied to the other points to see the distance between them
The easiest way would probably be to use a List Each on both Lists, then use the Distance Formula. Add those values to a list, then sort it.
That will order it from least to greatest. Get the values at indexes 2, 3, 4, 5. Those are the 4 closest objects (you skip 1 because that will be the object itself, which will have a distance of 0)
Ok, I will try that. If I can’t do it, can you make it for me?