UE4.14 is out! I have updated the toolkit to be compatible and sent a new version to Epic which should be available in the launcher soon. Until then there is almost nothing you need to change if you want to use the 4.13 version of ATBTT with UE4.14. The only issue I found was that the materials for the tilemaps in Content/AdvancedTurnBasedTileToolkit/Maps/2D_Game_Example/Tilemaps have been set to none. If you want to play my 2D game example in a 4.13 ATBTT project opened in UE4.14 you need to set the materials of the tilemaps to MaskedUnlitSpriteMaterial. There, that’s it!
@DarkRa88iT: Hello! I’m glad you’re having fun with the toolkit. I’ve played a bit of Duelist and it is not very difficult to get ATBTT to follow a similar control scheme. Before going into how to change the toolkit to work similarly to Duelyst I’ll quickly describe how things work in ATBTT by default:
ATBTT_GameMode contains an array called InitiativeOrder that by default contains all the units placed in the game. This array is ordered so that the currently active unit is stored in index 0, the next one in index 1 and so on. When a unit’s turn ends it is placed at the last index of the array while all other items are shuffled forward one step. After a unit ends its turn the value of HasActedThisTurn of that unit is set to true. When a new unit is activated we check if HasActedThisTurn is true. If it is, this means that we have gone through a full round of all units acting, so we reset HasActedThisTurn for all units.
I have also included an option of switching between multiple units of the same faction by clicking them. This is enabled by setting Can Player Switch Pawns to true in the public variables of BP_GridManager. The logic for switching between units is contained in the event tree of ATBTT_PlayerController. When a unit is clicked we check if it is the same faction as the current unit. If it is we check if it has acted this turn already. If it hasn’t we want to switch to this unit. This is done by putting that unit first in the initiative array and activating that unit. This only works correctly if different factions do not have overlapping initiative values, but act one faction after the next, since we can in principle switch to a unit that has a lower initiative value than a unit of a different faction.
Also by default HasActedThisTurn is set to true whether a unit moves and attacks, attacks or just moves, so if you have done any action with the current unit before switching you will not be able to switch back to it later.
With all this in mind I will tell you how to achieve a control scheme similar to Duelyst. This also assumes that units of different factions act one faction after the next (e.g. all units of one faction having higher initiative values than all units of the next faction and so on).
First in ATBTT_GameMode you will want to prevent the current unit to be activated automatically. Also we set Local Current Unit in ATBTT_PlayerController to be false. Normally this would be identical to Current Pawn in ATBTT_GameMode (I see that I need to do some cleanup on my naming conventions: P ) and is just there to prevent unnecessary casting. We can however exploit this so that there is a current unit in ATBTT_GameMode, but that the player controller does not act as if there is currently one. Also we set the current marker to invisible.
At the very right end of the Event Graph of ATBTT_GameMode:
Then we make a small change to the event graph of ATBTT_PlayerController so that the current unit does not get Has Acted This Turn set to true if it has only moved and not attacked. Just skip this at the beginning of the Initialize Movement - Step 2 comment box:
Instead we add a new node setting Has Acted This Turn to true when End Unit Turn is called:
In addition we do a small change in the nodes just to the right of Touch Input where we decide what action should be executed depending on the faction of a clicked unit. Here we check the faction of the clicked unit up against the faction of the current unit and not the local current unit. This is to prevent a different chain of events from firing when clicking the “current unit” when the player has not actually selected a unit yet.
Also we want to make the current pawn marker visible when we actually activate a unit:
Now for the most complicated step we want to add the option of ending the turn for the entire current faction by pressing an End Turn button in the UI. First we create a new function in ATBTT_GameMode that loops through all units in the initiative array and puts each of them at the back of the initiative order unit it finds a unit of a different faction to the current unit. When one such unit is found we end the turn of the unit before this one as normal so that the following unit is activated normally.
Then create a button in HUD_Faction_Turn. Add an OnClicked event to it and have this call our new Skip All Units Of Current Faction function in ATBTT_GameMode:
Also if you want to have a static camera like in Duelyst you might want to set EnableFollowCam to false in BP_GridCamera. If not then you want to prevent Follow Cam from activating when it is the Player’s turn so that the camera does not follow a unit that has not actually been activated yet. This can be done in ATBTT_GameMode like so:
That should hopefully give you a good foundation for building the sort of turn ordering you are interested in. I hope it was easy enough to follow. Good luck on your game and let me know if you have any other questions