edited December 2019 in ORK Scripting
Instead of having my combatants finish their turn automatically when they have no more action points, I'd like to force the player to press an "End Phase" button to end the player's phase. In order to achieve that, I added 0,1 to the combatant's Action Bar and I created a Unity Button that execute a ORK.BattleSystem.phase.ClearCurrentFaction();. However, it seems to do nothing. I was able to force the player's phase end by using the following:

List<Combatant> activeGroupCombatantList = new List<Combatant>();
ORK.Game.ActiveGroup.GetMembers(MenuCombatantScope.Battle, ref activeGroupCombatantList);
foreach (Combatant c in activeGroupCombatantList)
{
c.Battle.EndTurnCommand(true);
}

With this, I was able to end the player's phase. However, I still had some problem to select my player characters once it was their turn again until I disabled Battle System/Phase Battle/Combatant Selection/Auto Select. Now, the problem with that is that after some actions, the NPC AI characters seem to set ORK.BattleSystem.phase.SelectingCombatant to null, which create some more bugs down the line because my code depends on this variable.

So, I ended up thinking I took the wrong approach. My main question therefore is: Why does ORK.BattleSystem.phase.ClearCurrentFaction(); doesn't end the player's phase in first place? Also, what doesn't work with EndTurnCommand(true) to end all my player's turn and thus, their phase? Finally, what is the easiest way to end the player's phase?

Thanks!
Post edited by ArsMagika on
  • Because that function just removes all remaining combatants in the current faction, so that whenever the system wants the next action selected, it'll see that there are no members left and goes to the next phase.

    If you want to do it via scripting, try this:
    ORK.BattleSystem.phase.CombatantSelected(null);

    Otherwise, the phase battle system can set up an input key for ending the phase - which you can e.g. have on screen via a Control HUD, or via custom scripting set the input via:
    ORK.InputKeys.Get(index).SetAxis(value);
    index is the ID/index of the input key, value either 1 (pressed) or 0 (not pressed), or something in between.
    Please consider rating/reviewing my products on the Asset Store (hopefully positively), as that helps tremendously with getting found.
    If you're enjoying my products, updates and support, please consider supporting me on patreon.com!
  • edited December 2019
    Thanks a lot for this! To help other people who might want to do the same, you first need to check the Use Keys checkbox in the Player Combatant Selection section of the Phase Battles settings in order to make the End Phase Key drop down menu appear. Then, you need to create an Input Key in Base/Controls/Input Keys with None as Input Origin. Finally, you need to assign this Input Key as the End Phase Key in Player Combatant Selection of Phase Battles settings.
    Post edited by ArsMagika on
Sign In or Register to comment.