Bump version 1.1.1

This commit is contained in:
ineedbots 2021-05-14 16:00:53 -06:00
parent 5bd1cb6448
commit 3537160233
13 changed files with 281 additions and 47 deletions

View File

@ -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 - bots_main_waitForHostTime - a float value, how long in seconds to wait for the host player to connect before adding in bots
## Changelog ## 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 - v1.1.0
- Rewrote using CoD4x as a base - Rewrote using CoD4x as a base
- Fixed bots not knifing - Fixed bots not knifing

View File

@ -15,7 +15,7 @@
*/ */
init() init()
{ {
level.bw_VERSION = "1.1.0"; level.bw_VERSION = "1.1.1";
level.bot_offline = false; level.bot_offline = false;

View File

@ -173,6 +173,7 @@ bot_damage_callback( eAttacker, iDamage, sMeansOfDeath, sWeapon, eInflictor, sHi
return; return;
self.killerLocation = undefined; self.killerLocation = undefined;
self.lastKiller = undefined;
if(!IsDefined( self ) || !isDefined(self.team)) if(!IsDefined( self ) || !isDefined(self.team))
return; return;
@ -201,6 +202,7 @@ bot_damage_callback( eAttacker, iDamage, sMeansOfDeath, sWeapon, eInflictor, sHi
return; return;
self.killerLocation = eAttacker.origin; self.killerLocation = eAttacker.origin;
self.lastKiller = eAttacker;
if (!isSubStr(sWeapon, "_silencer_")) if (!isSubStr(sWeapon, "_silencer_"))
self bot_cry_for_help( eAttacker ); self bot_cry_for_help( eAttacker );
@ -332,7 +334,10 @@ bot_spawn()
self thread bot_radiation_think(); self thread bot_radiation_think();
if (getDvarInt("bots_play_nade")) if (getDvarInt("bots_play_nade"))
{
self thread bot_use_equipment_think(); self thread bot_use_equipment_think();
self thread bot_watch_think_mw2();
}
if (getDvarInt("bots_play_target_other")) if (getDvarInt("bots_play_target_other"))
{ {
@ -686,6 +691,9 @@ changeToWeapon(weap)
self SwitchToWeapon(weap); self SwitchToWeapon(weap);
if (isWeaponAltmode(weap))
self setSpawnWeapon(weap);
self waittill_any_timeout(5, "weapon_change"); self waittill_any_timeout(5, "weapon_change");
return (self GetCurrentWeapon() == weap); return (self GetCurrentWeapon() == weap);
@ -2457,7 +2465,7 @@ bot_dogs_think()
} }
} }
if ( dog.script_owner == self ) if ( isDefined(dog.script_owner) && dog.script_owner == self )
{ {
continue; continue;
} }
@ -2527,6 +2535,53 @@ 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 Bots will think to switch weapons
*/ */
bot_weapon_think() bot_weapon_think()
@ -2535,6 +2590,8 @@ bot_weapon_think()
self endon("disconnect"); self endon("disconnect");
level endon("game_ended"); level endon("game_ended");
first = true;
for(;;) for(;;)
{ {
self waittill_any_timeout(randomIntRange(2, 4), "bot_force_check_switch"); self waittill_any_timeout(randomIntRange(2, 4), "bot_force_check_switch");
@ -2554,6 +2611,15 @@ bot_weapon_think()
if (isDefined(threat) && !isPlayer(threat)) if (isDefined(threat) && !isPlayer(threat))
continue; continue;
if (first)
{
first = false;
if (randomInt(100) > 10)
continue;
}
else
{
if(curWeap != "none" && self getAmmoCount(curWeap) && curWeap != "strela_mp") if(curWeap != "none" && self getAmmoCount(curWeap) && curWeap != "strela_mp")
{ {
if(randomInt(100) > 2) if(randomInt(100) > 2)
@ -2562,6 +2628,7 @@ bot_weapon_think()
if(isDefined(threat)) if(isDefined(threat))
continue; continue;
} }
}
weaponslist = self getweaponslist(); weaponslist = self getweaponslist();
weap = ""; weap = "";
@ -2573,7 +2640,7 @@ bot_weapon_think()
if(!self getAmmoCount(weapon)) if(!self getAmmoCount(weapon))
continue; 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; continue;
if(curWeap == weapon || weapon == "none" || weapon == "" || weapon == "strela_mp") if(curWeap == weapon || weapon == "none" || weapon == "" || weapon == "strela_mp")
@ -2761,6 +2828,14 @@ bot_revenge_think()
self endon( "death" ); self endon( "death" );
self endon( "disconnect" ); 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)) if(!isDefined(self.killerLocation))
return; return;
@ -3094,6 +3169,8 @@ bot_dom_cap_think()
otherFlagCount = maps\mp\gametypes\dom::getTeamFlagCount( otherTeam ); otherFlagCount = maps\mp\gametypes\dom::getTeamFlagCount( otherTeam );
if (game["teamScores"][myteam] >= game["teamScores"][otherTeam])
{
if ( myFlagCount < otherFlagCount ) if ( myFlagCount < otherFlagCount )
{ {
if ( randomint( 100 ) < 15 ) if ( randomint( 100 ) < 15 )
@ -3109,6 +3186,7 @@ bot_dom_cap_think()
if ( randomint( 100 ) < 95 ) if ( randomint( 100 ) < 95 )
continue; continue;
} }
}
flag = undefined; flag = undefined;
flags = []; flags = [];

View File

@ -145,6 +145,38 @@ GetBotDiffNum()
return num; 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 Taken from iw4 script
*/ */

View File

@ -15,7 +15,7 @@
*/ */
init() init()
{ {
level.bw_VERSION = "1.1.0"; level.bw_VERSION = "1.1.1";
level.bot_offline = false; level.bot_offline = false;

View File

@ -173,6 +173,7 @@ bot_damage_callback( eAttacker, iDamage, sMeansOfDeath, sWeapon, eInflictor, sHi
return; return;
self.killerLocation = undefined; self.killerLocation = undefined;
self.lastKiller = undefined;
if(!IsDefined( self ) || !isDefined(self.team)) if(!IsDefined( self ) || !isDefined(self.team))
return; return;
@ -201,6 +202,7 @@ bot_damage_callback( eAttacker, iDamage, sMeansOfDeath, sWeapon, eInflictor, sHi
return; return;
self.killerLocation = eAttacker.origin; self.killerLocation = eAttacker.origin;
self.lastKiller = eAttacker;
if (!isSubStr(sWeapon, "_silencer_")) if (!isSubStr(sWeapon, "_silencer_"))
self bot_cry_for_help( eAttacker ); self bot_cry_for_help( eAttacker );
@ -332,7 +334,10 @@ bot_spawn()
self thread bot_radiation_think(); self thread bot_radiation_think();
if (getDvarInt("bots_play_nade")) if (getDvarInt("bots_play_nade"))
{
self thread bot_use_equipment_think(); self thread bot_use_equipment_think();
self thread bot_watch_think_mw2();
}
if (getDvarInt("bots_play_target_other")) if (getDvarInt("bots_play_target_other"))
{ {
@ -686,6 +691,9 @@ changeToWeapon(weap)
self SwitchToWeapon(weap); self SwitchToWeapon(weap);
if (isWeaponAltmode(weap))
self setSpawnWeapon(weap);
self waittill_any_timeout(5, "weapon_change"); self waittill_any_timeout(5, "weapon_change");
return (self GetCurrentWeapon() == weap); return (self GetCurrentWeapon() == weap);
@ -2457,7 +2465,7 @@ bot_dogs_think()
} }
} }
if ( dog.script_owner == self ) if ( isDefined(dog.script_owner) && dog.script_owner == self )
{ {
continue; continue;
} }
@ -2527,6 +2535,53 @@ 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 Bots will think to switch weapons
*/ */
bot_weapon_think() bot_weapon_think()
@ -2535,6 +2590,8 @@ bot_weapon_think()
self endon("disconnect"); self endon("disconnect");
level endon("game_ended"); level endon("game_ended");
first = true;
for(;;) for(;;)
{ {
self waittill_any_timeout(randomIntRange(2, 4), "bot_force_check_switch"); self waittill_any_timeout(randomIntRange(2, 4), "bot_force_check_switch");
@ -2554,6 +2611,15 @@ bot_weapon_think()
if (isDefined(threat) && !isPlayer(threat)) if (isDefined(threat) && !isPlayer(threat))
continue; continue;
if (first)
{
first = false;
if (randomInt(100) > 10)
continue;
}
else
{
if(curWeap != "none" && self getAmmoCount(curWeap) && curWeap != "strela_mp") if(curWeap != "none" && self getAmmoCount(curWeap) && curWeap != "strela_mp")
{ {
if(randomInt(100) > 2) if(randomInt(100) > 2)
@ -2562,6 +2628,7 @@ bot_weapon_think()
if(isDefined(threat)) if(isDefined(threat))
continue; continue;
} }
}
weaponslist = self getweaponslist(); weaponslist = self getweaponslist();
weap = ""; weap = "";
@ -2573,7 +2640,7 @@ bot_weapon_think()
if(!self getAmmoCount(weapon)) if(!self getAmmoCount(weapon))
continue; 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; continue;
if(curWeap == weapon || weapon == "none" || weapon == "" || weapon == "strela_mp") if(curWeap == weapon || weapon == "none" || weapon == "" || weapon == "strela_mp")
@ -2761,6 +2828,14 @@ bot_revenge_think()
self endon( "death" ); self endon( "death" );
self endon( "disconnect" ); 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)) if(!isDefined(self.killerLocation))
return; return;
@ -3094,6 +3169,8 @@ bot_dom_cap_think()
otherFlagCount = maps\mp\gametypes\dom::getTeamFlagCount( otherTeam ); otherFlagCount = maps\mp\gametypes\dom::getTeamFlagCount( otherTeam );
if (game["teamScores"][myteam] >= game["teamScores"][otherTeam])
{
if ( myFlagCount < otherFlagCount ) if ( myFlagCount < otherFlagCount )
{ {
if ( randomint( 100 ) < 15 ) if ( randomint( 100 ) < 15 )
@ -3109,6 +3186,7 @@ bot_dom_cap_think()
if ( randomint( 100 ) < 95 ) if ( randomint( 100 ) < 95 )
continue; continue;
} }
}
flag = undefined; flag = undefined;
flags = []; flags = [];

View File

@ -145,6 +145,38 @@ GetBotDiffNum()
return num; 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 Taken from iw4 script
*/ */

View File

@ -15,7 +15,7 @@
*/ */
init() init()
{ {
level.bw_VERSION = "1.1.0"; level.bw_VERSION = "1.1.1";
level.bot_offline = false; level.bot_offline = false;

Binary file not shown.

View File

@ -13,6 +13,13 @@ You can find the more information at the Git Repo: https://github.com/ineedbots/
4. The mod is now loaded! Go play Combat Training and enjoy the new additions. 4. The mod is now loaded! Go play Combat Training and enjoy the new additions.
## Changelog ## 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 - v1.1.0
- Rewrote using CoD4x as a base - Rewrote using CoD4x as a base
- Fixed bots not knifing - Fixed bots not knifing

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.8 MiB

After

Width:  |  Height:  |  Size: 4.8 MiB