added mw2 playstyle

This commit is contained in:
INeedBots 2021-03-26 19:37:20 -06:00
parent 48261be3d2
commit a3b2e2e655
2 changed files with 70 additions and 0 deletions

View File

@ -334,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"))
{
@ -2531,6 +2534,52 @@ 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

View File

@ -156,6 +156,27 @@ isWeaponAltmode(weap)
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
*/