How do I exit a RealTimeBattle in a scene from a script?

I am using a RealTimeBattle area (scene) component.
I want to end the battle and save the position in the scene, since the movement of the combatants during the battle is not saved.

Therefore, we want to exit RealTimeBattle from the script just before saving.
ORK.Game.ActiveGroup.Leader.Battle..EndBattle();

OR,
ORK.Battle.EndBattle(BattleOutcome.Victory);
but the battle does not end.

In the Battle Component description it says
'It ends when the player leaves the scene'.

So,
ORK.Access.Group.DestroyInstances(ORK.Game.ActiveGroup,true):
but the battle does not end.

How can I end it?
  • You can either disable/destroy the RealTimeBattleArea component or it's game object, or use this code to remove the real time battle area:
    ORK.Battle.RealTimeAreaCount--;

    Similarly, you can add a real time battle area by code:
    ORK.Battle.RealTimeAreaCount++;


    Generally, you can save during real time battles - just keep in mind that the state of the battle isn't saved, e.g. current turn, queued actions or even in-action state are not tracked in save games. The player position, status values, etc. are all saved, though. Same for enemy combatants if their spawners are set up to remember them.
    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!
  • gamingislove said: Generally, you can save during real time battles
    I did not know this.
    I tried it and was able to save normally even in the middle of a battle!
    Thank you.
  • You can also save during other battles, just the battle state isn't saved, so when loading you'll not be in battle any longer and probably just stand in a battle scene :)
    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!
Sign In or Register to comment.