(Solved) Recalculate Turn Order After Every Action

When an enemy is hit with a move that reduces their AGI, I want the remaining turn order to be recalculated to reflect that.

This is for the default turn based battle system.

What is the simplest way of doing this?
The default battle engine calculates the turn order for a single round based on the AGI of each battlers at the start of that round if I'm not mistaken (it has been a long while since I used the default battle system). Therefore, you'll need a plugin to modify that logic.

I've moved this thread to JS Plugin Requests. Thank you.

The default battle engine calculates the turn order for a single round based on the AGI of each battlers at the start of that round if I'm not mistaken (it has been a long while since I used the default battle system). Therefore, you'll need a plugin to modify that logic.
Moved to: JS Plugin Requests
Ok Thank you
//This was edited by Ammon

BattleManager.getNextSubject = function() {

// this part re-sorts the actions by Speed incase anything changed
this._actionBattlers.forEach(function(battler) {
battler.makeSpeed();
});
this._actionBattlers.sort(function(a, b) {
return b.speed() - a.speed();
});
// Ammon edit stop

for ( ; ; ) {
var battler = this._actionBattlers.shift();
if (!battler) {
return null;
}
if (battler.isBattleMember() && battler.isAlive()) {
return battler;
}
}
};
@ginfubawuba You can't delete posts, only moderators can do it. If you really want to delete a post, you can report your post and ask for a moderator to do it.

Also, please avoid double posting as it is against the forum rules. Double posting means posting when the latest post in a thread is your own. Instead, edit your latest post to add any missing information. No need to delete your latest post though, just keep that rule in mind for the future.

I'll close this thread since you've marked it as solved, but editing the title won't notify a moderator. In the future, if your thread has been solved you can report your thread (report button at the bottom of any of your posts, besides the "edit" button) and ask for it to be closed.

This thread is being closed, due to being solved. If for some reason you would like this thread re-opened, please report this post and leave a message why. Thank you.

Original thread: https://forums.rpgmakerweb.com/threads/solved-recalculate-turn-order-after-every-action.118626/