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,500
Reaction score
1,095
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,052
Reaction score
1,481
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,323
Reaction score
8,520
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

Just finished composing a boss battle theme!
Scripted a multi-variable weather system that randomizes wind speed, cloudiness, rain, fogginess, etc, while attempting to realistically account for interactions between them (e.g. wind speed affects fogginess, cloudiness affects rain, etc), the current weather pattern, and the player's biome e.g. swamp, beach, etc. Now I "just" have to tie visuals and sounds to the variables so stuff actually happens...
I'm having a headache balancing the combat using flat defense so I'm gonna use percentual armor, in this pic, Simon has 16 on Defense which means all the incoming damage will be reduced by 16% this will ease my burden a bit.
!Have a nice day everybody¡
SO glad they patched outer worlds for switch! I can finally play it! Weird that other peeps are still having issues. I know it was really chugging on my lite when it first came out.

Forum statistics

Threads
105,555
Messages
1,014,624
Members
137,231
Latest member
anjing_gila
Top