Question about setting a max value in a damage formula

Status
Not open for further replies.

xeroborn

Veteran
Veteran
Joined
May 10, 2014
Messages
45
Reaction score
6
First Language
English
Primarily Uses
Hi.

I have a skill in my game that does increasing damage based on the player character's missing health. The skill itself works perfectly, the problem is I would like to set the skill to have a damage cap. I want to use the value determined by the formula in all cases except when that value is greater then 5000, in which case the skill does a max of 5000 damage.

It is possible to fight a boss, and use this skill when the player is almost dead and one shot the boss because the skill does 100,000 damage.

i also tried adding .max and this seemed to cause the skill to always do 5000 damage, which is not what I want. Maybe I'm doing that wrong though.

Hopefully there is something simple I can do to fix this.

Thanks for the help,

Mike
 

TheoAllen

Self-proclaimed jack of all trades
Veteran
Joined
Mar 16, 2012
Messages
5,592
Reaction score
6,522
First Language
Indonesian
Primarily Uses
RMVXA
Try this simple formula

[your_damage_formula,5000].minHowever, the variance function will still modify the final result
 

Onomotopoeia

I don't know, nobody's told me yet.
Veteran
Joined
Jul 11, 2014
Messages
222
Reaction score
27
First Language
English
Primarily Uses
I don't know of such a script at this point in time, but it would be of interest if someone were to create a custom script for various algebraic, geometric, trigonometric, etc formula.
 
For your purposes, calling for the "max" value is not what you are looking for; I would try creating a script that could return a value based upon a constraint value. I have in mind that the notable functions should be able to handle (val1 is the value to constrain, val2 is the constraint):

  • constrain_maximum(val1,val2) -- if val1 is greater, val2 is returned, else val1
  • constrain_minimum(val1,val2) -- if val1 is less, val2 is returned
as well as methods returning the Boolean state of the above, such as greater than, greater or equal, less than, less or equal, et cetera.

But, having such a mathematical library of functions is almost necessary; why is it already not included in RGSS?
 

xeroborn

Veteran
Veteran
Joined
May 10, 2014
Messages
45
Reaction score
6
First Language
English
Primarily Uses
Try this simple formula

[your_damage_formula,5000].minHowever, the variance function will still modify the final result
Thank you!

That works great. The variance does affect it, but not in a game breaking way (like hitting for 100k was doing), and having that variance might actually be good, so the player doesn't realize I am capping the damage.

I guess I didn't understand what I was doing with trying .max. Now I know though.

-Mike

edit: this thread can be closed.
 
Last edited by a moderator:

Shaz

Veteran
Veteran
Joined
Mar 2, 2012
Messages
40,098
Reaction score
13,704
First Language
English
Primarily Uses
RMMV
This thread is being closed, due to being solved. If for some reason you would like this thread re-opened, please report this post and leave a message why. Thank you.
 
Status
Not open for further replies.

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