MV Fixed Turns in Combat

Hello everyone, this is my first post, I hope I'm in the clear, if not, let me know. Also, English is not my first language so bear with me while I try to explain myself, he he.

I'm currently working on my own RPG, and I'm establishing the basis of its systems. For the combat I want to reduce the RNG as much as possible, and so far I haven't found a proper solution for the turn's order.

— I want to take away “the variation” part in the turn's calculation. I thought to use a borrowed script to add a plugin that erases that part, but I'm unable to make it work (the turns still mix up). Here I leave the script:

[ISPOILER]
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;

};[/ISPOILER]

The crossed text is what I deleted, then saved it as a .js, added it to the plugins' folder, and enabled it in the plugin window.

I don't know if it is even possible to make it work this way, I'm not a programmer or anything like that, but I got other plugins working similarly, and I thought this could work. Maybe the script itself is flaw or the way I implemented is not the correct one.

That's why I'm here searching for your never-ending wisdom.
Hey,

The script itself looks okay to me.

Make sure you save your project after you made changes to the plugin list, or those changes will not be reflected in game (test play or battle test).

If you are using test play or battle test, you can press F8 in game to open the developer console. Check if there are any error messages regarding your plugin.

If there are not, try typing Game_Action.prototype.speed into the console and see if the result is the version from your plugin.

Just to be sure since the formatting seems broken, but the code should look like this:
JavaScript:
Game_Action.prototype.speed = function() {
    var agi = this.subject().agi;
    var speed = agi;
    if (this.item()) {
        speed += this.item().speed;
    }
    if (this.isAttack()) {
        speed += this.subject().attackSpeed();
    }
    return speed;
};
Thank you @Another Fen, indeed is great advice to always save and check that your changes are being applied, and now I fixed the issue by remembering that did add the plugin but did not turn it on haha... so it works now.

Also, the F8 stuff is fascinating and useful for future progress in the game. Thank you.

Original thread: https://forums.rpgmakerweb.com/threads/fixed-turns-in-combat.178244/