[SUPPORT] Advanced Turn Based Tile Toolkit

Hey Mivke, sorry for the late reply. You caught me as I’m in the process of moving back to Norway after my stay in Canada, so I haven’t had time to check this thread. Happy to hear that you got the animations working. It is still hard to know exactly what went wrong the first time, as it could be any number of things. Generally for making custom units for your game I would not recommend making a child blueprint of BP_Unit_Anim or BP_Unit_Anim_Advanced as it makes it more awkward to work with when you need to jump between various child and parent blueprints all the time to setup functionality. Rather I would recommend duplicating BP_Unit_Anim instead (unless you are making a unit without a skeletal mesh, like a tank or something, where you’d probably want to create a new child blueprint of BP_Unit instead). What animation blueprint are you using? Is it the regular ABP_Unit, a duplicate, a child blueprint or something scratch built?

Don’t worry about spamming the thread if you have new questions. Glad to hear you have come a long way on the deployment system. The problem you are having with spawning I believe is due to you confusing grid indexes in ATBTT with array indexes in general. The grid sized arrays and maps in the grid manager are set up so that each array index (or integer key in the case of the maps) corresponds correctly to a tile on the grid. When you get all actors of the class BP_Tile, however, the indexes will not correspond to the grid.

Say you have 6 actors of type BP_GA_Tile_Hex placed in your game. If you used GetAllActors of type BP_GA_Tile_Hex this will return an array of length 6, with the array indexes 0-5. Now when you use the GetHitLocationAndIndex function you get the grid index of the tile under the mouse and try to use this to get a tile from this other, small array. To get the grid index of a tile using a similar method to what you are using you would need to loop over all of the actors in the array and check their GridIndex variable agains the grid index output from GetHitLocationAndIndex.

This would work, but it would not be very performant. Not a big issue here, as you are just looping over a few actors and not very often. I would instead suggest to create a new set of integers in BP_GridManager holding the grid indexes of all deployable tiles. If you want to define which tiles are deployable by manually placing these in the viewport like you are doing now you could fill this set by looping over all these spawning platforms during the setup of BP_GridManager, getting the GridIndex of each and adding these to the set. That way you only need to loop over all the actors once, and not while the game is running. You could also fill this set by any other way you wanted and would not be dependent on manually placing spawning points if you do not want to.

You are really close to have a working setup, and I hope my explanation will allow you to get it working how you want it to.