[SUPPORT] Advanced Turn Based Tile Toolkit

Making the following change to BP_AbilityBase will make all abilities require clicking the same tile twice:

https://i.imgur.com/flagFlU.png

I think I had something like that in one version, but it seems to have been deprecated. I assume you’re using BP_TurnManager_Initiative for your game? The order of units in initiative for that TurnManager is simply based on where they are in the InitiativeOrderActors array. After a unit’s turn it sets bExhausted to true. A new turn starts when the turn manager tries to start the turn of a unit which is already exhausted. Thus to find the end of the turn you can loop through InitiativeOrderActors until you find the first actor of which the CheckIfExhausted interface returns true. Then you move your desired unit in the array from its current location to the index in front of the exhausted unit’s one.

There are many different ways to do this, and which is best depends a lot on your game, but here is a suggestion: Create a new Set of integers in BP_GridManager. This set defines which grid indexes have obstacles that should block all but flying units. Then motify SearchAndAddAdjacentTiles so that it checks if the tile it is considering for pathfinding is in the new Set right after it checks if the cost of the tile is lower than Move.

Only proceed to the add to PathsMap step if the index is not found in the set. Next modify SearchAndAdjacentTilesCustom1 in a similar way, but for this version, instead of not proceeding if the index is found go straight to where the index is added to LocalOpenListChildTiles. By adding it to this array pathfinding will continue from this tile, but by not adding it to PathsMap the unit will not be allowed to move onto the tile, thus allowing it to move through the obstacle.

Next create a new actor based off BP_GridActor which at BeginPlay adds its GridIndex to your custom Set variable and you have your custom obstacle. Lastly, set the PathfindingType variable of your flying units to Custom1.

Still not, sorry.

Thanks, but what you’ve paid is enough :slight_smile:

Norway, but danke schön :wink:

Glad you found it :slight_smile: It is in a bit of an experimental state, so not something I would want to make a video on yet. I might refactor it for the next update, though, at which point I’ll consider a tutorial.

Spawned units are actually added to the turn order automatically if you set the variable bAutoInitiativeOnSpawn to true when spawning. It will add the unit to the end of initiative, though, and it will not work well with all the turn manager (come to think of it, I should refactor this part to be more modular). For more control add the unit to the InitiativeOrderActors array manually where you want it.

Good to hear 100100 is enough for you. ATBTT works great at that size and lower. If you want to push much larger thatn 100100 then you probably want to do some optimizations to prevent slow map loading. I have various suggestions for people who want to go that way, since the optimal solution depends a lot on the game in question.

Hi, I guess I never tested the 2D map on mobile. Do you want to disable panning/zooming on mobile or enable it on pc?

The 2D example is build with the assumption that you have just one unit, so it does not bother checking if a unit is friendly when you click it. You can add the following to ServerInteract in BP_Ability_2D to prevent attacking friendly units:

https://i.imgur.com/8gRFqMm.png

BP_Ability_2D is set up so that if there are more than 2 actors in InitiativeOrderActors it is in turn based mode, while if it is less than 3 it is in free roam mode. As the TurnManager has a place in InitiativeOrderActors, 2 actors means that only one unit is active (the player). You can change this to a check that loops through InitiativeOrderUnits and checks that there are no units of Faction Enemy in initiative order instead. If you search for InitiativeOrderActors in BP_Ability_2D you’ll find the three places this is checked, which you can modify.