Skip to content

Commit

Permalink
Bump version 1.1.1
Browse files Browse the repository at this point in the history
  • Loading branch information
ineedbots committed May 14, 2021
1 parent 5bd1cb6 commit 3537160
Show file tree
Hide file tree
Showing 13 changed files with 281 additions and 47 deletions.
7 changes: 7 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,13 @@ This mod extends the functionality and features of Combat Training in Black Ops
- bots_main_waitForHostTime - a float value, how long in seconds to wait for the host player to connect before adding in bots

## Changelog
- v1.1.1
- Fixed some script runtime errors
- Improved domination
- Bots use altmode weapons
- Improved revenge
- Bots can swap weapons on spawn more likely

- v1.1.0
- Rewrote using CoD4x as a base
- Fixed bots not knifing
Expand Down
2 changes: 1 addition & 1 deletion main_shared/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.0";
level.bw_VERSION = "1.1.1";

level.bot_offline = false;

Expand Down
116 changes: 97 additions & 19 deletions mods/mp_bots/maps/mp/bots/_bot_script.gsc
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,7 @@ bot_damage_callback( eAttacker, iDamage, sMeansOfDeath, sWeapon, eInflictor, sHi
return;

self.killerLocation = undefined;
self.lastKiller = undefined;
if(!IsDefined( self ) || !isDefined(self.team))
return;

Expand Down Expand Up @@ -201,6 +202,7 @@ bot_damage_callback( eAttacker, iDamage, sMeansOfDeath, sWeapon, eInflictor, sHi
return;

self.killerLocation = eAttacker.origin;
self.lastKiller = eAttacker;

if (!isSubStr(sWeapon, "_silencer_"))
self bot_cry_for_help( eAttacker );
Expand Down Expand Up @@ -332,7 +334,10 @@ bot_spawn()
self thread bot_radiation_think();

if (getDvarInt("bots_play_nade"))
{
self thread bot_use_equipment_think();
self thread bot_watch_think_mw2();
}

if (getDvarInt("bots_play_target_other"))
{
Expand Down Expand Up @@ -686,6 +691,9 @@ changeToWeapon(weap)

self SwitchToWeapon(weap);

if (isWeaponAltmode(weap))
self setSpawnWeapon(weap);

self waittill_any_timeout(5, "weapon_change");

return (self GetCurrentWeapon() == weap);
Expand Down Expand Up @@ -2457,7 +2465,7 @@ bot_dogs_think()
}
}

if ( dog.script_owner == self )
if ( isDefined(dog.script_owner) && dog.script_owner == self )
{
continue;
}
Expand Down Expand Up @@ -2527,13 +2535,62 @@ follow_target()
}

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

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

if(self isDefusing() || self isPlanting())
continue;

if (self IsRemoteControlling())
continue;

if (self InLastStand())
continue;

if (isDefined(self GetThreat()))
continue;

tube = self getValidTube();
if (!isDefined(tube))
{
if (self GetAmmoCount("m72_law_mp"))
tube = "m72_law_mp";
else if (self GetAmmoCount("rpg_mp"))
tube = "rpg_mp";
else
continue;
}

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

if (randomInt(100) > 35)
continue;

self ChangeToWeapon(tube);
}
}

/*
Fast swaps or reload cancels don't work cause t5 bots wait for the anim to complete
Bots will think to switch weapons
*/
bot_weapon_think()
{
self endon("death");
self endon("disconnect");
level endon("game_ended");

first = true;

for(;;)
{
Expand All @@ -2554,13 +2611,23 @@ bot_weapon_think()
if (isDefined(threat) && !isPlayer(threat))
continue;

if(curWeap != "none" && self getAmmoCount(curWeap) && curWeap != "strela_mp")
if (first)
{
if(randomInt(100) > 2)
first = false;

if (randomInt(100) > 10)
continue;
}
else
{
if(curWeap != "none" && self getAmmoCount(curWeap) && curWeap != "strela_mp")
{
if(randomInt(100) > 2)
continue;

if(isDefined(threat))
continue;
if(isDefined(threat))
continue;
}
}

weaponslist = self getweaponslist();
Expand All @@ -2573,7 +2640,7 @@ bot_weapon_think()
if(!self getAmmoCount(weapon))
continue;

if (!maps\mp\gametypes\_weapons::isPrimaryWeapon( weapon ) && !maps\mp\gametypes\_weapons::isSideArm( weapon ))
if (!maps\mp\gametypes\_weapons::isPrimaryWeapon( weapon ) && !maps\mp\gametypes\_weapons::isSideArm( weapon ) && !isWeaponAltmode(weapon))
continue;

if(curWeap == weapon || weapon == "none" || weapon == "" || weapon == "strela_mp")
Expand Down Expand Up @@ -2760,6 +2827,14 @@ bot_revenge_think()
{
self endon( "death" );
self endon( "disconnect" );

if (isDefined(self.lastKiller) && isAlive(self.lastKiller))
{
if(bulletTracePassed(self getEye(), self.lastKiller getTagOrigin( "j_spineupper" ), false, self.lastKiller))
{
self setAttacker(self.lastKiller);
}
}

if(!isDefined(self.killerLocation))
return;
Expand Down Expand Up @@ -3094,20 +3169,23 @@ bot_dom_cap_think()

otherFlagCount = maps\mp\gametypes\dom::getTeamFlagCount( otherTeam );

if ( myFlagCount < otherFlagCount )
if (game["teamScores"][myteam] >= game["teamScores"][otherTeam])
{
if ( randomint( 100 ) < 15 )
continue;
}
else if ( myFlagCount == otherFlagCount )
{
if ( randomint( 100 ) < 35 )
continue;
}
else if ( myFlagCount > otherFlagCount )
{
if ( randomint( 100 ) < 95 )
continue;
if ( myFlagCount < otherFlagCount )
{
if ( randomint( 100 ) < 15 )
continue;
}
else if ( myFlagCount == otherFlagCount )
{
if ( randomint( 100 ) < 35 )
continue;
}
else if ( myFlagCount > otherFlagCount )
{
if ( randomint( 100 ) < 95 )
continue;
}
}

flag = undefined;
Expand Down
38 changes: 35 additions & 3 deletions mods/mp_bots/maps/mp/bots/_bot_utility.gsc
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,38 @@ GetBotDiffNum()
return num;
}

/*
is the weapon alt mode?
*/
isWeaponAltmode(weap)
{
if (isStrStart(weap, "gl_") || isStrStart(weap, "ft_") || isStrStart(weap, "mk_"))
return true;

return false;
}

/*
Returns a valid grenade launcher weapon
*/
getValidTube()
{
weaps = self getweaponslist();

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

if(!self getAmmoCount(weap))
continue;

if ((isSubStr(weap, "gl_") && !isSubStr(weap, "_gl_")) || weap == "china_lake_mp")
return weap;
}

return undefined;
}

/*
Taken from iw4 script
*/
Expand Down Expand Up @@ -332,9 +364,9 @@ doExtraCheck()
*/
getConeDot(to, from, dir)
{
dirToTarget = VectorNormalize(to-from);
forward = AnglesToForward(dir);
return vectordot(dirToTarget, forward);
dirToTarget = VectorNormalize(to-from);
forward = AnglesToForward(dir);
return vectordot(dirToTarget, forward);
}

/*
Expand Down
2 changes: 1 addition & 1 deletion mods/mp_bots/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.0";
level.bw_VERSION = "1.1.1";

level.bot_offline = false;

Expand Down
Loading

0 comments on commit 3537160

Please sign in to comment.