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,464
Reaction score
1,067
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,043
Reaction score
1,472
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,319
Reaction score
8,517
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

rux
The most words I have ever written in an entire document is in my game's script, jeez i have a lot of characters that ramble on
Yes! I finally did something! This is a picture I drew of what I wish I looked like; I hope that you guys like it!
Finished that egg-sitting mini-game I mentioned here a couple weeks back. Now to fix the weather system so it doesn't rain indoors while you're playing it. >.> A simple fix in itself; leave it to me to take it as an excuse to completely revamp the time/weather/lighting system from scratch.
I'm really tempting to pre order cyberpunk 2077... should I do it or not :/ I really want to play the game but don't want to take a big hit to my saving because of it

Forum statistics

Threads
105,485
Messages
1,014,100
Members
137,138
Latest member
DawnStar
Top