[RMVXA] How can I use Conditional and Percentage in a formula?

DrakeLovesNekos

A US Marine and a gamer
Veteran
Joined
Jun 22, 2014
Messages
43
Reaction score
3
First Language
English
Primarily Uses
N/A
Hey everyone, I got a small request. How can I make something like this possible:


A Sniper is using a skill called "One Shot, One Kill". What this does is that if the target's HP is 25% or less, it would instantly kill him. So the formula I've tried - but not working correctly - is this;


 if b.hp == b.mhp / 4; b.add_state(1); else; a.atk * 6 - b.def * 2; end;


So, the attack should result in "a.atk * 6 - b.def * 2" if the instant kill shouldn't work. Only problem is that even if the target HP is 25% or less, the instant kill method doesn't work. It just goes back to the else. I'm no genius lol and this is my first attempt at a formula like this. I've looked at Fomar's custom formula stuff but for some reason, this one isn't working. Any help?
 

DoubleX

Just a nameless weakling
Veteran
Joined
Jan 2, 2014
Messages
1,787
Reaction score
939
First Language
Chinese
Primarily Uses
N/A
Try this:

Code:
if b.hp <= b.mhp / 4; b.add_state(1); 0; else; a.atk * 6 - b.def * 2; end;
 

Victor Sant

Veteran
Veteran
Joined
Mar 17, 2012
Messages
1,694
Reaction score
1,452
First Language
Portuguese
Primarily Uses
your formula is checking for "equal" (==), not for "equal or less" (<=) 


the way it is, the death state will only work if the actor is exactly at maxhp / 4.
 
Last edited by a moderator:

DrakeLovesNekos

A US Marine and a gamer
Veteran
Joined
Jun 22, 2014
Messages
43
Reaction score
3
First Language
English
Primarily Uses
N/A
Oooooh, okay. That makes sense. It works now and thank you both for helping, I really appreciate is :D
 

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

Latest Threads

Latest Posts

Latest Profile Posts

How many parameters is 'too many'??
Yay, now back in action Happy Christmas time, coming back!






Back in action to develop the indie game that has been long overdue... Final Fallacy. A game that keeps on giving! The development never ends as the developer thinks to be the smart cookie by coming back and beginning by saying... "Oh bother, this indie game has been long overdue..." How could one resist such? No-one c
So I was playing with filters and this looked interesting...

Versus the normal look...

Kind of gives a very different feel. :LZSexcite:
To whom ever person or persons who re-did the DS/DS+ asset packs for MV (as in, they are all 48x48, and not just x2 the pixel scale) .... THANK-YOU!!!!!!!!! XwwwwX

Forum statistics

Threads
105,853
Messages
1,016,986
Members
137,561
Latest member
visploo100
Top