Skip to content

Commit

Permalink
some
Browse files Browse the repository at this point in the history
  • Loading branch information
ineed bots committed Mar 11, 2024
1 parent e75ebdd commit 1b7b924
Show file tree
Hide file tree
Showing 4 changed files with 92 additions and 53 deletions.
11 changes: 11 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,9 @@ This mod extends the functionality and features of Combat Training in Black Ops
- Bots have a slight delay after spawning, scales inversely with difficulty.
- Bots can reroll carepackages.
- Bots can use the valkyrie rocket carepackage streak.
- Bots can melee lunge.
- Bots can jumpshot and dropshot.
- Bots can use altmode weapons (gl, ft, mk)

## Installation
0. Download the [latest release](https://github.com/ineedbots/t5_bot_warfare/releases) of Bot Warfare.
Expand Down Expand Up @@ -84,6 +87,14 @@ This mod extends the functionality and features of Combat Training in Black Ops
| bots_play_aim | If the bots can aim. | 1 |

## Changelog
- v1.2.0
- Bots can now melee lunge
- Bots can now jumpshot and dropshot
- Fix some script runtime errors
- Improved bots using altmode weapons
- Reduced variable usage
- Major cleanup

- v1.1.1
- Fixed some script runtime errors
- Improved domination
Expand Down
131 changes: 79 additions & 52 deletions maps/mp/bots/_bot_script.gsc
Original file line number Diff line number Diff line change
Expand Up @@ -168,13 +168,14 @@ bot_on_spawn()
self waittill( "spawned_player" );
self BotBuiltinClearOverrides( true );
self BotBuiltinWeaponOverride( self getcurrentweapon() );
self.bot_is_doing_some_other_override = false;

self.bot_lock_goal = false;
self.help_time = undefined;
self.bot_was_follow_script_update = undefined;
self.bot_attacking_plane = false;

// grenade c4 watcher
// todo: grenade c4 watcher
self thread bot_spawn();
}
}
Expand Down Expand Up @@ -394,6 +395,7 @@ bot_spawn()

self thread bot_revive_think();

// todo:
// stockpile.gsc
// hotel.gsc
// kowloon.gsc
Expand Down Expand Up @@ -423,7 +425,7 @@ bot_spawn()

self thread bot_uav_think();
self thread bot_weapon_think();
// reload cancel
// todo: reload cancel
self thread bot_listen_to_steps();
self thread bot_revenge_think();
self thread follow_target();
Expand Down Expand Up @@ -680,13 +682,15 @@ bot_wait_stop_move()
*/
BotUseRandomEquipment()
{
// todo
}

/*
Bots will look at a random thing
*/
BotLookAtRandomThing( obj_target )
{
// todo
}

