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

Status
Not open for further replies.

dotspak

Possibly a glitch in the system
Veteran
Joined
Dec 5, 2016
Messages
94
Reaction score
6
First Language
English
Primarily Uses
RMMV
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.)
 

ATT_Turan

Forewarner of the Black Wind
Veteran
Joined
Jul 2, 2014
Messages
4,151
Reaction score
2,535
First Language
English
Primarily Uses
RMMV
The necessary tags are in the documentation for VisuStella's Battle Core: <JS Post-Damage as Target>
 

dotspak

Possibly a glitch in the system
Veteran
Joined
Dec 5, 2016
Messages
94
Reaction score
6
First Language
English
Primarily Uses
RMMV
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.
 
Last edited:

ATT_Turan

Forewarner of the Black Wind
Veteran
Joined
Jul 2, 2014
Messages
4,151
Reaction score
2,535
First Language
English
Primarily Uses
RMMV
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.
 

Trihan

Speedy Scripter
Veteran
Joined
Apr 12, 2012
Messages
4,969
Reaction score
4,554
First Language
English
Primarily Uses
RMMZ
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
 

dotspak

Possibly a glitch in the system
Veteran
Joined
Dec 5, 2016
Messages
94
Reaction score
6
First Language
English
Primarily Uses
RMMV
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!
 

Trihan

Speedy Scripter
Veteran
Joined
Apr 12, 2012
Messages
4,969
Reaction score
4,554
First Language
English
Primarily Uses
RMMZ
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.
 

Jeivalien

Wandering soul
Veteran
Joined
Jan 24, 2014
Messages
69
Reaction score
32
First Language
Spanish
Primarily Uses
RMMV
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>
 

dotspak

Possibly a glitch in the system
Veteran
Joined
Dec 5, 2016
Messages
94
Reaction score
6
First Language
English
Primarily Uses
RMMV
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>
 

mlogan

Global Moderators
Global Mod
Joined
Mar 18, 2012
Messages
16,568
Reaction score
9,188
First Language
English
Primarily Uses
RMMV

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.

 
Status
Not open for further replies.

Latest Threads

Latest Profile Posts

ScreenShot_5_26_2022_11_36_32.png
added a Panic gauge to battle. it fills up according to your actions. each character has a different passive that activates once the gauge is full. also once full, a countdown starts and after each action taken, the gauges decreases. with each character, the decrease is different.
Genuinely considering making a thread informing people how to Google.
It's time for Da Update...

Prototyping some overworld abilities. Some of the characters you'll meet on your journey can use special overworld skills to travel around. This can be something like digging holes in the ground or getting hints towards your next objective.

Even more things I made.
Equipping Abilities is very important.
fLhHhZjh.gif

Forum statistics

Threads
122,157
Messages
1,146,895
Members
160,424
Latest member
SpaapS
Top