Time for action – Using integers
Let's make an Int.
Declaring an integer is similar to what we did with bools, so let's replace our bool declaration line with this:
var int NumberOfKittens;
We can see that we have the same
var
text that declares our variable, and then we tell the game that our variable is anint
. Finally, we set the name of ourint
toNumberOfKittens
.The name of the variable should give a hint as to the difference between ints and floats, and why we need ints to begin with instead of using floats for everything. Since we don't want to hurt any defenseless kittens we should only be using whole numbers to represent the number of them. We don't want to have half of a kitten.
As with our bool variable ints have a default value, in this case zero. We can check this by changing our
PostBeginPlay
function:function PostBeginPlay() { 'log("Number of kittens:" @ NumberOfKittens); }
Now our
AwesomeActor.uc
class should look like this:class AwesomeActor extends Actor placeable; ...