How RandomInt Works
Last updated
Last updated
RandomInt is the method we use to assign a random variable to an integer in Squirrel. This is how we get the game to pick a random sound.
We establish an integer variable, putting its name in [variable], and giving RandomInt the amount of possible values it can choose in [number].
Because the value in [number] dictates how many possible values it can roll, and it's possible to roll a 0, we start counting at 0. So, when naming all possible sound options it can roll, we give the first one a 0, the second one a 1, the third a 2, and so on.
So for example, you have 5 deathsounds you want to use. In the [number] spot you would put 5. However, they would only go up to 4 with their names.