Removing State when hit by certain element 100% of the time.

Hi,
My question is fairly obvious by the title. Basically, I'm trying to recreate a battle system I designed in MV, that is heavily reliant on applying elemental based-status effects and then doing combos with other elements (sort of similar to how Genshin Impact handles they're elements). In MV, I used Yanfly's Buffs and States core to make a custom react effect with this notetag:

Code:
<Custom React Effect>
var fire = 3;
if (this.isHpEffect() && value > 0) {
   if (this.item().damage.elementId === fire) {
     target.removeState(stateId);
   }
}
</Custom React Effect>

(I think I got this from another forum post by someone else) I can't seem to find a way to recreate this with the Visustella plugins in MZ, and was hoping someone could help me. If you need me to explain how this notetag works let me know and i can break it down.

Thanks,
Spak

(I've also tried using the FOSSIL plugin and then putting YEP_BuffStatesCore into MZ but that didn't work either unfortunately.)
The necessary tags are in the documentation for VisuStella's Battle Core: <JS Post-Damage as Target>
The necessary tags are in the documentation for VisuStella's Battle Core: <JS Post-Damage as Target>
Sorry for the late reply I guess email notifications weren't checked/working, didn't actually know that existed (somehow that was the only plugin i didn't think to check). In theory that should work but for some reason it just straight up doesn't. Not really sure why that is, my only thought is that maybe one of the terms changed in MZ any ideas which it could be? I'm not entirely sure where they would be defined in the code, I'll look on my own time though.

Edit: I actually found and confirmed that none of the objects changed, so I'm really unsure what the issue is now. Could be a plugin thing but I doubt it, will test anyways.
Are you just pasting in the code that you had before? One of the many tricks with VisuStella code is that, since it's obfuscated, it's not simple to just check the code and see what the parent of a given method is - that means it's hard to anticipate what "this" will refer to.

So you might try target.result().hpAffected for the first check, just to see if it starts registering. Then you can worry about checking for fire damage, or someone more familiar with the VisuStella suite might have a suggestion.
Hi,
My question is fairly obvious by the title. Basically, I'm trying to recreate a battle system I designed in MV, that is heavily reliant on applying elemental based-status effects and then doing combos with other elements (sort of similar to how Genshin Impact handles they're elements). In MV, I used Yanfly's Buffs and States core to make a custom react effect with this notetag:

Code:
<Custom React Effect>
var fire = 3;
if (this.isHpEffect() && value > 0) {
   if (this.item().damage.elementId === fire) {
     target.removeState(stateId);
   }
}
</Custom React Effect>

(I think I got this from another forum post by someone else) I can't seem to find a way to recreate this with the Visustella plugins in MZ, and was hoping someone could help me. If you need me to explain how this notetag works let me know and i can break it down.

Thanks,
Spak

(I've also tried using the FOSSIL plugin and then putting YEP_BuffStatesCore into MZ but that didn't work either unfortunately.)
Is 3 definitely the ID of your fire element in the MZ database? In the default, it's 2.

Also stateId is no longer a thing in VS. The equivalent is state.id
So you might try target.result().hpAffected for the first check, just to see if it starts registering. Then you can worry about checking for fire damage, or someone more familiar with the VisuStella suite might have a suggestion.
Thanks for the info, I know basically nothing about how the VisuStella system works ha ha.
Is 3 definitely the ID of your fire element in the MZ database? In the default, it's 2.

Also stateId is no longer a thing in VS. The equivalent is state.id
I really should have changed that variable name in the code (I think it was a leftover from wherever I got the code from for MV), that variable actually just refers to the element that removes the current state, so for the code I posted 3 is the ID for the Water element, meaning Water beats Fire (as it usually does).

Thanks for that info about state.id I didn't know that.

Here is the revised code:
Code:
<JS Post-Damage as Target>
var douse= 3;
if (target.result().hpAffected())
{
   if (this.item().damage.elementId === douse)
   {
     target.removeState(state.id);
   }
}
</JS Post-Damage as Target>

I've changed var fire to var douse to make it a bit more clear on my intentions with it. Currently it is still not working, what else would I need to change? I'll keep plugging away at it in the mean time.

Thanks again for the helpful responses!
Thanks for the info, I know basically nothing about how the VisuStella system works ha ha.

I really should have changed that variable name in the code (I think it was a leftover from wherever I got the code from for MV), that variable actually just refers to the element that removes the current state, so for the code I posted 3 is the ID for the Water element, meaning Water beats Fire (as it usually does).

Thanks for that info about state.id I didn't know that.

Here is the revised code:
Code:
<JS Post-Damage as Target>
var douse= 3;
if (target.result().hpAffected())
{
   if (this.item().damage.elementId === douse)
   {
     target.removeState(state.id);
   }
}
</JS Post-Damage as Target>

I've changed var fire to var douse to make it a bit more clear on my intentions with it. Currently it is still not working, what else would I need to change? I'll keep plugging away at it in the mean time.

Thanks again for the helpful responses!
I can't see anything else wrong with it, that should work.
Hi Spak, I just tested this extract and it worked, maybe give it a try?
JavaScript:
<JS Post-Damage As Target>
  const fire = 2;
  if (this.item().damage.elementId === fire) {
    target.removeState(state.id);
  }
</JS Post-Damage As Target>
I can't see anything else wrong with it, that should work.
Yes, that worked perfectly! Now I can start properly designing battles again, thank you so much Jeivalien!

Edit: Just in case anyone stumbles upon this at the future looking for the same thing and just immediately scrolls to the bottom for the answer here's the working code:

Code:
<JS Post-Damage As Target>
  const douse = 3;
  if (this.item().damage.elementId === douse) {
    target.removeState(state.id);
  }
</JS Post-Damage As Target>

This thread is being closed, due to being solved. If for some reason you would like this thread re-opened, please report this post and leave a message why. Thank you.

Original thread: https://forums.rpgmakerweb.com/threads/removing-state-when-hit-by-certain-element-100-of-the-time.143963/