# Element Rate Problem

#### Sanquil

##### Warper
So, in my current project, I've designed an skill, Stitch Up, that deals damage in it's own unique element, Torn. All enemies have a 0% Rate to torn because the skill is supposed to be a follow up kind of attack that only works if the Torn State is applied to the target. I've set the Torn State to have Element Rate: Torn * 100%. I get the message saying "*Enemy*'s soul was reassembled" so I know the skill worked, but the enemy took no damage. I've made sure that the Torn State is applied every time. What am I doing wrong and how can I fix it?

#### Poryg

##### Dark Lord of the Castle of Javascreeps
The enemy's rate is 0%. 0% means immunity.

#### shockra

##### Slightly Crazy Programmer
The state doesn't overwrite the trait the enemy already has. It accounts for both, meaning it reads the rate as 0% * 100%, which is still zero.

You need an if statement to make this work. This can be done in the damage formula. I think it's something like this:

b.isStateAffected(Torn ID State) ? damage effect : 0

Replace Torn ID State with the ID of the state you're checking for (keep the parentheses), and replace damage effect with the formula for that attack. 0 occurs if the condition is false.

#### Kes

##### Veteran
That code is for MV and this is Ace.

If no one has given the correct formula by the time I'm back on my computer, I'll edit this post with it.

EDIT
if b.state?(x); a.atk * 4 - b.def * 2; end; 0

where x is the ID number of the state 'Torn'. Change the a.atk * 4 - b.def to whatever damage formula you want.

Last edited:

### Latest Profile Posts

My ex put my heart upon a self he said don't give me no lines and keep my hands to myself :,(
An Old... old Harold | RPG Maker News #71

Did a test on myself and I was negative on COVID. I was sitting near my aunt the whole time while doing stuff.
Colored!
RPG Maker Games Critique with Studio Blue starts now! Join us and follow along live as we explore A Thief's Voyage by walldeaf.