is a formula like this possible?

Oddball

Veteran
Veteran
Joined
Sep 4, 2014
Messages
1,923
Reaction score
534
First Language
English
Primarily Uses
N/A
In my game, all levels have a maximum of 20MP. There's a certain mechanic that goes along with this, and magical skills require MP to be over a certain amount to be used. MP also fluctuates in battle depending on your actions, yet is never spent

anyway, what I'm wanting to know, is if i can use something like this in a damage formula

a.mat*1.((a.mp))

so if MP is maxed out, the formula would be 

a.mat*1.2

were as if it was only at 9 it would be this

a.mat*1.09

I'm asking on here because i also want to share the idea if anyone wants to use it
 

bgillisp

Global Moderators
Global Mod
Joined
Jul 2, 2014
Messages
13,522
Reaction score
14,255
First Language
English
Primarily Uses
RMVXA
I'm not sure about it working exactly as you wrote it, but I think this would work:

a.mat + a.mat * (a.mp/100)

That will do the same thing, where if you have 2 mp, then it does 1.02 * your mat, and if you have 10 mp it does 1.10 * your mat.
 

Oddball

Veteran
Veteran
Joined
Sep 4, 2014
Messages
1,923
Reaction score
534
First Language
English
Primarily Uses
N/A
I'm not sure about it working exactly as you wrote it, but I think this would work:

a.mat + a.mat * (a.mp/100)

That will do the same thing, where if you have 2 mp, then it does 1.02 * your mat, and if you have 10 mp it does 1.10 * your mat.
Thank you. and dividing it by 50 would mean if you had 2 MP then it would by 1.04 and if you had 10 MP it would be 1.20?
 

Petite Elite

Veteran
Veteran
Joined
Jan 1, 2013
Messages
128
Reaction score
91
First Language
English
Primarily Uses
Hmm, I'm not too sure about that formula... maybe try:

a.mat*(1+a.mp/100)

that should max out to a.mat*1.2

edit: (Nevermind, they're the same :p )
 
Last edited by a moderator:

bgillisp

Global Moderators
Global Mod
Joined
Jul 2, 2014
Messages
13,522
Reaction score
14,255
First Language
English
Primarily Uses
RMVXA
@Oddball, yep. So set the division number appropriately.

@Petite Elite: Yep, I distributed the a.mat through first. Yours is a tad more compact though, so if you are near the character limit it is the better to use.
 

Trihan

Speedy Scripter
Veteran
Joined
Apr 12, 2012
Messages
2,604
Reaction score
1,959
First Language
English
Primarily Uses
RMMV
If you ever get near the character limit just put the formula into a new method in Game_Battler. For example:

def custom_formula_cappedmagic(a, b )

  a.mat*(1+a.mp/100)

end

Then in the formula box put a.custom_formula_cappedmagic(a, b )

Obviously this one fits no problem, but for future reference it might be handy to know.
 
Last edited by a moderator:

Another Fen

Veteran
Veteran
Joined
Jan 23, 2013
Messages
564
Reaction score
275
First Language
German
Primarily Uses
You might want to make one of the numbers used in the division a float (by using 100.0 instead of 100 for example), otherwise the result is rounded down to an integer.

As an alternative, you can do the multiplication before you divide to minimize rounding errors:

a.mat * (100 + a.mp) / 100
 
Last edited by a moderator:

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,849
Messages
1,016,977
Members
137,563
Latest member
cexojow
Top