[SUPPORT] Advanced Turn Based Tile Toolkit

It is very close now. I plan to send it out this week. I just want to make one new tutorial video first so I do not get swarmed by support requests immediately. I’m in the midtst of recording it right now,

Heh, yeah those inputs are there for a reason. So to give you an explanation of what indexes and edges are, the grid manager contains a grid represented by index values, one for each tile. These start at 0 and increase by 1 eastward (UE4 X-axis direction) and by GridSizeX southward (UE4 Y-axis direction). So if you have a square grid of 3*3 tiles, the indexes would look as follows:

0 ] 1 ] 2 ]
3 ] 4 ] 5 ]
6 ] 7 ] 8 ]

In the grid manager there is an array called the edge array (in next update called GridEdges). This array defines what tile indexes a unit can move to when standing on a specific tile. By default all the tiles in the grid above would be connected to their neightbors. So if you looked at the edge array at index 2 you would find an array containing three values: 1, 4 and 5.

But say you placed a wall between index 2 and 5 at the start of the game. If so, only the values 1 and 4 will be at the edge array index 2. If you later destroy the wall mesh or actor, but do not change the underlying edge array units will still not be able to pass between the tiles.

To fix this, after destroying the wall we use the AddTileBothWays function to add edge 5 to index 2 and edge 2 to index 5. To do this you would set TileIndex to either 2 and edge index to 5 (or the opposite. Does not madder since we’re adding edges both ways). Cost would define the movement cost you want for passing between the tiles. Default is 1 unless you want some sort of difficult terrain.

Hope that helps you understand what is going on under the hood here. Of course, hard coding the specific indexes for each wall is not an ideal solution, so what you probably want to do is add a function to your wall which destroys it and adds the correct edge programmatically. If your wall is based on the BP_Tile actor it becomes pretty easy. Use the variable Index as input for TileIndex and use Index+1 for an eastern wall, Index-1 for western, Index - GridSizeX for north and Index + GridSizeX for south.