edited August 2015 in ORK Scripting
I'm having difficulty understanding how Multi-turns can be used in games. The only information I could find on the forum was this post:
[Solved] Multi-turns workflow?

I read it several times but still don't understand. I am able to change the Turn Calculation formula and give some players multiple turns at the beginning of a battle. However, after the first round (PC vs. Monsters) of 3 turns vs. 1 turn, it seems the PCs are back to 1v1 turn. So this system can be used for an ambush but not a battle of high speed vs. slow speed antagonists.

Is there a way to modify the Combatant's turn order during the Battle? I tried changing the following properties:
Combatant.InitNewTurn = true;
Combatant.LastTurnIndex = Combatant.LastTurnIndex + 1; //Should this be negative?
Combatant.TurnValue = Combatant.TurnValue + 1;
Combatant.TurnEnded = false;
None of these worked. Suggestions on how I can give a character say...a 3-action burst late in a Battle? I can write my own function to do it as long as I know which part of the API to call.
Post edited by Nixter on
  • edited August 2015
    The multi-turns work like the battle system in Final Fantasy X, i.e. based on the turn calculation, it's possible to have multiple turns before other combatants.

    It works like this:
    - the Turn Value of each combatant is increased by the result of the turn calculation (usually a formula)
    - the combatant with the highest Turn Value can perform an action
    - after the action, the combatant's Turn Value is reset to 0
    - again, each combatant's Turn Value is increased by the turn calculation, etc.
    A combatant's turn value will build up until it's their time to perform an action.

    I.e. if you want your player (or other combatants) to have multiple turns before another combatant, you need to do this via the Turn Calculation formula, e.g. using a status value and giving a bonus to it when the combatant should have more turns.
    You could e.g. use a status effect on the combatant to increase or decrease their turn value addition.
    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!
  • Thank you for your attention, GiL. I always appreciate it. :)

    I've had some success using your suggested method of using a status effect on a combatant. I can give the attacker multiple actions. However, under the present system it seems impossible to specify exactly how many attacks to give the character, because the number of other party members on both sides changes the outcome.

    For example:

    I have created a +7 turn bonus for the Main Character.

    In a 1v1 battle, the PC has 6 attacks for every one the monster does.
    In a 1v2 battle, the PC has 5 attacks while each monster gets 1.
    In a 3v2 battle, the PC has 4 attacks while each monster gets 1 and each supporter gets 1.

    I understand that the Multi-turns is working fine for what it was designed for (FFX-style) and what I am looking for is outside the scope of your design. This is why I'm trying to find a solution in code to allow a specified number of multiple attacks. Any insight you may have is appreciated.



  • edited August 2015
    I took another couple of approaches to this problem by trying to end the turn after the PC makes a certain number of attacks.

    1) I first tried using the Combatant.EndTurn() method, but this isn't working well. I've gotten errors where if both participants in the battle have used EndTurn(), the GUI disappears and the game hangs. Even with one player using EndTurn(), Turn-based Battles switch to Dynamic Combat. Very strange behavior. Is EndTurn() only used for Dynamic Combat?

    2) I switched to using Combatant.TurnEnded which seems much more stable and promising. My plan is to use a Status Value for the check, but I can't figure out how to access them. What is the code for that? Alternatively I considered using stacked Status Effects, 1 for each attack. But I cant find any way to Get/Set those either.

    So, getting warm but not quite there.

    Update: Got the code. Getting Warmer.

    Combatant.Status[0].GetValue()

    Update 2: It is working! Well, at least on a 1v1 battle. I'm concerned about stability for multiple party members, but I feel I have accomplished enough for today. I'll post a code example tomorrow.
    Post edited by Nixter on
  • edited August 2015
    Turn based combat isn't suited for multiple actions in one turn of a combatant, randomly calling functions or setting fields/properties wont change that, as there are other things (e.g. battle system code) responsible for many things :)

    The turn bonus for the turn calculation is the way to go, but to ensure a combatant to have multiple turns, you'd need to use a high number (e.g. 100000) in order to always be ahead of the other combatants. Don't forget, a combatant's turn value is reset to 0 after each turn while the other combatants turn value will build up until they're able to perform.
    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!
  • Yeah, I was setting the number high to 99. I'll raise it higher if there a lots of party members. Combatant.TurnEnded is working very well for setting the counter back to zero.

    Sorry, it's taking me a little longer than I expected to iron out this code and make sure it work for multiple party members. It will be done soon.

    In the mean time, I have another issue: removing stackable Status Effects. From what I can see in the API, the proper way to remove a Status Effect is:
    Combatant.Status.RemoveEffect(0, true)

    But (in my test) this will remove all stacks of a Status Effect, not just a single instance of the Status Effect. Is that correct? How does one remove a single instance?

    I ask because I would rather use a Status Effect to keep track of the number of attacks instead of a Status Value.
  • Removing a status effect will remove all stacked effects.
    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 October 2015
    I apologize if anyone was waiting for me to post this code. Things came up that made it difficult for me to get back to this.

    Here is an example function that can be used to give multiple attacks. Note that Status[24] is the status value of the number of attacks the character gets and Status[25] is the maximum number of attacks a character can have:

    public void activateMultipleAttacks(){

    Combatant MACombatant = ComponentHelper.GetCombatant(gameObject);
    Debug.Log("Attacks = " + MACombatant.Status[24].GetValue().ToString());
    int attacksRemaining = MACombatant.Status[24].GetValue();
    int maxAttacks = MACombatant.Status[25].GetValue();
    if(attacksRemaining > 1){
    attacksRemaining = attacksRemaining - 1;
    MACombatant.Status[24].SetValue(attacksRemaining, false,false,false,false,false,false);
    Debug.Log("attacksRemaining = " + attacksRemaining.ToString());
    }
    else{
    MACombatant.TurnEnded = true;
    MACombatant.Status[24].SetValue(maxAttacks, false,false,false,false,false,false);
    Debug.Log("Ending Turn");
    }
    }


    If you have trouble with this code, feel free to post questions and I'll try to address them. And again I apologize for the long wait.
    Post edited by Nixter on
Sign In or Register to comment.