Enemy state check?

I'm trying to make a mechanic where a character puts an explosive on an enemy. After it's placed, hitting the enemy with any fire attack makes it explode and deal damage on top of the fire attacks damage.


I started by making a skill that inflicted a state, but I have no idea where to go from here. I've tried making a common event that checks for the state, but It only lets me check for the state on a specific enemy in the troop rather than just the one I'm targeting. Is there a simple solution I'm too stupid to see or would this require a plug in?


Thanks in advance.
In your damage formula:

Code:
b.isStateAffected(id)

where id is the state id (no leading zeros), will return true if the target has that state, and false if it doesn't.  Obviously that will not be the whole damage formula.
In your damage formula:

Code:
b.isStateAffected(id)

where id is the state id (no leading zeros), will return true if the target has that state, and false if it doesn't.  Obviously that will not be the whole damage formula.

Ok, I tried this  using this as my formula


10 + if(b.isStateAffected(17)) 100 + a.mat * 2 - b.mdf b.removeState(17) ; 0


but now my attack is doing normal damage when the state isn't applied, but  0 damage when the state is applied. What am I doing wrong?
Do you ever want it to be 0? if not take out the 0 at the end


if (b.isStateAffected(17)) {100 + a.mat * 2 - b.mdf; b.removeState(17)} else {10}


and make sure your math in the middle is working in the right order you want.
Do you ever want it to be 0? if not take out the 0 at the end


if (b.isStateAffected(17)) {100 + a.mat * 2 - b.mdf; b.removeState(17)} else {10}


and make sure your math in the middle is working in the right order you want.

Alright. I used this code exactly, I still did the 10 damage without the state, but 0 with it. When I took out the "b.removeState(17)" part, I did the increased damage. Maybe it's removing the state before the attack can finish and that's causing a problem?
Alright. I finally got it to work. (I just used the "effects" menu to remove the state instead of using the formula)


Thanks for your help, both of you 🙂

Original thread: https://forums.rpgmakerweb.com/threads/enemy-state-check.63864/