MZ Multiple Actions Breaking Skill Priority

Hi everyone,
I have a skill for one of my characters that has max invocation speed (priority) and reduces damage to the party for one turn, basically like a full party guard. The problem I'm having is that I also have a few skills and accessories that have a chance to grant extra actions on a turn, and when trying to use this skill with an extra action, it removes the priority effect. If you use the skill for both of your actions it still works as intended, but effectively doubles the mana cost. What I'm looking for is a way to keep the skill priority working when used with extra actions that don't have priority. If it ends up giving the second action priority that isn't supposed to have it, that's fine, but ideally the first action would have priority and the second would be used normally based on AGL. I found a thread from about a decade ago with the same issue, but it didn't seem to have any answers. Any help would be appreciated. Thanks!
If you want all actions arranged I think you'd need a bigger edit, but if you just want a battler with a fast action to act early, I think you can change this method (copy paste to notepad, save as .js file and add as plugin). So instead of acting according to lowest speed action, they act according to highest speed action (the speed value here means something that accounts for agi too).

Game_Battler.prototype.makeSpeed = function() {
// this._speed = Math.min(...this._actions.map(action => action.speed())) || 0;
this._speed = Math.max(...this._actions.map(action => action.speed())) || 0;
};
Maybe you can try this:

Tell me if you encounter any problem.
Maybe you can try this:

Tell me if you encounter any problem.
Seems to work great, thank you!
If you want all actions arranged I think you'd need a bigger edit, but if you just want a battler with a fast action to act early, I think you can change this method (copy paste to notepad, save as .js file and add as plugin). So instead of acting according to lowest speed action, they act according to highest speed action (the speed value here means something that accounts for agi too).

Game_Battler.prototype.makeSpeed = function() {
// this._speed = Math.min(...this._actions.map(action => action.speed())) || 0;
this._speed = Math.max(...this._actions.map(action => action.speed())) || 0
I think TG22's plugin is more what I was looking for, but I appreciate you doing this!

Original thread: https://forums.rpgmakerweb.com/threads/multiple-actions-breaking-skill-priority.182814/