Compare commits

..

No commits in common. "master" and "v2.3.0" have entirely different histories.

5 changed files with 91 additions and 192 deletions

View File

@ -75,20 +75,19 @@ You can find the ModDB release post [here](https://www.moddb.com/mods/bot-warfar
| bots_main_GUIDs | A comma separated list of GUIDs of players who will be given host. | | | bots_main_GUIDs | A comma separated list of GUIDs of players who will be given host. | |
| bots_main_waitForHostTime | How many seconds to wait for the host player to connect before adding bots to the match. | 10 | | bots_main_waitForHostTime | How many seconds to wait for the host player to connect before adding bots to the match. | 10 |
| bots_main_menu | Enable the in-game menu for hosts. | 1 | | bots_main_menu | Enable the in-game menu for hosts. | 1 |
| bots_main_debug | Enable the in-game waypoint editor at start of the game, or enable bot event prints. <ul><li>`0` - disable</li><li>`1` - for just debug events</li><li>`2` - for every event</li><ul> | 0 | | bots_main_debug | Enable the in-game waypoint editor. | 0 |
| bots_main_kickBotsAtEnd | Kick the bots at the end of a match. | 0 | | bots_main_kickBotsAtEnd | Kick the bots at the end of a match. | 0 |
| bots_main_chat | The rate bots will chat at, set to 0 to disable. | 1.0 | | bots_main_chat | The rate bots will chat at, set to 0 to disable. | 1.0 |
| bots_manage_add | Amount of bots to add to the game, once bots are added, resets back to `0`. | 0 | | bots_manage_add | Amount of bots to add to the game, once bots are added, resets back to `0`. | 0 |
| bots_manage_fill | Amount of players/bots (look at `bots_manage_fill_mode`) to maintain in the match. | 0 | | bots_manage_fill | Amount of players/bots (look at `bots_manage_fill_mode`) to maintain in the match. | 0 |
| bots_manage_fill_mode | `bots_manage_fill` players/bots counting method.<ul><li>`0` - counts both players and bots.</li><li>`1` - only counts bots.</li><li>`2` - exactly `0` but auto adjusts `bots_manage_fill` to map.</li><li>`3` - exactly `1` but auto adjusts `bots_manage_fill` to map.</li><li>`4` - bots are used for balancing teams.</li><li>`5` - exactly `4` but auto adjusts `bots_manage_fill` to map.</li></ul> | 0 | | bots_manage_fill_mode | `bots_manage_fill` players/bots counting method.<ul><li>`0` - counts both players and bots.</li><li>`1` - only counts bots.</li></ul> | 0 |
| bots_manage_fill_watchplayers | Bots will not be added until one player is in the game | 0 | | bots_manage_fill_kick | If the amount of players/bots in the match exceeds `bots_manage_fill`, kick bots until no longer exceeds. | 0 |
| bots_manage_fill_kick | If the amount of players/bots in the match exceeds `bots_manage_fill`, kick bots until no longer exceeds. | 0 |
| bots_manage_fill_spec | If when counting players for `bots_manage_fill` should include spectators. | 1 | | bots_manage_fill_spec | If when counting players for `bots_manage_fill` should include spectators. | 1 |
| bots_team | One of `autoassign`, `allies`, `axis`, `spectator`, or `custom`. What team the bots should be on. | autoassign | | bots_team | One of `autoassign`, `allies`, `axis`, `spectator`, or `custom`. What team the bots should be on. | autoassign |
| bots_team_amount | When `bots_team` is set to `custom`. The amount of bots to be placed on the axis team. The remainder will be placed on the allies team. | 0 | | bots_team_amount | When `bots_team` is set to `custom`. The amount of bots to be placed on the axis team. The remainder will be placed on the allies team. | 0 |
| bots_team_force | If the server should force bots' teams according to the `bots_team` value. When `bots_team` is `autoassign`, unbalanced teams will be balanced. This dvar is ignored when `bots_team` is `custom`. | 0 | | bots_team_force | If the server should force bots' teams according to the `bots_team` value. When `bots_team` is `autoassign`, unbalanced teams will be balanced. This dvar is ignored when `bots_team` is `custom`. | 0 |
| bots_team_mode | When `bots_team_force` is `1` and `bots_team` is `autoassign`, players/bots counting method. <ul><li>`0` - counts both players and bots.</li><li>`1` - only counts bots</li></ul> | 0 | | bots_team_mode | When `bots_team_force` is `true` and `bots_team` is `autoassign`, players/bots counting method. <ul><li>`0` - counts both players and bots.</li><li>`1` - only counts bots</li></ul> | 0 |
| bots_skill | Bots' difficulty.<ul><li>`0` - Random difficulty for each bot.</li><li>`1` - Easiest difficulty for all bots.</li><li>`2` to `6` - Between easy and hard difficulty for all bots.</li><li>`7` - The hardest difficulty for all bots.</li><li>`8` - custom (look at the `bots_skill_<team>_<difficulty>` dvars)</li><li>`9` - Every difficulty parameter is randomized</li></ul> | 0 | | bots_skill | Bots' difficulty.<ul><li>`0` - Random difficulty for each bot.</li><li>`1` - Easiest difficulty for all bots.</li><li>`2` to `6` - Between easy and hard difficulty for all bots.</li><li>`7` - The hardest difficulty for all bots.</li><li>`8` - custom (look at the `bots_skill_<team>_<difficulty>` dvars)</li></ul> | 0 |
| bots_skill_axis_hard | When `bots_skill` is set to `8`, the amount of hard difficulty bots to set on the axis team. | 0 | | bots_skill_axis_hard | When `bots_skill` is set to `8`, the amount of hard difficulty bots to set on the axis team. | 0 |
| bots_skill_axis_med | When `bots_skill` is set to `8`, the amount of medium difficulty bots to set on the axis team. The remaining bots on the team will be set to easy difficulty. | 0 | | bots_skill_axis_med | When `bots_skill` is set to `8`, the amount of medium difficulty bots to set on the axis team. The remaining bots on the team will be set to easy difficulty. | 0 |
| bots_skill_allies_hard | When `bots_skill` is set to `8`, the amount of hard difficulty bots to set on the allies team. | 0 | | bots_skill_allies_hard | When `bots_skill` is set to `8`, the amount of hard difficulty bots to set on the allies team. | 0 |
@ -113,14 +112,11 @@ You can find the ModDB release post [here](https://www.moddb.com/mods/bot-warfar
| bots_play_aim | If the bots can aim. | 1 | | bots_play_aim | If the bots can aim. | 1 |
## Changelog ## Changelog
- v2.3.0 - v2.3.0 (not released yet)
- Fixed bots aiming in ac130/chopper being broken at times - Fixed bots aiming in ac130/chopper being broken at times
- Bots properly use pred missiles - Bots properly use pred missiles
- Smoothed bot aim at range - Smoothed bot aim at range
- Fixed bots_manage_fill_spec players being counted with bots_manage_fill_mode 1 (bot only) - Fixed bots_manage_fill_spec players being counted with bots_manage_fill_mode 1 (bot only)
- Added bots_manage_fill_watchplayers dvar
- Bots hop off turrets if they get stuck on one
- Fixed script variable leak with opening and closing the in-game menu
- v2.2.0 - v2.2.0
- Bots can now melee lunge - Bots can now melee lunge
@ -137,7 +133,7 @@ You can find the ModDB release post [here](https://www.moddb.com/mods/bot-warfar
- INeedGames - http://www.moddb.com/mods/bot-warfare - INeedGames - http://www.moddb.com/mods/bot-warfare
- tinkie101 - https://web.archive.org/web/20120326060712/http://alteriw.net/viewtopic.php?f=72&t=4869 - tinkie101 - https://web.archive.org/web/20120326060712/http://alteriw.net/viewtopic.php?f=72&t=4869
- PeZBot team - http://www.moddb.com/mods/pezbot - PeZBot team - http://www.moddb.com/mods/pezbot
- apdonato - https://web.archive.org/web/20240516065610/http://rsebots.blogspot.com/ - apdonato - http://rsebots.blogspot.ca/
- Ability - Ability
- Salvation - Salvation
- Xensik - https://github.com/xensik/gsc-tool - Xensik - https://github.com/xensik/gsc-tool

View File

@ -80,11 +80,6 @@ init()
setdvar( "bots_manage_fill_kick", false ); // kick bots if too many setdvar( "bots_manage_fill_kick", false ); // kick bots if too many
} }
if ( getdvar( "bots_manage_fill_watchplayers" ) == "" )
{
setdvar( "bots_manage_fill_watchplayers", false ); // add bots when player exists, kick if not
}
if ( getdvar( "bots_team" ) == "" ) if ( getdvar( "bots_team" ) == "" )
{ {
setdvar( "bots_team", "autoassign" ); // which team for bots to join setdvar( "bots_team", "autoassign" ); // which team for bots to join
@ -295,8 +290,6 @@ init()
level thread handleBots(); level thread handleBots();
level thread onPlayerChat(); level thread onPlayerChat();
array_thread( getentarray( "misc_turret", "classname" ), ::turret_monitoruse_watcher );
} }
/* /*
@ -945,10 +938,10 @@ connected()
level.bots[ level.bots.size ] = self; level.bots[ level.bots.size ] = self;
self thread onDisconnect(); self thread onDisconnect();
self thread watchBotDebugEvent();
waittillframeend; // wait for waittills to process
level notify( "bot_connected", self ); level notify( "bot_connected", self );
self thread watchBotDebugEvent();
} }
/* /*
@ -1348,7 +1341,7 @@ addBots_loop()
fillMode = getdvarint( "bots_manage_fill_mode" ); fillMode = getdvarint( "bots_manage_fill_mode" );
if ( fillMode == 2 || fillMode == 3 || fillMode == 5 ) if ( fillMode == 2 || fillMode == 3 )
{ {
setdvar( "bots_manage_fill", getGoodMapAmount() ); setdvar( "bots_manage_fill", getGoodMapAmount() );
} }
@ -1358,8 +1351,6 @@ 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;
@ -1378,23 +1369,9 @@ addBots_loop()
else else
{ {
players++; players++;
if ( player.pers[ "team" ] == "axis" )
{
axisplayers++;
}
else if ( player.pers[ "team" ] == "allies" )
{
alliesplayers++;
}
} }
} }
if ( getdvarint( "bots_manage_fill_spec" ) )
{
players += spec;
}
if ( !randomint( 999 ) ) if ( !randomint( 999 ) )
{ {
setdvar( "testclients_doreload", true ); setdvar( "testclients_doreload", true );
@ -1403,53 +1380,81 @@ addBots_loop()
doExtraCheck(); 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" )
{
axisplayers++;
}
else if ( player.pers[ "team" ] == "allies" )
{
alliesplayers++;
}
}
result = fillAmount - abs( axisplayers - alliesplayers ) + bots;
if ( players == 0 )
{
if ( bots < fillAmount )
{
result = fillAmount - 1;
}
else if ( bots > fillAmount )
{
result = fillAmount + 1;
}
else
{
result = fillAmount;
}
}
bots = result;
}
amount = bots; amount = bots;
if ( fillMode == 0 || fillMode == 2 ) if ( fillMode == 0 || fillMode == 2 )
{ {
amount += players; amount += players;
}
// use bots as balance if ( getdvarint( "bots_manage_fill_spec" ) )
if ( fillMode == 4 || fillMode == 5 )
{
diffPlayers = abs( alliesplayers - axisplayers );
amount = fillAmount - ( diffPlayers - bots );
if ( players + diffPlayers < fillAmount )
{ {
amount = players + bots; amount += spec;
} }
} }
if ( players <= 0 && getdvarint( "bots_manage_fill_watchplayers" ) )
{
amount = fillAmount + bots;
}
if ( amount < fillAmount ) if ( amount < fillAmount )
{ {
setdvar( "bots_manage_add", fillAmount - amount ); setdvar( "bots_manage_add", 1 );
} }
else if ( amount > fillAmount && getdvarint( "bots_manage_fill_kick" ) ) else if ( amount > fillAmount && getdvarint( "bots_manage_fill_kick" ) )
{ {
botsToKick = amount - fillAmount; tempBot = getBotToKick();
if ( botsToKick > 64 ) if ( isdefined( tempBot ) )
{ {
botsToKick = 64; kick( tempBot getentitynumber() );
}
for ( i = 0; i < botsToKick; i++ )
{
tempBot = getBotToKick();
if ( isdefined( tempBot ) )
{
kick( tempBot getentitynumber(), "EXE_PLAYERKICKED" );
wait 0.25;
}
} }
} }
} }
@ -1612,39 +1617,3 @@ onPlayerChat()
} }
} }
} }
/*
Monitors turret usage
*/
turret_monitoruse_watcher()
{
self endon( "death" );
for ( ;; )
{
self waittill ( "trigger", player );
self monitor_player_turret( player );
self.owner = undefined;
if ( isdefined( player ) )
{
player.turret = undefined;
}
}
}
/*
While player uses turret
*/
monitor_player_turret( player )
{
player endon( "death" );
player endon( "disconnect" );
player.turret = self;
self.owner = player;
self waittill( "turret_deactivate" );
}

View File

@ -843,13 +843,6 @@ watchPickupGun()
continue; continue;
} }
// todo have bots use turrets instead of just kicking them off of it
if ( isdefined( self.turret ) )
{
self thread use( 0.5 );
continue;
}
weap = self getcurrentweapon(); weap = self getcurrentweapon();
if ( weap != "none" && self getammocount( weap ) ) if ( weap != "none" && self getammocount( weap ) )

