Sorry, I was a bit unclear. I\ll try to be more specific. I did not mean to change the boolean in the event or anything like that. I’ll try to explain. There are several actors in the toolkit that call on the turn manager to end the current unit’s turn. For example this happens in BP_Unit when the unit has 0 AP left, and it happens in the player controller when the player presses the end turn button. You want the turn to end for the entire faction and not just a single unit in all these cases. That means that you need to go to all blueprints that call this event (EndActiveActorTurn) and replace this call to instead call the EndEntireFactionTurn function. You do not need to replace anything in the turn manager itself to achieve this effect.
After you have done this, you have basically the effect you were after. The only problem is that for the AI, the first unit in initiative order will always be the one selected. You said you wanted to select a random AI unit, so you need to make a change to make this happen. You can do this by adding a check at the beginning of the BeginActorTurn event. You do this by adding a branch right at the start of the event that checks the actor coming in, casts it to BP_Unit (continuing as normal if the cast fails). If the cast is successful it check the bAIControlled variable of the unit. If this is false, we continue as usual. If it is true we want to select a random unit from the AI units at the top of the array (for this example we are assuming that there are no factions that have both player and AI controlled units).
To select a random unit we need to check through the InitiativeOrderActors array. As long as you have set up the initiative variables of the units so that there is no overlap between the factions, the first few actors should now be all the units of the AI’s faction. We want to pick one at random from these, but first we need to find out how many we have to pick from. For this we get a reference to the InitiativeOrderActors event and run a for each loop with break through it. For each element we cast to BP_Unit and get its faction. We do this until either the cast returns false or the faction is different from the faction of the unit at index 0. When this happens we know that we have found the first unit in initiative that we do not want to pick from. When this happens we store the current index of the loop -1 and break the loop. Then we pick a random actor from the array using the Get node and a random integer in range (from 0 to our stored index) and run the rest of the BeginActorTurn code using this unit.
Hope that makes more sense.