MV Action Times+ Modified, but Issue with Enemy Actions

I am hoping to change how the Action Times+ trait functions.

I simply want it to grant an extra action for EACH time the Action Times+ is added to the traits on an enemy, etc.

So, if the enemy has...

Action Times+ : 100%
Action Times+ : 1%
Action Times+: 52%

Then, I still want it to grant them three extra actions without fail. If it's easier to just require 100% each time, that's fine too.

JavaScript:
Game_Battler.prototype.makeActionTimes = function() {
    return this.actionPlusSet().reduce(function(r, p) {
        return Math.random() < p ? r + 1 : r;
    }, 1);
};

This is where I assume this change would take place, I am just not fully understanding what is making it do what it does, which is grant a diminishing return on the trait.

EDIT: It seems as though this code below works fine for what I was asking. Onto a new problem...

JavaScript:
Game_Battler.prototype.makeActionTimes = function() {
    return this.actionPlusSet().reduce(function(r, p) {
        return 0 < p ? r + 1 : r;
    }, 1);
};

So now that I have an enemy that has x amount of actions, I want certain ones to only be used once during the turn out of those x actions. I've set a skill that requires that a switch be ON. I set this switch to ON before the battle begins. Using that skill turns that switch OFF using an Action Sequence in Yanfly's plugin, making it so he should not use it again. He still uses this same move for every single action in the turn because it has the highest priority (9).

I assume it's because the condition to use the skill was fulfilled at the start of the turn, and therefore ignores the condition on subsequent actions. However, Yanfly's BattleAICore should allow for dynamic actions on the fly (which is already set to true). I'll go over the notetags used in every part of this.

The enemy has the notetag:
JavaScript:
<AI Level: 100>

The skill has the following action sequence:
JavaScript:
<setup action>
change switch 102: off
clear battle log
display action
face user: targets
animation 880: user
wait for animation
</setup action>
<target action>
clear battle log
action animation: target
wait for animation
action effect: targets
</target action>
<finish action>
perform finish
face user: targets
face targets: user
</finish action>

Lastly, the enemy's skills list has the above skill set to be used only when Switch 102 is ON (it is turned on before the battle begins, remember). The action sequence of the skill itself should be turning the switch OFF immediately, but every extra action afterwards is still this same skill.

So, what I'm looking for now is a way to make enemies re-evaluate what they can use out of their list of actions before using EACH action, and select one that has its condition still fulfilled.
He still uses this same move for every single action in the turn because it has the highest priority (9).
Question: Why are you still using the default enemy behavior system instead of Yanfly's Battle AI Core?
It gives you more control over enemy actions based on conditions & various other factors. Way better than the default 'Priority' system. And, its part of his Free Starter Pack Essentials Bundle so its not paywalled 🙂
Question: Why are you still using the default enemy behavior system instead of Yanfly's Battle AI Core?
It gives you more control over enemy actions based on conditions & various other factors. Way better than the default 'Priority' system. And, its part of his Free Starter Pack Essentials Bundle so its not paywalled 🙂
For this particular enemy, there are only three possible actions, so I didn't feel the need to run all the notetags to determine how often to use the other skills, but I will try going that route now and see if it corrects this issue. So let's see...

Setting any AI Priority tag on the enemy causes the change I made to Action Times+ to no longer work (the enemy only takes one action per turn despite having multiple Action Times+ traits).
I assume it's because the condition to use the skill was fulfilled at the start of the turn, and therefore ignores the condition on subsequent actions. However, Yanfly's BattleAICore should allow for dynamic actions on the fly (which is already set to true). I'll go over the notetags used in every part of this.
All that the Yanfly dynamic actions does is change when the actions are chosen. Instead of choosing at the beginning of the round, it chooses them when the enemy's turn to act comes up.

It does not change the code for how that actual decision process is done, which chooses all of the actions at once - because they're chosen at once, nothing you do with action sequences or switches matters, since the choice is done before any skill resolves.

So what you need to do is:
1) find the code that chooses the actions and make it only choose one
2) add a method to track how many actions the battler has taken this turn
3) add a function that checks after the resolution of an action whether that battler should take more
4) call that first choosing function again
Got it, I'll see what I can come up with. 😀

Original thread: https://forums.rpgmakerweb.com/threads/action-times-modified-but-issue-with-enemy-actions.140310/