Question about setting a max value in a damage formula

● ARCHIVED · READ-ONLY
Started by xeroborn 5 posts View original ↗
  1. 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
  2. Try this simple formula

    [your_damage_formula,5000].minHowever, the variance function will still modify the final result
  3. 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?
  4. TheoAllen said:
    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.
  5. 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.