Time for action – Math!
As an example, take a look at this code.
var float Float1, Float2; var int Int1; function PostBeginPlay() { Float2 = Int1 / Float1; 'log("Float2:" @ Float2); } defaultproperties { Int1=5 Float1=2.0 }
We can divide an int by a float or vice versa, and we get the result we expect:
[0008.10] ScriptLog: Float2: 2.5000
However, if we divide an int by an int and assign it to a float, what would we expect the result to be?
Let's take a look at this code:
var float Float1; var int Int1, Int2; function PostBeginPlay() { Float1 = Int1 / Int2; 'log("Float1:" @ Float1); } defaultproperties { Int1=5 Int2=2 }
With that it looks like we'd expect the same result. Let's take a look at the log:
[0007.66] ScriptLog: Float1: 2.0000
When dividing ints, the truncating happens before assigning the result, even if it's a float. Depending on what we're doing this may be what we want, but it's good to keep that in mind.
Two other operators that can be used for simple...