Condition to turn damage into healing instead?

Milennin

"With a bang and a boom!"
Veteran
Joined
Feb 7, 2013
Messages
2,357
Reaction score
1,505
First Language
English
Primarily Uses
RMMV
I was looking into making a state that when applied to a hero or enemy, its skills that would normally deal damage, restore the target's HP instead. I'm guessing this is not possible through regular editor tools...? Does a plugin exist that could achieve something like this?
 

Milennin

"With a bang and a boom!"
Veteran
Joined
Feb 7, 2013
Messages
2,357
Reaction score
1,505
First Language
English
Primarily Uses
RMMV
(Tip: multiply a whole damage formula part with -1. That negative part you make actually adds HP because -(-something) = +something ).
I don't know what this means.
 

Zarsla

Veteran
Veteran
Joined
Jan 23, 2015
Messages
708
Reaction score
227
First Language
English
Primarily Uses
Try this:
b.isStateAffected(x) ? (-1 * (y)) : (y)

Where x is your state and y is your damage formula.
For example this what it will be for the regular attack skill and with state 15 as the reversing state:
b.isStateAffected(15) ? (-1 * (a.atk*4 -2 * b.def)) : (a.atk*4 - 2 * b.def)

No plugins nesscary just some basic coding.Oh and this goes in to the damage formula box for your skills.

A good place to learn more is here:

https://forums.rpgmakerweb.com/index.php?threads/damage-formulas-101.81905/
 
Last edited:

_Shadow_

Tech Magician Level:
Moderator
Joined
Mar 2, 2014
Messages
4,022
Reaction score
2,629
First Language
Greek
Primarily Uses
RMMV
I don't know what this means.
* is the multiplication operator. Thus 2*4 = 8 (two times four equals eight)

Simple math.
X = 10 * 2
Thus X = 20

Now if this is damage, in the end 20 will be subtracted from HP. Right?
HP - 20

Now imagine putting a negative number to be subtracted.
It will be HP - (-20)
This is like saying HP - (20 * (-1))
Now if this is damage, it will mathematically result to HP + 20
instead of HP - 20.
 

Milennin

"With a bang and a boom!"
Veteran
Joined
Feb 7, 2013
Messages
2,357
Reaction score
1,505
First Language
English
Primarily Uses
RMMV
Try this:
b.isStateAffected(x) ? (-1 * (y)) : (y)

Where x is your state and y is your damage formula.
Yes, that is what I've tried, but it results in 0 damage dealt.
 

Zarsla

Veteran
Veteran
Joined
Jan 23, 2015
Messages
708
Reaction score
227
First Language
English
Primarily Uses
Hmm I can see how this isn't working.
Try this instead:
Fix your damage formulas back to the way they were.
Then make sure you have Yanfly Core Engine and Yanfly Skill Core plugins and use this notetag.
<Pre-Damage Eval>
if(user.isStateAffected(x)){
value =-value;
}
</Pre-Damage Eval>
Place this notetag in the affected skills like say the "Attack" skill.
Replace x with the number of the state that's going to inflict this reversing.
Now what should happen is that the user of said skill, should heal targets when attacking/dealing damage and should damage/hurt targets when healing. It'll also reverse the Drain feature, so instead of drain an enemy and heal themselves, they'll drain them selves and heal the enemy.
Basically this should work.
 

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

Latest Threads

Latest Posts

Latest Profile Posts

Husband has roped me into playing one of his PSO2 characters. Productivity is now negative.
Tileset A is lava! Don't burn D:
as MZ come out what you guys think about.....Some particles engine :3c?
Who wants to sing this song with me?~

Decided to submit my games to the Monday Night Stream. Figured it might be a fun way to get some traction.

Forum statistics

Threads
100,708
Messages
978,565
Members
132,320
Latest member
LavaWave
Top