Party order that matters in combat

Does anyone know of a way to implement a battle mechanic where the order of your party members has impact on combat, much like how in classic FF games the party member in front is more likely to be targeted?
If possible, I'd also like to allow the player to swap party member positions during combat.
It would be pretty simple to rewrite the targeting algorithm so that order plays a greater part instead of the target rate.

Is this supposed to be for MZ or MV? You posted in MZ support, but your profile says you use MV. In this case the code should be the same, but it's best to not have contradicting information out there.

As an example, paste the below into a text editor, save as a *.js file, include as a plugin.
Code:
Game_Unit.prototype.randomTarget = function() 
{
    let tgrRand = Math.randomInt(100);
    let target = null;
    let chance = 50;
    for (i = 0; i < this.aliveMembers().length; i++)
    {
        if (tgrRand >= chance || i == this.aliveMembers().length - 1)
        {
            target = this.aliveMembers()[i];
            break;
        }
        chance /= 2;
    }
    return target;
};
That starts with the party leader having a 50% chance to be targeted and halves it for each successive party member.

If possible, I'd also like to allow the player to swap party member positions during combat.
I've never seen this. I've seen Yanfly's plugin to swap party members in and out of the reserve, but not to change the order.

As far as I know, you'd have to request/commission a new plugin that provided some interface for you to do it. You could alternately do it as a skill and use action sequences to have the skill call an event with a choice window and go from there...
It would be pretty simple to rewrite the targeting algorithm so that order plays a greater part instead of the target rate.

Is this supposed to be for MZ or MV? You posted in MZ support, but your profile says you use MV. In this case the code should be the same, but it's best to not have contradicting information out there.

As an example, paste the below into a text editor, save as a *.js file, include as a plugin.
Code:
Game_Unit.prototype.randomTarget = function()
{
    let tgrRand = Math.randomInt(100);
    let target = null;
    let chance = 50;
    for (i = 0; i < this.aliveMembers().length; i++)
    {
        if (tgrRand >= chance || i == this.aliveMembers().length - 1)
        {
            target = this.aliveMembers()[i];
            break;
        }
        chance /= 2;
    }
    return target;
};
That starts with the party leader having a 50% chance to be targeted and halves it for each successive party member.


I've never seen this. I've seen Yanfly's plugin to swap party members in and out of the reserve, but not to change the order.

As far as I know, you'd have to request/commission a new plugin that provided some interface for you to do it. You could alternately do it as a skill and use action sequences to have the skill call an event with a choice window and go from there...
i see... this is helpful, thanks

also, I just started using mz today! i should probably update my profile
you can do the same without plugin by using states and troop events.

just have different states for increasing target rate and/or other traits, then apply them to the actors based on position in batle with a troop event on turn 0 and all following turns.

Original thread: https://forums.rpgmakerweb.com/threads/party-order-that-matters-in-combat.171718/