Welcome to the forum
Here is one link
that explains the squirrel language, and another link
that explains Valve's port of the VM.
First, you're going to end up using the following function:
int RandomInt(int nLowerLimit, int nUpperLimit)
I'm not sure what you are trying to do with the if
statement. You can set the bounds from 0,20 and do a bitwise shift, and compare that value with a flag you set to check whether or not you want a tank to spawn.
In the current campaign I am making, I want the special infected spawn rate to be increased along with a tank spawn probability reduction.
Because the two probability functions are linear, you can just do 1-x to get your fractional spawn rate. For example, local someValue = RandomInt(0,20)
and using that with the expression (100 - someVal)/100
would equal your special infected spawn rate as a fraction of 1. You can possibly scale that fraction and use them with infected limits and respawn intervals.
If you wanted to change the director options when a tank is in play, you can possibly use IsTankInPlay() and make necessary changes.
1 week of compiling and wasted time effort
Time spent on the coding side is never wasted
I know the above may not be of much use to you, but what you are asking to do can be achieved in many ways (if I understood your request).