I was wondering if it's possible to have a class have minimum 0 ATK, DEF, MAT, MDF, AGI, and LUK instead of minimum 1.
Is it possible to set parameters to 0 by default?
RPG Maker VXAce SupportYes, we do it this way
It basically substracts all the stats except MaxHP and MaxMP by 1. So if you set it 1, it will be 0. If you set it 100, it will be 99
It won't be shown in the editor, but it will give you 0 in game.
Code:
class Game_Actor
def param_base(param_id)
self.class.params[param_id, @level] - (param_id >= 2 ? 1 : 0)
end
def param_min(param_id)
return 0
end
end
It won't be shown in the editor, but it will give you 0 in game.
The Game_BattlerBase class has param_min method, so if you want, you can create a custom script and alias this method and make it return 1.
However I advise you against changing minimum values from 1 to 0, because if you do so, if you have a formula somewhere in your game that tries a division by any of these parameters, you may fall into a division by zero case, and that will not be very nice.
However I advise you against changing minimum values from 1 to 0, because if you do so, if you have a formula somewhere in your game that tries a division by any of these parameters, you may fall into a division by zero case, and that will not be very nice.
Totally forgot about param_min, thanks for the heads up!
Also, I looked at the other part of the code, looks like only AGI that is used for the division. The default attack and defense stat are really up to the dev on how they use it.
I see. Thank you for your help!
@Cuddlebuns If your query is fully resolved please Report your opening post and ask for it to be closed.
Thanks
Thanks
Thread closed IgnoreMe
Original thread: https://forums.rpgmakerweb.com/threads/is-it-possible-to-set-parameters-to-0-by-default.108675/