• News

• Industries

• Learning & Support

• Community

• Marketplace

# Cell Status assigning a value to a specific grid coordinate

I have created an array of Vectors that creates a grid of 15x15 squares, but now I’m struggling to figure out how to check if a specific cell is vacant or not. It’s kind of an active battleship style game, and I just can’t figure out how to determine if there is something inside of a cell. Basically I want to be able to set a value to a cell occupied by any object with a collision box. For example:

0: Cell is vacant 1: Cell is occupied by an object

You can simply use “BoxOverlapActors” or “BoxOverlapComponents” node without having CollisionBoxes in the scene.

I’m not familiar with those nodes, but I’m quite sure they aren’t what I’m looking for. I don’t have anything for the objects with collision boxes to overlap, because the grid is nothing more than an array of coordinates. I’m specifically looking to assign a value to any cell that is occupied by an object. If there is a tank that is 45x45 in a grid with cells the size of 15x15 it means that 6 cells in total will be occupied and I would like to assign a value of 1 to the cells that are occupied.

If your tank or the object that will occupy the cell have collision , so the node will do a test based on a location & size (extent) to check if it’s free ( will return false ) or occupied ( will return true).

Those nodes don’t seem to do what I am trying to achieve. I’m either not fully understanding how to use them, or they’re not the right tool for the job. Any chance of a small example of how to use these nodes? There doesn’t seem to be too much information about them.

Ohhhh, I see how it works now. My understanding was that it had to overlap an actual object for it to work. I completely misunderstood the entire node. I really appreciate the example, and my grid creation isn’t too different from how you set it up so it’s easy to modify my own to work with the boxoverlapactor nodes. Thank you.

I’ve come across a problem with getting the status of a tile. I recreated the entire blueprint you posted just to make sure it wasn’t due to something being incompatible with my own blueprint. Anyway, in the completed part of check cells, the entire section doesn’t work for me. It doesn’t seem to be getting the status of the cell which means all cells appear as green. If I move that part up directly after setting the status from index with a branch node it works perfectly fine and any cell that is occupied is now red, but any attempt at getting the status of a cell without using boxoverlapactors every time fails.

I’m either not getting the status of cells correctly, setting status isn’t working correctly, or I am once again misunderstanding the node and must use it every single time I want to check a cells status, but then that would render setting the status in the first place pointless? Thanks in advance for all the help.

Post a screenshot where you set the cell

I created a blank project when I couldn’t get it to work properly and recreated your entire blueprint, so I set it up exactly how it is shown in your image. Do the grids change color for you with the blueprint you posted?

Sorry , what I posted there is very very very simple and I tested it before !

If I don’t see how you reproduced it , how can I know what are you doing wrong??

Sorry about the wait, had to screenshot a lot and line things up.

Differences: My Struct is called Cell_Stat, my object is called PAP short for “paper object” (temporary object), and I unhooked the completed loop node as it does not work and moved it up to show you where I moved it to get it to work. I’m sure I’ve done something wrong, and hopefully you can see what it is.

Your “Set_Status” event is not done correctly , you are getting as copy so the value in the array is not updated !

Look at the comment in the pic I posted yesterday

also , if your objects are moving , each time you need to check a cell , you will need to call “FlushDebugLines” then “Check_Cells” to have your data updated !

Ohhhh, I thought I got a ref. I must have hit an arrow key before I hit enter. I appreciate your time and patience. Thank you very much it’s working perfectly now.