mirror of
https://github.com/ineedbots/iw2_bot_warfare.git
synced 2025-04-19 14:22:54 +00:00
add bots_manage_fill_watchplayers
This commit is contained in:
parent
6cee88c74e
commit
45ec46d1df
@ -70,6 +70,11 @@ init()
|
|||||||
{
|
{
|
||||||
setcvar( "bots_manage_fill_kick", false ); // kick bots if too many
|
setcvar( "bots_manage_fill_kick", false ); // kick bots if too many
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ( getcvar( "bots_manage_fill_watchplayers" ) == "" )
|
||||||
|
{
|
||||||
|
setcvar( "bots_manage_fill_watchplayers", false ); // add bots when player exists, kick if not
|
||||||
|
}
|
||||||
|
|
||||||
if ( getcvar( "bots_team" ) == "" )
|
if ( getcvar( "bots_team" ) == "" )
|
||||||
{
|
{
|
||||||
@ -994,7 +999,7 @@ addBots_loop()
|
|||||||
|
|
||||||
fillMode = getcvarint( "bots_manage_fill_mode" );
|
fillMode = getcvarint( "bots_manage_fill_mode" );
|
||||||
|
|
||||||
if ( fillMode == 2 || fillMode == 3 )
|
if ( fillMode == 2 || fillMode == 3 || fillMode == 5 )
|
||||||
{
|
{
|
||||||
setcvar( "bots_manage_fill", getGoodMapAmount() );
|
setcvar( "bots_manage_fill", getGoodMapAmount() );
|
||||||
}
|
}
|
||||||
@ -1004,6 +1009,8 @@ addBots_loop()
|
|||||||
players = 0;
|
players = 0;
|
||||||
bots = 0;
|
bots = 0;
|
||||||
spec = 0;
|
spec = 0;
|
||||||
|
axisplayers = 0;
|
||||||
|
alliesplayers = 0;
|
||||||
|
|
||||||
playercount = level.players.size;
|
playercount = level.players.size;
|
||||||
|
|
||||||
@ -1022,37 +1029,6 @@ addBots_loop()
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
players++;
|
players++;
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if ( !randomint( 999 ) )
|
|
||||||
{
|
|
||||||
setcvar( "testclients_doreload", true );
|
|
||||||
wait 0.1;
|
|
||||||
setcvar( "testclients_doreload", false );
|
|
||||||
doExtraCheck();
|
|
||||||
}
|
|
||||||
|
|
||||||
if ( fillMode == 4 )
|
|
||||||
{
|
|
||||||
axisplayers = 0;
|
|
||||||
alliesplayers = 0;
|
|
||||||
|
|
||||||
playercount = level.players.size;
|
|
||||||
|
|
||||||
for ( i = 0; i < playercount; i++ )
|
|
||||||
{
|
|
||||||
player = level.players[ i ];
|
|
||||||
|
|
||||||
if ( player is_bot() )
|
|
||||||
{
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
if ( !isdefined( player.pers[ "team" ] ) )
|
|
||||||
{
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
if ( player.pers[ "team" ] == "axis" )
|
if ( player.pers[ "team" ] == "axis" )
|
||||||
{
|
{
|
||||||
@ -1063,26 +1039,19 @@ addBots_loop()
|
|||||||
alliesplayers++;
|
alliesplayers++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
result = fillAmount - abs( axisplayers - alliesplayers ) + bots;
|
|
||||||
|
if ( getcvarint( "bots_manage_fill_spec" ) )
|
||||||
if ( players == 0 )
|
{
|
||||||
{
|
players += spec;
|
||||||
if ( bots < fillAmount )
|
}
|
||||||
{
|
|
||||||
result = fillAmount - 1;
|
if ( !randomint( 999 ) )
|
||||||
}
|
{
|
||||||
else if ( bots > fillAmount )
|
setcvar( "testclients_doreload", true );
|
||||||
{
|
wait 0.1;
|
||||||
result = fillAmount + 1;
|
setcvar( "testclients_doreload", false );
|
||||||
}
|
doExtraCheck();
|
||||||
else
|
|
||||||
{
|
|
||||||
result = fillAmount;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
bots = result;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
amount = bots;
|
amount = bots;
|
||||||
@ -1090,24 +1059,48 @@ addBots_loop()
|
|||||||
if ( fillMode == 0 || fillMode == 2 )
|
if ( fillMode == 0 || fillMode == 2 )
|
||||||
{
|
{
|
||||||
amount += players;
|
amount += players;
|
||||||
|
}
|
||||||
|
|
||||||
|
// use bots as balance
|
||||||
|
if ( fillMode == 4 || fillMode == 5 )
|
||||||
|
{
|
||||||
|
diffPlayers = abs( alliesplayers - axisplayers );
|
||||||
|
amount = fillAmount - ( diffPlayers - bots );
|
||||||
|
|
||||||
if ( getcvarint( "bots_manage_fill_spec" ) )
|
if ( players + diffPlayers < fillAmount )
|
||||||
{
|
{
|
||||||
amount += spec;
|
amount = players + bots;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ( players <= 0 && getcvarint( "bots_manage_fill_watchplayers" ) )
|
||||||
|
{
|
||||||
|
amount = fillAmount + bots;
|
||||||
|
}
|
||||||
|
|
||||||
if ( amount < fillAmount )
|
if ( amount < fillAmount )
|
||||||
{
|
{
|
||||||
setcvar( "bots_manage_add", 1 );
|
setcvar( "bots_manage_add", fillAmount - amount );
|
||||||
}
|
}
|
||||||
else if ( amount > fillAmount && getcvarint( "bots_manage_fill_kick" ) )
|
else if ( amount > fillAmount && getcvarint( "bots_manage_fill_kick" ) )
|
||||||
{
|
{
|
||||||
tempBot = getBotToKick();
|
botsToKick = amount - fillAmount;
|
||||||
|
|
||||||
if ( isdefined( tempBot ) )
|
if ( botsToKick > 64 )
|
||||||
{
|
{
|
||||||
kick( tempBot getentitynumber() );
|
botsToKick = 64;
|
||||||
|
}
|
||||||
|
|
||||||
|
for ( i = 0; i < botsToKick; i++ )
|
||||||
|
{
|
||||||
|
tempBot = getBotToKick();
|
||||||
|
|
||||||
|
if ( isdefined( tempBot ) )
|
||||||
|
{
|
||||||
|
kick( tempBot getentitynumber(), "EXE_PLAYERKICKED" );
|
||||||
|
|
||||||
|
wait 0.25;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user