I'm new to Attack formulas. Think you can help?

Rek3dge

Villager
Member
Joined
Jan 9, 2014
Messages
6
Reaction score
1
First Language
English
Primarily Uses
Hello. my name is Rek3dge and i'm new to Attack formulas in skills. I would like some help with crafting one but when searching for tutorials i didn't find one that i really understood. I attempted to craft one but it didn't work according to plan. So here it is
 

if ( b.mph / 100 ) * 7.5; 20000; else; 0; endSo basically what i'm trying to do is "If the enemy is below 7.5% HP then kill it. Else do nothing" but when i tested the game it said. "Slime A took no damage" and dies anyway. i don't know why but that's why i need the forums help
 

Andar

Veteran
Veteran
Joined
Mar 5, 2013
Messages
31,365
Reaction score
7,676
First Language
German
Primarily Uses
RMMV
1) mph is not the variable for current HP, you'll need b.hp


2) always multiply before dividing, because all numbers are integers, and partials are dropped when storing - for example, 90/100 is zero, so 90/100 * 7.5 is still zero with integers.


90*7.5 is 675, so 90*7,5/100 is 6 with integers


3) you have no condition on the if, you still need to compare it to the maximum hp (which would be mhp. not mph)
 

Kes

Veteran
Veteran
Joined
Aug 3, 2012
Messages
22,299
Reaction score
11,712
First Language
English
Primarily Uses
RMVXA
I think I see what you're doing wrong, but I'm not an expert and I don't want to give adivice that might be wrong.  What I suggest you do is post your query in this thread http://forums.rpgmakerweb.com/index.php?/topic/1143-how-to-make-the-most-of-custom-formulae-part-1/ which is specifically dedicated to questions like yours, and where there are many knowledgeable people who could answer you with authority.

Edit

ninja'd by Andar - still think the thread I mentioned is worth turning to if you have more queries.
 
Last edited by a moderator:

Rek3dge

Villager
Member
Joined
Jan 9, 2014
Messages
6
Reaction score
1
First Language
English
Primarily Uses
1) mph is not the variable for current HP, you'll need b.hp

2) always multiply before dividing, because all numbers are integers, and partials are dropped when storing - for example, 90/100 is zero, so 90/100 * 7.5 is still zero with integers.

90*7.5 is 675, so 90*7,5/100 is 6 with integers

3) you have no condition on the if, you still need to compare it to the maximum hp (which would be mhp. not mph)
I Thank you for the help.

I think I see what you're doing wrong, but I'm not an expert and I don't want to give adivice that might be wrong.  What I suggest you do is post your query in this thread http://forums.rpgmakerweb.com/index.php?/topic/1143-how-to-make-the-most-of-custom-formulae-part-1/ which is specifically dedicated to questions like yours, and where there are many knowledgeable people who could answer you with authority.

Edit

ninja'd by Andar - still think the thread I mentioned is worth turning to if you have more queries.
I looked at this tutorial. It didn't really teach me a lot. I looked at it and saw nothing but an endless void of examples and not tutorials
 

Kes

Veteran
Veteran
Joined
Aug 3, 2012
Messages
22,299
Reaction score
11,712
First Language
English
Primarily Uses
RMVXA
I'm not talking about the tutorial.  After the tutorial there are lots of pages with people asking questions like yours and getting answers.  
 

Rek3dge

Villager
Member
Joined
Jan 9, 2014
Messages
6
Reaction score
1
First Language
English
Primarily Uses
I'm not talking about the tutorial.  After the tutorial there are lots of pages with people asking questions like yours and getting answers.  
Oh well if that's the case. Thank you for the assistance :)  
 

Engr. Adiktuzmiko

Chemical Engineer, Game Developer, Using BlinkBoy'
Veteran
Joined
May 15, 2012
Messages
14,682
Reaction score
3,003
First Language
Tagalog
Primarily Uses
RMVXA
if ( b.hp / b.mhp.to_f) <= 0.075 ; b.mhp; else; 0; end


or if you want a "sure kill" (since the one above is still affected by variance and other damage factors)


if ( b.hp / b.mhp.to_f) <= 0.075 ; b.hp=0; end;0


though it will still say: Took no damage since the damage is actually 0... but you can always use Yanfly's anti-fail script to avoid that
 
Last edited by a moderator:

Xypher

Veteran
Veteran
Joined
Apr 1, 2012
Messages
148
Reaction score
26
Primarily Uses
b.hp_rate <= 0.075 ? 99999 : 0

should work too.
 

Engr. Adiktuzmiko

Chemical Engineer, Game Developer, Using BlinkBoy'
Veteran
Joined
May 15, 2012
Messages
14,682
Reaction score
3,003
First Language
Tagalog
Primarily Uses
RMVXA
well yes... hp_rate... I forgot about that... it should work, unless the target has insane amount of reduction or is immune to that element... plus it shows 99999 damage... which is why I prefer the hp manipulation thingy... XD
 

Rek3dge

Villager
Member
Joined
Jan 9, 2014
Messages
6
Reaction score
1
First Language
English
Primarily Uses
well yes... hp_rate... I forgot about that... it should work, unless the target has insane amount of reduction or is immune to that element... plus it shows 99999 damage... which is why I prefer the hp manipulation thingy... XD
As i was testing around with it i noticed that i couldn't use symbols "<=" would there be any reason or maybe a script that i'm missing?
 

Andar

Veteran
Veteran
Joined
Mar 5, 2013
Messages
31,365
Reaction score
7,676
First Language
German
Primarily Uses
RMMV
As i was testing around with it i noticed that i couldn't use symbols "<=" would there be any reason or maybe a script that i'm missing?
No, these should be usable.
Please post your current formula (the one where you couldn't use symbols) and what the errormessage is - most of the cases it's a typo or a missing space.
 

Rek3dge

Villager
Member
Joined
Jan 9, 2014
Messages
6
Reaction score
1
First Language
English
Primarily Uses
Never mind that wasn't the error. (i don't think) it's just killing the enemy and saying "Slime A took no damage"

if ( b.hp / b.mhp.to_f) <= 0.075 ; b.mhp; else; 0; end
 
Last edited by a moderator:

Engr. Adiktuzmiko

Chemical Engineer, Game Developer, Using BlinkBoy'
Veteran
Joined
May 15, 2012
Messages
14,682
Reaction score
3,003
First Language
Tagalog
Primarily Uses
RMVXA
if that formula is killing the enemy, it should have been showing correct damage...


try to do this


if b.hp_rate <= 0.075 ; return b.mhp; else; return 0; end
 

Rek3dge

Villager
Member
Joined
Jan 9, 2014
Messages
6
Reaction score
1
First Language
English
Primarily Uses
if that formula is killing the enemy, it should have been showing correct damage...

try to do this

if b.hp_rate <= 0.075 ; return b.mhp; else; return 0; end
You have no idea how stupid i am. I added an Escape state in the effects menu. LOL! sry for waiting your time
 

Engr. Adiktuzmiko

Chemical Engineer, Game Developer, Using BlinkBoy'
Veteran
Joined
May 15, 2012
Messages
14,682
Reaction score
3,003
First Language
Tagalog
Primarily Uses
RMVXA

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

Latest Threads

Latest Profile Posts

People3_5 and People3_8 added!

so hopefully tomorrow i get to go home from the hospital i've been here for 5 days already and it's driving me mad. I miss my family like crazy but at least I get to use my own toiletries and my own clothes. My mom is coming to visit soon i can't wait to see her cause i miss her the most. :kaojoy:
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.

Forum statistics

Threads
105,868
Messages
1,017,081
Members
137,582
Latest member
Spartacraft
Top