/*
Expand Down Expand Up @@ -741,6 +745,7 @@ fire_c4()

for ( ;; )
{
// todo
// self thread BotPressAds( 0.05 );
wait 0.1;
}
Expand Down Expand Up @@ -2477,13 +2482,20 @@ bot_plane_attack( plane )
self botStopMove( true );
self.bot_attacking_plane = true;

if ( self changeToWeapon( weap ) )
if ( !self.bot_is_doing_some_other_override )
{
self do_bot_plane_combat( plane, weap );
self.bot_is_doing_some_other_override = true;

self notify( "bots_aim_overlap" );
self BotBuiltinClearAimOverride();
self BotBuiltinClearButtonOverride( "ads" );
if ( self changeToWeapon( weap ) )
{
self do_bot_plane_combat( plane, weap );

self notify( "bots_aim_overlap" );
self BotBuiltinClearAimOverride();
self BotBuiltinClearButtonOverride( "ads" );
}

self.bot_is_doing_some_other_override = false;
}

self botStopMove( false );
Expand Down Expand Up @@ -6376,39 +6388,47 @@ watch_for_melee_override()
{
dist = distance( self.origin, threat.origin );

if ( self isonground() && self getstance() != "prone" && !self inLastStand() && dist < getdvarfloat( "aim_automelee_range" ) && ( getConeDot( threat.origin, self.origin, self getplayerangles() ) > 0.9 || dist < 10 ) )
if ( !self.bot_is_doing_some_other_override )
{
angles = vectortoangles( threat.origin - self.origin );

self BotBuiltinBotMeleeParams( angles[ 1 ], dist );
self BotBuiltinButtonOverride( "melee", "enable" );
self BotBuiltinAimOverride();
self.bot_is_doing_some_other_override = true;

time_left = 1;
once = false;

while ( time_left > 0 && isdefined( threat ) && isalive( threat ) )
if ( self isonground() && self getstance() != "prone" && !self inLastStand() && dist < getdvarfloat( "aim_automelee_range" ) && ( getConeDot( threat.origin, self.origin, self getplayerangles() ) > 0.9 || dist < 10 ) )
{
self setplayerangles( vectortoangles( threat gettagorigin( "j_spine4" ) - self geteye() ) );
time_left -= 0.05;
wait 0.05;
angles = vectortoangles( threat.origin - self.origin );

self BotBuiltinBotMeleeParams( angles[ 1 ], dist );
self BotBuiltinButtonOverride( "melee", "enable" );
self BotBuiltinAimOverride();

time_left = 1;
once = false;

while ( time_left > 0 && isdefined( threat ) && isalive( threat ) )
{
self setplayerangles( vectortoangles( threat gettagorigin( "j_spine4" ) - self geteye() ) );
time_left -= 0.05;
wait 0.05;

if ( !once )
{
once = true;
self BotBuiltinClearButtonOverride( "melee" );
}
}

if ( !once )
{
once = true;
self BotBuiltinClearButtonOverride( "melee" );
}

self BotBuiltinClearMeleeParams();
self BotBuiltinClearAimOverride();

wait 1;
break;
}

if ( !once )
{
self BotBuiltinClearButtonOverride( "melee" );
}

self BotBuiltinClearMeleeParams();
self BotBuiltinClearAimOverride();
wait 1;
break;
self.bot_is_doing_some_other_override = false;
}

wait 0.05;
Expand Down Expand Up @@ -6480,37 +6500,44 @@ watch_for_override_stuff()
weapon_is_good = false;
}

if ( weapon_is_good && ( dist > NEAR_DIST ) && ( dist < LONG_DIST ) && ( randomint( 100 ) < chance ) && ( ( time - last_jump_time ) > SPAM_JUMP_TIME ) )
if ( !self.bot_is_doing_some_other_override )
{
if ( randomint( 2 ) )
self.bot_is_doing_some_other_override = true;

if ( weapon_is_good && ( dist > NEAR_DIST ) && ( dist < LONG_DIST ) && ( randomint( 100 ) < chance ) && ( ( time - last_jump_time ) > SPAM_JUMP_TIME ) )
{
if ( ( getConeDot( threat.origin, self.origin, self getplayerangles() ) > 0.8 ) && ( dist > ( NEAR_DIST * 2 ) ) )
if ( randomint( 2 ) )
{
if ( ( getConeDot( threat.origin, self.origin, self getplayerangles() ) > 0.8 ) && ( dist > ( NEAR_DIST * 2 ) ) )
{
last_jump_time = time;
need_to_clear_mantle_override = true;
self BotBuiltinMantleOverride();

// drop shot
self BotBuiltinMovementOverride( 0, 0 );
self BotBuiltinButtonOverride( "prone", "enable" );

wait 1.5;

self BotBuiltinClearMovementOverride();
self BotBuiltinClearButtonOverride( "prone" );
}
}
else
{
last_jump_time = time;
need_to_clear_mantle_override = true;
self BotBuiltinMantleOverride();

// drop shot
self BotBuiltinMovementOverride( 0, 0 );
self BotBuiltinButtonOverride( "prone", "enable" );

wait 1.5;

self BotBuiltinClearMovementOverride();
self BotBuiltinClearButtonOverride( "prone" );
// jump shot
self BotBuiltinButtonOverride( "gostand", "enable" );
wait 0.1;
self BotBuiltinClearButtonOverride( "gostand" );
}
}
else
{
last_jump_time = time;
need_to_clear_mantle_override = true;
self BotBuiltinMantleOverride();

// jump shot
self BotBuiltinButtonOverride( "gostand", "enable" );
wait 0.1;
self BotBuiltinClearButtonOverride( "gostand" );
}

self.bot_is_doing_some_other_override = false;
}

thisThreat = self getthreat();
Expand Down
1 change: 1 addition & 0 deletions maps/mp/bots/_bot_utility.gsc
Original file line number Diff line number Diff line change
Expand Up @@ -760,6 +760,7 @@ botStopMove( what )
*/
BotSetStance( what )
{
// todo! make these all proper!
}

/*
Expand Down
2 changes: 1 addition & 1 deletion maps/mp/gametypes/_bot.gsc
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
*/
init()
{
level.bw_version = "1.1.1";
level.bw_version = "1.2.0";

level.bot_offline = false;

Expand Down

0 comments on commit 1b7b924

Please sign in to comment.