Overheal creates barrier?

Icenick

Veteran
Veteran
Joined
Mar 28, 2012
Messages
269
Reaction score
32
First Language
English
Primarily Uses
Im trying to figure out how I can create a skill that when cast if your at max hp and being healed, you will create a barrier for the excess as long as the skill is active. Based off Bloodthirster.

Honestly have no idea how its going to work tried adding on my potion item to test it and did not work.
Code:
<After Eval>
if (target.isStateAffected(70) && (target.hp === target.mhp)) {
   target.gainBarrier(500, 2);}
</After Eval>
 

Cythera

Veteran
Veteran
Joined
Jul 31, 2019
Messages
98
Reaction score
123
First Language
English
Primarily Uses
RMMV
If you can clarify a few things for me, I'd be happy to help you out. You're using Yanfly's Skill core and Absorption barrier(this information is critical when asking for JS/Plugin help)
Is this a healing skill you cast on allies where you want any excess 'heal' to be converted into a barrier? And what is the intention with state 70; you only want the excess heal converted into a barrier while the target has that state?
I'm interpreting your post a few different ways and don't want to throw the wrong code at you without knowing exactly what you intend to do.
 

Icenick

Veteran
Veteran
Joined
Mar 28, 2012
Messages
269
Reaction score
32
First Language
English
Primarily Uses
If you can clarify a few things for me, I'd be happy to help you out. You're using Yanfly's Skill core and Absorption barrier(this information is critical when asking for JS/Plugin help)
Is this a healing skill you cast on allies where you want any excess 'heal' to be converted into a barrier? And what is the intention with state 70; you only want the excess heal converted into a barrier while the target has that state?
I'm interpreting your post a few different ways and don't want to throw the wrong code at you without knowing exactly what you intend to do.
Hey great! Yes im using most of Yanfly plugins including skill core, absorption barrier and buffs and states.

Exactly if under the passive state 70, any HP would heal you gets converted into a barrier for the remainder of the battle.
You have 400 of 600 HP and use a potion to recover 500 HP, your HP is 600 and the barrier would be the difference of (400-600+500) 300.

Sidenote I noticed a problem when making another skill that increases MAT for 1 round after being healed. I could not successfully do this with <Custom React Effect> (im blanking if this is the proper name for it but either way I tried with a few different notetags).
To clarify the way it was supposed to work was equipping a staff or thru skill would give you a passive state that whenever you would recover life (regen, items, skills, lifesteal, etc) you would get a MAT buff.
I had to go into every skill and item and apply the proper script using notetags for every heal. I mention this maybe because I dont know what im doing or the mechanics of healing work differently than im used to.

I put this code into my potion notebox, It does not give me the proper barrier, im not seeing my error. Maybe it checks the target HP after the heal and its causing it to gain way too much barrier, if I was at 100 HP and healed to maximum 600HP, then I would gain a barrier of 500, when in reality I should gain nothing because im at max hp.
Edit: I added this I think it works. So far basic testing proves so, but before I add this to every heal I have in the game, Id like to confirm if its properly written.
Code:
<Before Eval>
// Registers the HP value of the user.
target._confirmHp = target.hp;
</Before Eval>

<After Eval>
if (target.isStateAffected(68)) {
   target.addBuff(4,1);}
if (target.isStateAffected(70)) {
  var heal = 500;
  var overheal = heal + target.hp - target.mhp;
  if (overheal > 0) {
  target.gainBarrier(overheal);}
}
</After Eval>
 
Last edited:

Cythera

Veteran
Veteran
Joined
Jul 31, 2019
Messages
98
Reaction score
123
First Language
English
Primarily Uses
RMMV
From what you've told me, an easier way to implement this rather than copy-pasting that code into heal items and skills (trust me, making any changes to that later will be torturous) give your actors a passive state using Yanfly's Auto Passive State plugin. Then put this in the notetag.
JavaScript:
<Custom React Effect>
if (target.isStateAffected(68) && this.isHpRecover()) {
   target.addBuff(4,1);}
if (target.isStateAffected(70) && this.isHpRecover()) {
  var heal = user.mhp - user.hp;
  var overheal = (value*-1) - heal;
  if (overheal > 0) {
  target.gainBarrier(overheal, 0);}
}
</Custom React Effect>
It'll check if the target has those states, and if the skill/item is a HP recovery. If it is, it will add that magic attack buff. The second one will add the overheal as a barrier. If you want the barrier to expire in X number of turns, change the 0 in that line to the turn number.
Let me know if that helps!
 

Icenick

Veteran
Veteran
Joined
Mar 28, 2012
Messages
269
Reaction score
32
First Language
English
Primarily Uses
From what you've told me, an easier way to implement this rather than copy-pasting that code into heal items and skills (trust me, making any changes to that later will be torturous) give your actors a passive state using Yanfly's Auto Passive State plugin. Then put this in the notetag.
JavaScript:
<Custom React Effect>
if (target.isStateAffected(68) && this.isHpRecover()) {
   target.addBuff(4,1);}
if (target.isStateAffected(70) && this.isHpRecover()) {
  var heal = user.mhp - user.hp;
  var overheal = (value*-1) - heal;
  if (overheal > 0) {
  target.gainBarrier(overheal, 0);}
}
</Custom React Effect>
It'll check if the target has those states, and if the skill/item is a HP recovery. If it is, it will add that magic attack buff. The second one will add the overheal as a barrier. If you want the barrier to expire in X number of turns, change the 0 in that line to the turn number.
Let me know if that helps!
Trust me I know I dont want to add these tags to every skill but its the only way I have gotten it to work.

I tried react and I had the formula wrong but even your code does not work, the overheal nor the mat buff trigger. I think its the way heals are handled.

It gets out of hand for me because I have a skill that heals party 10% of users max hp if used as a combo. I could not get it to trigger on the party member(s) with the proper buffs, it seemed to only happen on caster. So ultimately im stuck doing this over complicated way lol
 

Cythera

Veteran
Veteran
Joined
Jul 31, 2019
Messages
98
Reaction score
123
First Language
English
Primarily Uses
RMMV
Hmm, that's strange. The code works for me. I don't know about the combo you're trying to do, but it should be working for all other heal skills and items.
Whelp. If you're going the notetag every skill way, I wish you luck haha. If you want any help with it later on, just ask and I'll try my best.
 

Icenick

Veteran
Veteran
Joined
Mar 28, 2012
Messages
269
Reaction score
32
First Language
English
Primarily Uses
Hmm, that's strange. The code works for me. I don't know about the combo you're trying to do, but it should be working for all other heal skills and items.
Whelp. If you're going the notetag every skill way, I wish you luck haha. If you want any help with it later on, just ask and I'll try my best.
Well it does not even work for potions using your custom react, which im finding really odd.
Edit: I retested it making sure the passive states were correct and they are. It does not work at all with react and heals :S
 
Last edited:

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

Latest Threads

Latest Posts

Latest Profile Posts

Everytime I need to write dialogues I find myself writing new music pieces... what kind of trick is this?!
Me Being Dumb spending hrs trying to figure out Irenas Visual Novel busts plugin..lol. I'm probably missing something stupid and obvious xDD

let the journey begin >w>
X.X ok... I guess I'll just have to think about 48x48 a little differently. Its not "room for more work"..."its room for more detail!...yay"
Alexa, play Buck-Tick - Dress
Worst part about doing a plugin based on an existing system: figuring out the best way for developers to set up the data.

Forum statistics

Threads
99,217
Messages
963,142
Members
130,805
Latest member
kraufen
Top