MV Issue with Action Speed using Yanfly AI Core

Hello!

I'm stumped and out of ideas. Wondering if anyone encountered this behavior before...

I'm using Yanfly AI Core to control battlers.

I've set the action speed this way, so to simulate battle phases:
* Guarding (+2000)
* Healing Skills (+1500)
* Buff / Debuff (+1000)
* Attack skills (+500)
* Base Attack (0)

The actors seem to follow the invocation speed, but some of the enemies simply ignore the invocation speed and can start attacking right at the beginning of the turn, before anyone guarding or casting.

I thought that there was perhaps a bug with the game, so I've removed the action speed value and added the notetag <speed: +xx> for each skill. That didn't fix it.

So I thought maybe it because I've turned ON the Dynamic Action, but turning that to FALSE did not work either.

I have cleaned up pretty much all of the Enemy's notebox, and they can still attack before anyone else, so I do not think it's something to do with the coding of my AI. I'll provide it here below just in case.

Any help, ideas or pointers would be appreciated.

Spoiler
Code:
<Sideview Battler: mh_yyrsh_warrior>
<Weapon Image: Axe2>
<Weapon Motion: swing>
<AOE Hitbox Width: 1>
<AOE Hitbox Height: 1>
<Default Row: 1>

// DROPS
<Conditional Health Potion Drop>
    Variable 41 > 0: +20%
</Conditional Health Potion Drop>
<Conditional Energy Potion Drop>
    Variable 42 > 0: +10%
</Conditional Energy Potion Drop>
<Conditional Rejuvenation Potion Drop>
    Variable 43 > 0: +5%
</Conditional Rejuvenation Potion Drop>

<AI Consider Taunt>
<AI Priority>

    // Throw everything at target under Marked for Death
    State === Mark: Brutality, Highest MaxHP
    State === Mark: Rage, Highest MaxHP
    State === Mark: Attack, Highest MaxHP

    // Potions
    User HP% param <= 25%: Rejuvenation Potion, User
    User HP% param <= 50%: Health Potion, User
    User MP param < 5: Energy Potion, User

    // Rejuvenation
    User HP% param <= 40% +++ User MP param < 10: Rejuvenation Potion, User

    // No more potion, guard to regain MP
    User MP param < 5: Guard, User

    // Buff
    Random 40% +++ State !== Endure: Endure, User

    // Random Attack
    Random 50%: Brutality
    Always: Rage

    // Attack
    Always: Brutality
    Always: Rage
    Always: Attack

</AI Priority>
I did some pretty extensive testing and, contrary to my initial belief, I found out that the two following lines in the enemy notebox are the ones causing the weird attack-before-anyone-else behavior:

// Buff
Random 40% +++ State !== Endure: Endure, User

// Random Attack
Random 50%: Brutality

The common denominator here seems to be the parameter "Random". If I was a betting man, I would say that this is probably the reason.

I will do more testing and report back.
[EDIT] Seems the problem persists even though I thought I had found all the triggering causes. Will keep digging...
Extensive testing shows that there's a lot of factors triggering this problematic behavior. That being said, switching Dynamic Action in Battle AI Core seems to be the proper solution.

This thread can be closed.

Original thread: https://forums.rpgmakerweb.com/threads/issue-with-action-speed-using-yanfly-ai-core.125641/