MV State chance when using action effect more than once

1754131881095.png


When using action effect, it will give a double action, including buff and debuff

For buff and debuff, there's a add command to do it, but how to make it add buff when the it's not miss?
For state also have it, but how to make it apply state with a chance of certain percentage?

I was using YEP Action Sequences

Edit:
Additional question, how to make buff/debuff/state apply only once even multiple action effect occurs?
For buff and debuff, there's a add command to do it, but how to make it add buff when the it's not miss?
Are you saying that you want the skill to buff the user and debuff the target, but the buff should happen even if it misses and the debuff requires it to hit? Since you're already using AS, you can just use the command and specify the user
1754142250445.png


For state also have it, but how to make it apply state with a chance of certain percentage?
Use an IF statement and have the state be the result of the check or just use the engine's built in effects and itll run any time the action effect is triggered

Code:
if Math.random() < .80
  add state 42: target
end
Are you saying that you want the skill to buff the user and debuff the target, but the buff should happen even if it misses and the debuff requires it to hit? Since you're already using AS, you can just use the command and specify the user
This one cause the debuff keep applied even all the attack missed, maybe I go enhance the plugin to apply only when enemy get hit at least once
1754180619169.png


Use an IF statement and have the state be the result of the check or just use the engine's built in effects and itll run any time the action effect is triggered
ah I once using this and didn't work, maybe I use a wrong logic. This one works well

But the issue still same regarding if it's hit the enemy or all miss

Most of issue pretty much solved since I didn't mention any double apply buff and state when multiple action effect used in first place. Probably I'll enhance a bit from yanfly plugins, or ask again in another thread

Thank you for the answer! I'll close it for now and open another thread if necessary
This one cause the debuff keep applied even all the attack missed, maybe I go enhance the plugin to apply only when enemy get hit at least once
It depends on what specifically you want. Anything done within the effects box will be done to the target if the skill hit, so if there's a thing you want done to the target and requires a hit, put it there.
1754183511026.png

Within an AS, you can specify effects to go on either the user or the target, but anything done in an AS will be done regardless of if the skill hit or not. At that point, you will need to use an IF statement after the action effect command to see if the skill hit and to do the AS effects if it did.
Code:
if target.result().isHit()
  add state 42: user
end
It depends on what specifically you want. Anything done within the effects box will be done to the target if the skill hit, so if there's a thing you want done to the target and requires a hit, put it there.
I might explain more detail, it's more like
  1. A skill that has 4 action effect
  2. If between action effect has at least 1 isHit(), apply debuff/state. Otherwise, no apply
Like example
action effect (miss)
action effect (miss)
action effect (hit)
action effect (miss)

since on 3rd try enemy got hit, debuff/state will be applied

but this one looks simpler than what I want to do in plugins
Within an AS, you can specify effects to go on either the user or the target, but anything done in an AS will be done regardless of if the skill hit or not. At that point, you will need to use an IF statement after the action effect command to see if the skill hit and to do the AS effects if it did.
thanks a lot! now it works perfectly

I was doing like this for testing
Code:
<setup action>
   clear battle log
   display action
   eval: SceneManager._scene._logWindow.addText("<CENTER>\"Come!\"")
   opacity user: 0%
   animation 128: user, mirror
   wait for animation
   immortal: targets, true
</setup action>

<whole action>
   animation 157: user, mirror
   wait: 176
   action effect
   if target.result().isHit()
      eval: target.applyEffect = true
   end
   action effect
   if target.result().isHit()
      eval: target.applyEffect = true
   end
   action effect
   if target.result().isHit()
      eval: target.applyEffect = true
   end
   wait: 6
   action effect
   if target.result().isHit()
      eval: target.applyEffect = true
   end
   action effect
   if target.result().isHit()
      eval: target.applyEffect = true
   end
   action effect
   if target.result().isHit()
      eval: target.applyEffect = true
   end
   wait: 6
   action effect
   if target.result().isHit()
      eval: target.applyEffect = true
   end
   action effect
   if target.result().isHit()
      eval: target.applyEffect = true
   end
   action effect
   if target.result().isHit()
      eval: target.applyEffect = true
   end
   action effect
   if target.result().isHit()
      eval: target.applyEffect = true
   end
   if target.applyEffect
      add hp debuff: target, 5
      eval: target.applyEffect = false
   end
   immortal: targets, false
   wait for animation
</whole action>

<target action>
</target action>

<finish action>
   clear battle log
   opacity user: 100%
   motion standby: user
</finish action>

this one works as intended
You got it working so you could leave it there if you like, but as a suggestion for later skills - You could have cut down out most of that by using Serge's loop extension or by using Yanfly's skill core's <Post-Damage Eval> notetag to set that applyEffect property automatically on any successful hit and only check for it at the end, or by using both plugins.

In any case, the issue has been solved. I'll be closing the thread now. No need for another report unless you want to re-open it for any reason

Original thread: https://forums.rpgmakerweb.com/threads/state-chance-when-using-action-effect-more-than-once.179316/