Zorkaz Posted March 19, 2020 Share Posted March 19, 2020 Is there a way to convert an ActorValue (Eg Luck) into an integer? Link to comment Share on other sites More sharing options...
SKKmods Posted March 19, 2020 Share 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) ) ;good Reason 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. Link to comment Share on other sites More sharing options...
niston Posted March 19, 2020 Share 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. Link to comment Share on other sites More sharing options...
Zorkaz Posted March 19, 2020 Author Share Posted March 19, 2020 Thank you both Link to comment Share on other sites More sharing options...
Recommended Posts