How to stop Confusion from skipping first enemy turn?

On the turn where I use a Skill to apply Confusion to an enemy, that enemy skips their turn and lets me move again. I want them to attack a random target on the same turn they get inflicted by Confusion. How do I make this happen?
Hi there Millennin,

I did not test this but you could add this in the formula box of the skill that applies confusion:

if b.state?(Y) b.force_action(1, -1); Xwhere Y is your "Confusion" state ID and X is the skill damage formula.

This way if the enemy is not confused it is forced to attack a random target with a basic attack, if the enemy is confused then the skill only applies the damage formula.

I hope I understood what you need.

EDIT: note that this only works if your skill applies confusion with 100% chance. If your skill has a different chance then you should do somthing different. Let me know if this is your case and I'll write you the longer formula.
Hi there Millennin,

I did not test this but you could add this in the formula box of the skill that applies confusion:
Thanks for helping again. I just tried the formulae in your post, but it gave me a SyntaxError.

"unexpected tIDENTIFIER, expecting keyword_then or ';' or '\n' if b.state?(5) b.force_action(1, -1); 0"
Yes, it seems I made few mistakes there.  :distrust:   This is the correct one:

b.state?(Y) ? X : (b.force_action(1, -1); X)Y is always your "Confusion" state and X is your damage formula. You can also use:

X=damage_formulabefore that formula. This way you have to write less characters. Note that this is still untested.

I forgot to add and "end;" before the skill formula and I also wrote something you don't need...that way you were going to force the attack only if the target was confused. We want him to attack if he is not confused then become confused. I am sorry for that mistake...
Hmmm, the formulae doesn't crash this time, but for some reason the enemy is still not doing anything on the turn I cast the spell on it. Could it be because Confusion gets applied after the formulae takes place?
Hmmm, the formulae doesn't crash this time, but for some reason the enemy is still not doing anything on the turn I cast the spell on it. Could it be because Confusion gets applied after the formulae takes place?
I find it hard to belive since the formula

b.state?(Y) ? X : (b.force_action(1, -1); X)actually says

Is the target afflicted with confusion? if yes inflict damage; if no then force an action against a random target and then inflict damage to the target.

What is possible is the contrary: if confusion is applied before we check target state then there is no chance of forcing the action. Anyway you can solve this in two different ways (one is sure, the other needs to be tested).

  • Sure option: create a new skill called Attack_BeforeConfusion and copy there the content of Attack's formula box (or another formula if you want the enemy to use a different skill). Add the following at the beginning of that skill formulaa.add_state(Y);where Y is your confusion state. That's how your formula should look like.

    a.add_state(Y); damage_formulaNow remove the "add confusion" from the skill you want to inflict confusion and copy this formula into its formula box.

    b.state?(Y) ? X : (b.force_action(N, -1); X)N is the skill ID of the new skill you created (Attack_BeforeConfusion).

  • Other option (needs to be tested): if confusion is applied before damage calculation then you should change your formula to

    b.state?(Y) ? (b.force_action(1, -1); X) : Xand it should work.

The 1st option will work for sure since the enemy will self-apply confusion only when it attacks. The only thing you should take care of is player speed. To let it work player MUST attack before the enemy you want inflicted with confusion. I suggest to add a speed modifier to your confusion skill (which now does not apply confusion) so you can attack before the enemy.

EDIT: note that if confusion is applied before damage calculation, using the

b.state?(Y) ? (b.force_action(1, -1); X) : Xwill force the enemy to attack a random target. I presume (assuming this formula will work) it could also attack another enemy since it is a valid random target. This one is just an idea, I did not test it so I am absolutely not sure about it.
It's very strange, but even when I change the formulae to b.force_action(1, -1), effectively removing the conditional branch, the enemy still does nothing on the turn Confusion is applied by the Skill.
Try the 1st option as I said in my previous post. That one is tested and works for sure.
Now I'm very confused. I put in your first formulae, like this:


Confusion.png



But this is what it does in combat:


https://www.youtube.com/watch?v=Kw6UDbyr3Ok
Ok, don't worry, we will figure it out. First of all create a new skill called "Self Confusion" (I will call it with ID 235, change it if you don't want to create it there).

Once you created it put this in the damage formula:

a.add_state(5); damage_formulawhere "damage_formula" is the basic attack formula.

After doing this modify your "Disorientation" skill to be like this:

X=dmg_formula; b.state?(5) ? X : (b.force_action(235, -1); X)#You can do this setting X value equal to the damage formula or you can just write your formula#instead of using X.#You won't have characters limit problem with this formula so it is a matter of tasteb.state?(5) ? dmg_formula : (b.force_action(235, -1); dmg_formula)Note that you "Disorientation" skill should ONLY do that. No confusion should be applied in the effect tab. Leave the effect tab EMPTY.

Doing so forces the enemy to react to your "Disorientation" skill with the "Self Confusion" skill. So it will attack the same turn he is inflicted with confusion.

As I said this way is tested and works fine (at least in a fresh project).
That's amazing, lol, it worked. 😀 Thanks a lot for helping once again. I finally finished all the skills for the characters, so maybe there won't be like 10+ topics asking simple questions from me for a while now. 🙂

Original thread: https://forums.rpgmakerweb.com/threads/how-to-stop-confusion-from-skipping-first-enemy-turn.45817/