How to change turn order to be random?

Hi, I was just curious how I could change turn order to be completely random every turn. I've tried making AGI stats equal on both sides but it still is not random. Is there any way I can make the game use just a dice roll to determine the turn order each turn?

Thanks! Hope I posted in the right spot!
By default battle is arranged in phases: there's the "input phase" where you select your skills or whatever, then the "action phase" when actors/enemies use the skills they've chosen. Turn order only affects this "action phase". Are you looking at the input phase? 😅

It looks like it should be random if the following are equal for all battlers:
  • Battler agility (i.e. AGI base param), and
  • Action speed, configurable on the skill/item's page in the database.
(Note that the default skill 2, Guard, has 2000 speed.)

Turn order is determined by sorting battlers based on action speed (the one with the fastest action gets to go first). However, due to potentially-low precision in the randomness (integer from 0~4) the number of possible permutations for an equal-agi-equal-speed situation can be limited.
Spoiler: Supporting code excerpts (technical)
Code:
BattleManager.makeActionOrders = function() {
    var battlers = [];
    if (!this._surprise) {
        battlers = battlers.concat($gameParty.members());
    }
    if (!this._preemptive) {
        battlers = battlers.concat($gameTroop.members());
    }
    battlers.forEach(function(battler) {
        battler.makeSpeed();
    });
    battlers.sort(function(a, b) {
        return b.speed() - a.speed();
    });
    this._actionBattlers = battlers;
};

Game_Battler.prototype.makeSpeed = function() {
    this._speed = Math.min.apply(null, this._actions.map(function(action) {
        return action.speed();
    })) || 0;
};

Game_Action.prototype.speed = function() {
    var agi = this.subject().agi;
    var speed = agi + Math.randomInt(Math.floor(5 + agi / 4));
    if (this.item()) {
        speed += this.item().speed;
    }
    if (this.isAttack()) {
        speed += this.subject().attackSpeed();
    }
    return speed;
};
If the precision is the issue, then something like this will likely solve it~
Code:
// random turn order: ignores battler agility & action speed values
Game_Battler.prototype.makeSpeed = function() { this._speed = Math.random(); };
To try it out, just save as a .js file (Save As > File Type: All Files, Filename: whateverYouLike.js) and import as a plugin. 🙂

[Edit: or grab the attached file!]
So I can just download this .js and put it in the game and it will createa random turn order? Or do i need to edit it with values in the parentheses?

EDIT: Also thank you very much.

ADDITIONAL EDIT: Also should i set my AGI params to 1 for this .js to function properly?
Yep! It should just be plug-and-play, no configuration needed. 🙂

Edit @SesameChicken: I think this little plugin should make it so that agility and speed are totally ignored when calculating action speeds / turn order, so you should be able to have the agi set to whatever you like~

And you're welcome! 🙏 Hope it solves the problem. 😅
Works amazing will credit. Thank you so much.
Maybe while I have you is there anyway I could make one enemy with a chance at 4 random skills? Just a single enemy with chance at any skill
in my database in 4 slots. I know that's probably more complex.
Great! And yea, that's really quite a different question. I notice you made a thread for it over here, though, so will answer there if need be~
https://forums.rpgmakerweb.com/index.php?threads/how-to-create-an-enemy-with-random-skills.115645/ 🙂

Original thread: https://forums.rpgmakerweb.com/threads/how-to-change-turn-order-to-be-random.115608/