24

« **on:** March 31, 2019, 12:25:33 am »
Sorry, I will try to explain better. There are a few scripts that work with this so I will post them if this post doesn't get across what I'm talking about.

I'm working on an RPG that is supposed to be a mix of Dark Souls 3 and ALttP. It has lots of parameters like Strength, Endurance, and Vigor and some of these parameters are added or multiplied together to define other parameters.

My current issue lies in determining my hero's vitality level. Vitality level depends on three factors: Endurance level, Strength level, and Vigor level.

(strength * 2) + (vigor * endurance multiplier) = vitality

So the parameters (Strength, Vigor, Endurance) all have min and max values (1 - 99). For Strength and Vigor, all I need are the levels; so if my Strength level is 45, I use it in the first part as (45 * 2). However, the Endurance Multiplier is calculated using the Endurance level and its min and max values are 1.01 up to 1.9999999; so if my Endurance level is 25 then my Endurance Multiplier would be 1.340.

This is where the problem lies. I have functions to get,set,add,remove,and calculate all these values but when I call the functions, like game:get_end_mult() (to get my endurance multiplier, obviously), the decimals are removed from the value leaving it as 1 or 2 depending on how large the decimal portion was. I'm currently working on trying the same thing but with the hero metatable instead of the game_metatable. My first test seemed to work; the value printed was the full decimal value that I had typed in.

I was just hoping to be able to integrate all the stats and params into the game table...I suppose its not really necessary for anything besides health, stamina, and magic. I made this post mostly because I am curious as to what the reason is for the game table truncating values.