Skip to content

Commit

Permalink
Bots use altmode
Browse files Browse the repository at this point in the history
  • Loading branch information
ineed bots committed Dec 17, 2023
1 parent d91b480 commit 0eec406
Showing 1 changed file with 67 additions and 7 deletions.
74 changes: 67 additions & 7 deletions scripts/mp/bots.gsc
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,6 @@
*/

#include maps\mp\gametypes\_globallogic_utils;
#include maps\mp\bots\_bot_combat;
#include maps\mp\bots\_bot;
#include maps\mp\gametypes\_gameobjects;
#include maps\mp\_utility;
#include common_scripts\utility;

Expand Down Expand Up @@ -703,9 +700,12 @@ onBotSpawned()
for ( ;; )
{
self waittill( "spawned_player" );
self BotBuiltinClearOverrides( true );
self BotBuiltinWeaponOverride( self getCurrentWeapon() );

self thread watch_for_override_stuff();
self thread watch_for_melee_override();
self thread bot_watch_think_mw2();
self BotNotifyBotEvent( "debug", "we spawned!" );

waittillframeend;
Expand All @@ -717,6 +717,70 @@ onBotSpawned()
}
}

/*
Gets a GL
*/
getValidTube()
{
weaps = self getweaponslist( true );

for ( i = 0; i < weaps.size; i++ )
{
weap = weaps[i];

if ( !self GetAmmoCount( weap ) )
continue;

if ( !isstrstart( weap, "gl_" ) )
continue;

return weap;
}

return undefined;
}

/*
Bots play mw2
*/
bot_watch_think_mw2()
{
self endon( "disconnect" );
self endon( "death" );
level endon( "game_ended" );

for ( ;; )
{
wait randomIntRange( 1, 4 );

if ( self IsRemoteControlling() )
continue;

if ( self maps\mp\bots\_bot_combat::bot_has_enemy() )
continue;

tube = self getValidTube();

if ( !isDefined( tube ) )
{
if ( self GetAmmoCount( "usrpg_mp" ) )
tube = "usrpg_mp";
else if ( self GetAmmoCount( "smaw_mp" ) )
tube = "smaw_mp";
else
return;
}

if ( self GetCurrentWeapon() == tube )
return;

if ( randomInt( 100 ) > 35 )
return;

self switchtoweapon( tube );
}
}

/*
custom movement stuff
*/
Expand All @@ -725,8 +789,6 @@ watch_for_melee_override()
self endon( "disconnect" );
self endon( "death" );

self BotBuiltinClearMeleeParams();

for ( ;; )
{
while ( ( !self maps\mp\bots\_bot_combat::threat_is_player() && !self maps\mp\bots\_bot_combat::threat_is_dog() ) || self IsRemoteControlling() || !self HasWeapon( "knife_mp" ) || !getDvarInt( "aim_automelee_enabled" ) )
Expand Down Expand Up @@ -782,8 +844,6 @@ watch_for_override_stuff()
self endon( "disconnect" );
self endon( "death" );

self BotBuiltinClearOverrides( true );

NEAR_DIST = 80;
LONG_DIST = 1000;
SPAM_JUMP_TIME = 5000;
Expand Down

0 comments on commit 0eec406

Please sign in to comment.