I am working on something, and I need to be able to get the nearest 8 locations from player from an array of vectors. The problem is that I am using a 2D array, here is a diagram of how my array goes:

So if I’m at index 4, I want it to return the rest of the indexes, each index holds a location.

I could just hand code 8 different locations for it to round down to, but that seems tacky, and I want to be able to increase my # of locations to get to at least 5000

Hello, i did a basic minesweeper (this one only for 4 near indexes but works with 8 too where you check near squares, maybe you can adapt it to your goal : https://forums.unrealengine.com/showthread.php?58945-Need-help-about-MineSweeper-style-algoritm&p=221467&viewfull=1#post221467

Basically, you have index x and create an array of x-row-1 x-row x-row+1 x-1 x+1 x+row-1 x+row x+row+1 and get all indexes in your vector array

Hmm… 8 should be fine, but I’m making a temperature system and it seems like a lot of math to update indexes of a heat source that reaches 100 indexes :\ Thanks for the input though, I think I’ll try and run a loop that does what you said.

To avoid massive calculations, for 8 sides minesweeper, i did one calculation on spawn and stored info in each blueprint (including border ignored) and then call the registered array during runtime.

Well, I’m going to run a loop that sets x & y values for each index, index 0 will be 0x ,0y . Index 1 will be 0x , 100y, and so on… Using this pattern, given any index I can round to the nearest multiple of 100, and calculate it. Thanks for your help.