Zorkaz Posted March 19, 2020 Posted March 19, 2020 Is there a way to convert an ActorValue (Eg Luck) into an integer?
SKKmods Posted March 19, 2020 Posted March 19, 2020 Yes, but it is ALWAYS better to convert (called Cast) your Integer value to Float than covert a Float to an Int:If ( iMyIntValue == (Object.GetValue(ThisAV) as Int) ) ; bad If ( (iMyIntValue as Float) == Object.GetValue(ThisAV) ) ;goodReason is that you are not changing the PRECISION of an Int, just padding decimal places. But you are forcing a float to round up or down. I have encountered float calls that simply will not convert/round/cast to Int and the calculation keeps returning zero.
niston Posted March 19, 2020 Posted March 19, 2020 There are several ways. Simplest is casting to Int: Float f = 1.0Int i = f as Int Anything after the decimal point will be truncated. You can also use Math.Floor or Math.Ceiling if truncation is not suitable. EDIT: SKK was faster. What he says does also apply.
Recommended Posts