RMMV [Solved] Skill that allows me to heal when I'm inflicted with poison instead of taking damage

Status
Not open for further replies.

Sirius270

Veteran
Veteran
Joined
May 2, 2020
Messages
38
Reaction score
13
First Language
English
Primarily Uses
RMMV
Hello! I have Yanfly plug-ins, specifically Buffs and States running a passive state for the skill [Poison Drinker] that (will eventually) heal the actor with the passive when they are afflicted with the state poison (that's state #4 for me). Here is a screenshot of what I have included. Here is the code itself:

EDIT:
HERE IS THE SOLUTION:
1603660406122.png
1603659375883.png
Code:
<Reapply Reset Add>
<Custom Regenerate Effect>
if (user.isStateAffected(142)) {
user.addState(140);
}
</Custom Regenerate Effect>
 

Attachments

Last edited:

Frostorm

[]D[][]V[][]D aka "Staf00"
Veteran
Joined
Feb 22, 2016
Messages
1,553
Reaction score
1,142
First Language
English
Primarily Uses
RMMV
JavaScript:
<Custom Apply Effect>
if (target.isStateAffected(4)) {
    target.gainHp(Math.round(target.mhp * 0.1));
}
</Custom Apply Effect>
The issue was your use of just "mhp" w/o a unit associated w/ it (e.g. "target.mhp").
 

Sirius270

Veteran
Veteran
Joined
May 2, 2020
Messages
38
Reaction score
13
First Language
English
Primarily Uses
RMMV
JavaScript:
<Custom Apply Effect>
if (target.isStateAffected(4)) {
    target.gainHp(Math.round(target.mhp * 0.1));
}
</Custom Apply Effect>
The issue was your use of just "mhp" w/o a unit associated w/ it (e.g. "target.mhp").
Thank you for the edit! Unfortunately, it still does not work. I tried with "a", "b", and "target".

Edit: Solution in original post!
 
Last edited:

caethyril

^_^
Veteran
Joined
Feb 21, 2018
Messages
2,069
Reaction score
1,488
First Language
EN
Primarily Uses
RMMZ
Yanfly's Passive States never get applied: they're either there (active) or not. This means the Apply effect will never trigger. :kaoswt:

In this case I'd suggest building the effect into your poison state rather than the passive, e.g. try this notetag on your poison state:
Code:
<Custom Regenerate Effect>
// calculate poison damage
var dmg = user.mhp * 0.1;
if (user.isStateAffected(142)) {
  // has Poison Drinker, so heal
  user.gainHp(dmg);
} else {
  // otherwise damage as usual
  user.gainHp(-dmg);
}
</Custom Regenerate Effect>
If using this approach, you should also remove any negative regen traits on the poison state, since the damage is all being handled via the Regenerate Effect tag. :kaophew:
 

Sirius270

Veteran
Veteran
Joined
May 2, 2020
Messages
38
Reaction score
13
First Language
English
Primarily Uses
RMMV
Yanfly's Passive States never get applied: they're either there (active) or not. This means the Apply effect will never trigger. :kaoswt:

In this case I'd suggest building the effect into your poison state rather than the passive, e.g. try this notetag on your poison state:
Code:
<Custom Regenerate Effect>
// calculate poison damage
var dmg = user.mhp * 0.1;
if (user.isStateAffected(142)) {
  // has Poison Drinker, so heal
  user.gainHp(dmg);
} else {
  // otherwise damage as usual
  user.gainHp(-dmg);
}
</Custom Regenerate Effect>
If using this approach, you should also remove any negative regen traits on the poison state, since the damage is all being handled via the Regenerate Effect tag. :kaophew:
Awesome! this way totally worked, as well, and works better because it is not Actor 1 specific. I might combine our solutions (adding the HOT state rather than the healing damage because I like how the numbers simplify at the end xD). Super great, thank you!
Edit: I put in the main comment the total solution after I tweaked it. I didn't like, visually, how the damage was showing (-5) as well as the healing (+10), so I did it this way so it was visually cleaner (just shows the +5 heal).
 
Last edited:

Sirius270

Veteran
Veteran
Joined
May 2, 2020
Messages
38
Reaction score
13
First Language
English
Primarily Uses
RMMV
Awesome! this way totally worked, as well, and works better because it is not Actor 1 specific. I might combine our solutions (adding the HOT state rather than the healing damage because I like how the numbers simplify at the end xD). Super great, thank you!
Edit: I put in the main comment the total solution after I tweaked it. I didn't like, visually, how the damage was showing (-5) as well as the healing (+10), so I did it this way so it was visually cleaner (just shows the +5 heal).
 

mlogan

Global Moderators
Global Mod
Joined
Mar 18, 2012
Messages
15,338
Reaction score
8,526
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.

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

Latest Threads

Latest Posts

Latest Profile Posts

Hope you are all fine today~
Moderators, you must have so much patience to be able to deal with everything. I mod in a server of sorts and today we just got a message, which, despite it's helpful constructive criticism, basically stated that all of the mods were jerks and that was the only reason our server was unlikeable. So, thank you, for having patience. You are appreciated! :kaoluv:
Haired slime? Trying some different styles of art. Maybe I can make some resources with this new kind of painting.......
i love my game very much

Forum statistics

Threads
105,740
Messages
1,016,004
Members
137,424
Latest member
zxandris
Top