Add reload canceling

This commit is contained in:
INeedBots 2021-03-18 16:34:19 -06:00
parent c00dbd64bf
commit dbe50d85e2
3 changed files with 281 additions and 217 deletions

View File

@ -173,6 +173,7 @@ You can find the ModDB release post [here](https://www.moddb.com/mods/bot-warfar
- Improved and fixed various waypoints for maps - Improved and fixed various waypoints for maps
- Fixed bots rubberbanding movement when their goal changes - Fixed bots rubberbanding movement when their goal changes
- Added bots quickscoping with snipers - Added bots quickscoping with snipers
- Added bots reload canceling
- v2.0.0 - v2.0.0
- Initial reboot release - Initial reboot release

View File

@ -1343,7 +1343,7 @@ aim()
if (trace_time > reaction_time) if (trace_time > reaction_time)
{ {
if((!canADS || adsAmount >= 1.0 || self InLastStand() || self GetStance() == "prone") && (conedot > 0.95 || dist < level.bots_maxKnifeDistance) && getDvarInt("bots_play_fire")) if((!canADS || adsAmount >= 1.0 || self InLastStand() || self GetStance() == "prone") && (conedot > 0.99 || dist < level.bots_maxKnifeDistance) && getDvarInt("bots_play_fire"))
self botFire(curweap); self botFire(curweap);
if (isplay) if (isplay)

View File

@ -1095,13 +1095,10 @@ difficulty()
for(;;) for(;;)
{ {
wait 5;
rankVar = GetDvarInt("bots_skill"); rankVar = GetDvarInt("bots_skill");
if(rankVar == 9) if(rankVar != 9)
continue; {
switch(self.pers["bots"]["skill"]["base"]) switch(self.pers["bots"]["skill"]["base"])
{ {
case 1: case 1:
@ -1323,6 +1320,9 @@ difficulty()
break; break;
} }
} }
wait 5;
}
} }
/* /*
@ -1471,6 +1471,7 @@ start_bot_threads()
self thread bot_killstreak_think(); self thread bot_killstreak_think();
self thread bot_weapon_think(); self thread bot_weapon_think();
self thread doReloadCancel();
self thread bot_perk_think(); self thread bot_perk_think();
// script targeting // script targeting
@ -3644,6 +3645,68 @@ bot_crate_think()
} }
} }
/*
Reload cancels
*/
doReloadCancel()
{
self endon("disconnect");
self endon("death");
for (;;)
{
self waittill("reload");
if(self BotIsFrozen())
continue;
if(self isDefusing() || self isPlanting())
continue;
if (self IsUsingRemote())
continue;
if (self InLastStand() && !self InFinalStand())
continue;
curWeap = self GetCurrentWeapon();
// check single reloads
if (self GetCurrentWeaponClipAmmo() < WeaponClipSize(curWeap))
continue;
// check difficulty
if (self.pers["bots"]["skill"]["base"] <= 3)
continue;
// check if got another weapon
weaponslist = self getweaponslistall();
weap = "";
while(weaponslist.size)
{
weapon = weaponslist[randomInt(weaponslist.size)];
weaponslist = array_remove(weaponslist, weapon);
if (!isWeaponPrimary(weapon))
continue;
if(curWeap == weapon || weapon == "none" || weapon == "")
continue;
weap = weapon;
break;
}
if(weap == "")
continue;
// do the cancel
wait 0.1;
self BotChangeToWeapon(weap);
wait 0.25;
self BotChangeToWeapon(curWeap);
}
}
/* /*
Bots will think to switch weapons Bots will think to switch weapons
*/ */