How to lower own health with a skill?

elsimate

Villager
Member
Joined
Apr 27, 2015
Messages
26
Reaction score
2
Primarily Uses
Hi guys! Im making a super dooper attack , but it has a big mp cost , and it lowers your health.. or at least it should..

Maybe i can just put success rate at 30% and the mp cost will be the gambling piece of the attack..

But i would like to know how to hurt oneself nevertheless... i really have probelms with these skills...

once i put +atk on an enemy skill, and later i couldnt figure out why i had 10 more atk than when i tried enemies out in the troop screen :p
 

bgillisp

Global Moderators
Global Mod
Joined
Jul 2, 2014
Messages
13,522
Reaction score
14,255
First Language
English
Primarily Uses
RMVXA
Yanfly has a skill cost script which will let you assign an HP cost and an MP cost. Maybe that is what you need for this?
 

Andar

Veteran
Veteran
Joined
Mar 5, 2013
Messages
31,363
Reaction score
7,673
First Language
German
Primarily Uses
RMMV
Or simply write into the damage formula box

Code:
a.hp -= own damage; regular damage
 

elsimate

Villager
Member
Joined
Apr 27, 2015
Messages
26
Reaction score
2
Primarily Uses
i make integers with .max?

oh wait.. i figured it out.. Shaz said that if you dont introduce non-integers to your formula, that you wont get any decimals... so i just replaced 0.1 with 1/10 :p

current formula : a.hp-=(a.mhp*1/10);(a.atk  - b.def)*3
 
Last edited by a moderator:

Trihan

Speedy Scripter
Veteran
Joined
Apr 12, 2012
Messages
2,604
Reaction score
1,959
First Language
English
Primarily Uses
RMMV
If you want to actually show it in the log, you could also do

a.result.hp_damage=(a.mhp*1/10);a.execute_damage(a);(a.atk-b.def)*3
 
Last edited by a moderator:

Wavelength

MSD Strong
Global Mod
Joined
Jul 22, 2014
Messages
5,624
Reaction score
5,104
First Language
English
Primarily Uses
RMVXA
i make integers with .max?

oh wait.. i figured it out.. Shaz said that if you dont introduce non-integers to your formula, that you wont get any decimals... so i just replaced 0.1 with 1/10 :p

current formula : a.hp-=(a.mhp*1/10);(a.atk  - b.def)*3
.max is for comparing two values and taking the greater of the two.  For an interger, use .to_i

As Shaz said, the formula will take the same precision as what you enter.  But you have to be careful.  For example, a.mhp * 1 / 10 will work just fine, but a.mhp * (1 / 10) will always result in 0 no matter what the user's MHP is because (1/10) is less than 1 so it will multiply their MHP by 0.
 

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

Latest Threads

Latest Profile Posts

Couple hours of work. Might use in my game as a secret find or something. Not sure. Fancy though no? :D
Holy stink, where have I been? Well, I started my temporary job this week. So less time to spend on game design... :(
Cartoonier cloud cover that better fits the art style, as well as (slightly) improved blending/fading... fading clouds when there are larger patterns is still somewhat abrupt for some reason.
Do you Find Tilesetting or Looking for Tilesets/Plugins more fun? Personally I like making my tileset for my Game (Cretaceous Park TM) xD
How many parameters is 'too many'??

Forum statistics

Threads
105,858
Messages
1,017,023
Members
137,565
Latest member
Callmelogann
Top