I need to do the following, is there a way to do this mathematically with only a few lines of script
and yet still get the EXACT LEVEL floats shown below?
I need to do the following, is there a way to do this mathematically with only a few lines of script
and yet still get the EXACT LEVEL floats shown below?
Hmmm, well I hope my math is okay (and keep in mind I haven't written much papyrus for a bit)
Int Lev = Math.Floor( ( StaminaPerc + 0.05 ) / 0.05 )
Float Level = 0.05 X Lev
If Level == 1.0
Level = 0.99
EndIf
I think the following would do it:
Float Step = 0.05Float Mult = Math.Ceiling(StaminaPerc / Step)Float Level = Mult * Step; Add the following if you want to be more similar to your code.If (Level == 1.0) Level = 0.99EndIf
It's not exactly the same, as your code does not set Level if StaminaPerc is bigger than 0.99.
Actually come to think of it you need StaminaPerc + 0.049999 otherwise StaminaPerc 0.099 will return Level = 0.1 while 0.1 will return Level = 0.15