View File

@ -2455,7 +2455,7 @@ bot_think_camp_loop()
self SetScriptGoal( campSpot.origin, 16 ); self SetScriptGoal( campSpot.origin, 16 );
time = randomintrange( 30, 90 ); time = randomintrange( 10, 20 );
self BotNotifyBotEvent( "camp", "go", campSpot, time ); self BotNotifyBotEvent( "camp", "go", campSpot, time );
@ -2514,17 +2514,7 @@ killCampAfterTime( time )
self endon( "disconnect" ); self endon( "disconnect" );
self endon( "kill_camp_bot" ); self endon( "kill_camp_bot" );
timeleft = maps\mp\gametypes\_gamelogic::gettimeremaining() / 1000; wait time + 0.05;
while ( time > 0 && timeleft >= 60 )
{
wait 1;
timeleft = maps\mp\gametypes\_gamelogic::gettimeremaining() / 1000;
time--;
}
wait 0.05;
self ClearScriptGoal(); self ClearScriptGoal();
self ClearScriptAimPos(); self ClearScriptAimPos();

View File

@ -55,47 +55,6 @@ watchPlayers()
} }
} }
destroyFixed()
{
if ( !isdefined( self ) )
{
return;
}
self destroy();
}
removeChildFixed( element )
{
temp = [];
for ( i = 0; i < self.children.size ; i++ )
{
if ( isdefined( self.children[ i ] ) && self.children[ i ] != element )
{
self.children[ i ].index = temp.size;
temp[ temp.size ] = self.children[ i ];
}
}
self.children = temp;
}
destroyElemFixed()
{
if ( !isdefined( self ) )
{
return;
}
if ( isdefined( self.parent ) )
{
self.parent removeChildFixed( self );
}
self destroyelem();
}
kill_menu() kill_menu()
{ {
self notify( "bots_kill_menu" ); self notify( "bots_kill_menu" );
@ -107,6 +66,7 @@ init_menu()
self.menuinit = true; self.menuinit = true;
self.menuopen = false; self.menuopen = false;
self.menu_player = undefined;
self.submenu = "Main"; self.submenu = "Main";
self.curs[ "Main" ][ "X" ] = 0; self.curs[ "Main" ][ "X" ] = 0;
self addOptions(); self addOptions();
@ -135,7 +95,7 @@ watchDisconnect()
{ {
if ( isdefined( self.menutexty[ i ] ) ) if ( isdefined( self.menutexty[ i ] ) )
{ {
self.menutexty[ i ] destroyElemFixed(); self.menutexty[ i ] destroy();
} }
} }
} }
@ -146,7 +106,7 @@ watchDisconnect()
{ {
if ( isdefined( self.menutext[ i ] ) ) if ( isdefined( self.menutext[ i ] ) )
{ {
self.menutext[ i ] destroyElemFixed(); self.menutext[ i ] destroy();
} }
} }
} }
@ -155,18 +115,18 @@ watchDisconnect()
{ {
if ( isdefined( self.menu[ "X" ][ "Shader" ] ) ) if ( isdefined( self.menu[ "X" ][ "Shader" ] ) )
{ {
self.menu[ "X" ][ "Shader" ] destroyElemFixed(); self.menu[ "X" ][ "Shader" ] destroy();
} }
if ( isdefined( self.menu[ "X" ][ "Scroller" ] ) ) if ( isdefined( self.menu[ "X" ][ "Scroller" ] ) )
{ {
self.menu[ "X" ][ "Scroller" ] destroyElemFixed(); self.menu[ "X" ][ "Scroller" ] destroy();
} }
} }
if ( isdefined( self.menuversionhud ) ) if ( isdefined( self.menuversionhud ) )
{ {
self.menuversionhud destroyFixed(); self.menuversionhud destroy();
} }
} }
} }
@ -372,7 +332,7 @@ OpenSub( menu, menu2 )
{ {
if ( isdefined( self.menutext[ i ] ) ) if ( isdefined( self.menutext[ i ] ) )
{ {
self.menutext[ i ] destroyElemFixed(); self.menutext[ i ] destroy();
} }
} }
} }
@ -381,18 +341,18 @@ OpenSub( menu, menu2 )
{ {
if ( isdefined( self.menu[ "X" ][ "Shader" ] ) ) if ( isdefined( self.menu[ "X" ][ "Shader" ] ) )
{ {
self.menu[ "X" ][ "Shader" ] destroyElemFixed(); self.menu[ "X" ][ "Shader" ] destroy();
} }
if ( isdefined( self.menu[ "X" ][ "Scroller" ] ) ) if ( isdefined( self.menu[ "X" ][ "Scroller" ] ) )
{ {
self.menu[ "X" ][ "Scroller" ] destroyElemFixed(); self.menu[ "X" ][ "Scroller" ] destroy();
} }
} }
if ( isdefined( self.menuversionhud ) ) if ( isdefined( self.menuversionhud ) )
{ {
self.menuversionhud destroyFixed(); self.menuversionhud destroy();
} }
for ( i = 0 ; i < self.option[ "Name" ][ self.submenu ].size ; i++ ) for ( i = 0 ; i < self.option[ "Name" ][ self.submenu ].size ; i++ )
@ -442,7 +402,7 @@ OpenSub( menu, menu2 )
{ {
if ( isdefined( self.menutexty[ i ] ) ) if ( isdefined( self.menutexty[ i ] ) )
{ {
self.menutexty[ i ] destroyElemFixed(); self.menutexty[ i ] destroy();
} }
} }
} }
@ -466,11 +426,11 @@ CursMove( direction )
if ( self.submenu == "Main" ) if ( self.submenu == "Main" )
{ {
self.menu[ "X" ][ "Scroller" ].x = self.menutext[ self.curs[ "Main" ][ "X" ] ].x;
self.menu[ "X" ][ "Scroller" ].y = self.menutext[ self.curs[ "Main" ][ "X" ] ].y;
if ( isdefined( self.menutext ) ) if ( isdefined( self.menutext ) )
{ {
self.menu[ "X" ][ "Scroller" ].x = self.menutext[ self.curs[ "Main" ][ "X" ] ].x;
self.menu[ "X" ][ "Scroller" ].y = self.menutext[ self.curs[ "Main" ][ "X" ] ].y;
for ( i = 0; i < self.menutext.size; i++ ) for ( i = 0; i < self.menutext.size; i++ )
{ {
if ( isdefined( self.menutext[ i ] ) ) if ( isdefined( self.menutext[ i ] ) )
@ -618,7 +578,7 @@ ExitSub()
{ {
if ( isdefined( self.menutexty[ i ] ) ) if ( isdefined( self.menutexty[ i ] ) )
{ {
self.menutexty[ i ] destroyElemFixed(); self.menutexty[ i ] destroy();
} }
} }
} }
@ -643,7 +603,7 @@ ExitMenu()
{ {
if ( isdefined( self.menutext[ i ] ) ) if ( isdefined( self.menutext[ i ] ) )
{ {
self.menutext[ i ] destroyElemFixed(); self.menutext[ i ] destroy();
} }
} }
} }
@ -652,18 +612,18 @@ ExitMenu()
{ {
if ( isdefined( self.menu[ "X" ][ "Shader" ] ) ) if ( isdefined( self.menu[ "X" ][ "Shader" ] ) )
{ {
self.menu[ "X" ][ "Shader" ] destroyElemFixed(); self.menu[ "X" ][ "Shader" ] destroy();
} }
if ( isdefined( self.menu[ "X" ][ "Scroller" ] ) ) if ( isdefined( self.menu[ "X" ][ "Scroller" ] ) )
{ {
self.menu[ "X" ][ "Scroller" ] destroyElemFixed(); self.menu[ "X" ][ "Scroller" ] destroy();
} }
} }
if ( isdefined( self.menuversionhud ) ) if ( isdefined( self.menuversionhud ) )
{ {
self.menuversionhud destroyFixed(); self.menuversionhud destroy();
} }
self.menuopen = false; self.menuopen = false;
@ -768,10 +728,6 @@ addOptions()
_temp = "bots used as team balance"; _temp = "bots used as team balance";
break; break;
case 5:
_temp = "bots used as team balance, adjust to map";
break;
default: default:
_temp = "out of range"; _temp = "out of range";
break; break;
@ -1364,11 +1320,6 @@ man_bots( a, b )
self iprintln( "bot_fill will now use bots as team balance." ); self iprintln( "bot_fill will now use bots as team balance." );
break; break;
case 4:
setdvar( "bots_manage_fill_mode", 5 );
self iprintln( "bot_fill will now use bots as team balance, adjusting to map." );
break;
default: default:
setdvar( "bots_manage_fill_mode", 0 ); setdvar( "bots_manage_fill_mode", 0 );
self iprintln( "bot_fill will now count everyone." ); self iprintln( "bot_fill will now count everyone." );