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,571
Reaction score
1,156
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,075
Reaction score
1,494
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,344
Reaction score
8,531
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

Time flies by... already 1/6th of the calendar released :o
Realizing that 2020 is the only year since 2015 that I haven't made a RM game. Maybe I should do a tiny one to keep the streak?
grief... lol... I keep seeing request for MZ versions of MV plugins. this is why I haven't moved over and just MZ for my MV project.
Egg-sitting minigame is coming along nicely. Are you a bad enough dino to keep all these raptor eggs warm?

Forum statistics

Threads
105,809
Messages
1,016,620
Members
137,502
Latest member
HolyNova
Top