I am working on a skill that will take off 20% of the target's current hp. Just this alone is easy, but I also want to prevent this skill from working on certain enemies (like bosses). I have the following in the damage formula for the skill:
if !(b.isStateResist(42)); b.hp/5; end;
Where the skill checks if the target resists the state or not to prevent the skill from taking off 20% of the target's current hp if it resists. If the target does not resist the state (which in my case is state 42), then the target takes 20% damage of its current hp. Otherwise, the skill does no damage.
It is not working however, and I am not sure why. Any ideas? Using VXA
conditional damage skill
● ARCHIVED · READ-ONLY
-
-
You say you use VXA, but that syntax looks like MV to me (no idea if it is, but it looks like common JS syntax).
You should try this instead:
Code:This does the same thing you wanted, but it's using the correct VXA check, and I shortened the code a bit.b.state_resist?(42) ? 0 : b.hp/5 -
Works great. Thank you. I had used other syntax before in vxa and it worked ok. But maybe not always? The other skill I used using this type of syntax was a skill that would kill you if your level was a multiple of 5.
if (b.level % 5 == 0); b.add_state(1); end;
And it seemed to work. However, if the target has a resistance to state 1 (death) would it cease to work? I have already tried b.setHp(0); instead of b.add_state(1); , but it doesn't work. Probably the syntax I am assuming?
So in VXA syntax I am thinking it would be
b.level % 5 == 0 ? b.setHp(0) : 0
But I tried that and it didn't work. b.add_state(1) works, but if the target has a state % rate of the death state failing, wouldn't it prevent the skill from working? I was thinking b.setHp(0) might bypass any sort of state % rate to the death state failing -
Where do you get those code bits (b.setHP(0) and b.isStateResist(42))? You seem to be pulling out MV code, and that won't work in VXA, they use entirely different coding languages. Not talking about the if - end parts, those can work, I just like shorter syntax in damage formulas, since that box is very small. Just note that the damage formula expects a numeric value at the end, so if it doesn't get any, there might be issues.
In VXA, you would do something like this:
Code:This would simply take all HP the target has if it's level is a multiple of 5. You can also use b.mhp if you want the damage to be equal to the targets maximum HP instead (in case you want to show that damage value instead of the current HP).b.level % 5 == 0 ? b.hp : 0
I have no idea if it will work on targets with KO state resistance, though, never really tested that situation. -
Okay. Thank you so much. I guess when researching damage formulas I accidentally found MV code and didn't know it at the time.