Quote:
Originally Posted by ZBzibing
Code:
l4d_infectedbots_tank_spawn_probability "5","When each time spawn S.I., how much percent of chance to spawn tank"
I've always thought it was inaccurate here and here.
Code:
GetRandomInt(1, 100) <= g_iSpawnTankProbability)
modify
GetRandomInt(1, 100) >= g_iSpawnTankProbability)
I think it's more accurate to correct for less than
|
It does not make sense to check if the RNG is greater than the set probability because you will increase its chances. The 5% chance will become 95% if you use ">=" instead of "<=" here. The goal is to get a number that is less than or equal to 5. We want the Tank to have a low chance of spawning.
@HarryPotter I noticed some redundancy in this code block:
PHP Code:
if (g_bL4D2Version)
{
if ( ( (g_bFinaleStarted && g_bTankSpawnFinal == true) || !g_bFinaleStarted ) &&
g_iSpawnCounts[SI_TANK] < g_iTankLimit &&
GetRandomInt(1, 100) <= g_iSpawnTankProbability)
{
return 7;
}
else //spawn other S.I.
{
int generate;
for(int i = 1; i <= 3; i++)
{
generate = GenerateIndex()+1;
if(generate > 0) break;
}
return generate;
}
}
else
{
if ( ( (g_bFinaleStarted && g_bTankSpawnFinal == true) || !g_bFinaleStarted ) &&
g_iSpawnCounts[SI_TANK] < g_iTankLimit &&
GetRandomInt(1, 100) <= g_iSpawnTankProbability)
{
return 7;
}
else
{
int generate;
for(int i = 1; i <= 3; i++)
{
generate = GenerateIndex()+1;
if(generate > 0) break;
}
return generate;
}
}
In both versions of the game, the same logic is being executed. If this is intentional, I suggest removing the game check for this code block. Lines 3696-3735 on Github.
__________________