edited April 2016 in ORK Scripting
Hi there,

I'm working on creating a phase battle (one side fires, then the other), but I'm encountering some issues. The issues stem from the fact that I want each team to be on different screens.

I want one side to select everything (great, this works) and then they start their attack (everybody firing missiles all at the same time), the screen transitions to the opponents who receive the missiles and then they begin their selection and fire back. And repeat.

So from what I can tell in a phase battle ORK works like the following:
1) Start Phase (Fire the Faction Phase Start Event).
2) Choose actions for combatants.
3) Perform actions (attacks, abilities).
4) End Phase (Fire the Faction Phase End Event).

Initially I thought this would be easy and I had the end phase look like this:
http://puu.sh/owT9u/0bad12ac02.png

But the problem then happened that the actions occurred before the screen transitioned. I couldn't figure out a way to "wrap" the actions around the start and end phase; plus that wouldn't be good form. When I tried putting screen transitions on the actions I had another issue - the transition would happen multiple times (because of multiple attacks) and if I choose actions like "end phase" it wouldn't transition at all because there were no actions to perform.


Is there an event in ORK that I could access so that when the "actions" phase starts I can transition the screen away from the currently active team? The ideal goal would be to make the phases go: 1, 2, 4, 3.


void SubscribeToChoosingState(Combatant combatant)
{
combatant.Actions.ChoosingStateChanged += DetermineLayerOrder;
}

This is the event I'm currently using to determine which layer I should be on, but its not ideal as I subscribe for every combatant involved. It would be ideal if the ORK.Battle.System had a similar event I could hook into.

Thanks for any help!
Post edited by deckrocket on
  • edited April 2016
    You can stop the transition from happening in each action by using a global variable to mark it already happened. E.g. check for a global bool variable before the transition and set it after the transition. The phase change events would reset it so that the transition can happen again in the next phase.
    Post edited by gamingislove on
    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 April 2016
    Great I will try doing that today! Thanks!

    For reference - I set up a bool and got it to work with an event as shown:
    http://puu.sh/oy2wJ/6785364b44.png

    This event occurs in the middle of my animations (allowing me to fire missiles, transition, and then have the enemy receive the missiles). Thanks for the help!

    I also added similar actions on my EndPhase event so that if the player decided to simply end their turn or only perform defense actions the camera would still transition over to the enemy team.
    Post edited by deckrocket on
  • edited April 2016
    Hmm - one more thing. I'd like to have two types of phase battles (one active command and the other normal). Is there an easy way to access that property from within ORK?

    For reference, here is what I did - not sure if there is a better way:
    http://puu.sh/oyc17/cdbb388284.png

    If a combat ends abruptly (as in part way through an active command phase battle) one team achieves victory - is the end phase event fired or does it get skipped?
    Post edited by deckrocket on
  • Best way to change the setting is like this:
    ORK.BattleSystem.phase.activeCommand = value;
    Your code does the same thing, but the current battle system could by anything, based on the state of the game :)

    If a battle ends, there's no end phase event - they're only used when switching phases. If you need to do something, that'd need to be done in battle end events.
    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!
  • Many thanks! I figured there was a better way to adjust settings.
Sign In or Register to comment.