mirror of
https://github.com/ineedbots/iw3_bot_warfare.git
synced 2025-04-23 02:35:43 +00:00
Ready for the switch
This commit is contained in:
parent
416e6ec7fb
commit
77307ee21b
@ -148,9 +148,6 @@ resetBotVars()
|
|||||||
|
|
||||||
self.bot.rand = randomInt(100);
|
self.bot.rand = randomInt(100);
|
||||||
|
|
||||||
self.bot.isswitching = false;
|
|
||||||
self.bot.switch_to_after_none = undefined;
|
|
||||||
|
|
||||||
self botStop();
|
self botStop();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -251,9 +248,6 @@ onLastStand()
|
|||||||
wait 0.05;
|
wait 0.05;
|
||||||
|
|
||||||
self notify("kill_goal");
|
self notify("kill_goal");
|
||||||
|
|
||||||
while (self.disabledWeapon)
|
|
||||||
wait 0.05;
|
|
||||||
waittillframeend;
|
waittillframeend;
|
||||||
|
|
||||||
weaponslist = self getweaponslist();
|
weaponslist = self getweaponslist();
|
||||||
@ -263,7 +257,7 @@ onLastStand()
|
|||||||
|
|
||||||
if ( maps\mp\gametypes\_weapons::isPistol( weapon ) )
|
if ( maps\mp\gametypes\_weapons::isPistol( weapon ) )
|
||||||
{
|
{
|
||||||
self setSpawnWeapon(weapon);
|
self changeToWeap(weapon);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -281,72 +275,25 @@ onWeaponChange()
|
|||||||
self endon("disconnect");
|
self endon("disconnect");
|
||||||
self endon("death");
|
self endon("death");
|
||||||
|
|
||||||
self.bot.is_cur_full_auto = WeaponIsFullAuto(self GetCurrentWeapon());
|
weap = self GetCurrentWeapon();
|
||||||
|
self.bot.is_cur_full_auto = WeaponIsFullAuto(weap);
|
||||||
|
if (weap != "none")
|
||||||
|
self changeToWeap(weap);
|
||||||
|
|
||||||
for(;;)
|
for(;;)
|
||||||
{
|
{
|
||||||
self waittill( "weapon_change", newWeapon );
|
self waittill( "weapon_change", newWeapon );
|
||||||
|
|
||||||
self.bot.is_cur_full_auto = WeaponIsFullAuto(newWeapon);
|
self.bot.is_cur_full_auto = WeaponIsFullAuto(newWeapon);
|
||||||
|
|
||||||
if(level.gameEnded || level.inPrematchPeriod)
|
if (newWeapon == "none")
|
||||||
|
{
|
||||||
|
self changeToWeap(self.lastDroppableWeapon);
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
// A cod4x fix because bots don't switchtoweapon properally. When a bot goes on a ladder or mount, they will by stuck with a none weapon. Also fixes the bot's weapon while going into laststand.
|
|
||||||
//fix for when switchtoweapon doesnt work and weapons get disabled from climbing or somethings
|
|
||||||
switch (newWeapon)
|
|
||||||
{
|
|
||||||
case "none":
|
|
||||||
self thread doNoneSwitch();
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
self thread doSwitch(newWeapon);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
When the bot switches to a none weapon, we fix it
|
|
||||||
*/
|
|
||||||
doNoneSwitch()
|
|
||||||
{
|
|
||||||
self endon("disconnect");
|
|
||||||
self endon("death");
|
|
||||||
self endon("weapon_change");
|
|
||||||
|
|
||||||
self.bot.isswitching = false;
|
|
||||||
|
|
||||||
while (self.disabledWeapon)
|
|
||||||
wait 0.05;
|
|
||||||
|
|
||||||
weap = self.lastDroppableWeapon;
|
|
||||||
if (isDefined(self.bot.switch_to_after_none))
|
|
||||||
{
|
|
||||||
weap = self.bot.switch_to_after_none;
|
|
||||||
self.bot.switch_to_after_none = undefined;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
self SetSpawnWeapon(weap);
|
self changeToWeap(self GetCurrentWeapon());
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
When the bot switches to a weapon, we play the active animation, and shoot delay
|
|
||||||
*/
|
|
||||||
doSwitch(newWeapon)
|
|
||||||
{
|
|
||||||
self endon("disconnect");
|
|
||||||
self endon("death");
|
|
||||||
self endon("weapon_change");
|
|
||||||
|
|
||||||
waittillframeend;
|
|
||||||
if (self.lastDroppableWeapon != newWeapon)
|
|
||||||
return;
|
|
||||||
|
|
||||||
self.bot.isswitching = true;
|
|
||||||
|
|
||||||
wait 1; // fast pullout?
|
|
||||||
|
|
||||||
self.bot.isswitching = false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -921,6 +868,7 @@ watchToLook()
|
|||||||
|
|
||||||
self.bot.jump_time = thetime;
|
self.bot.jump_time = thetime;
|
||||||
self prone();
|
self prone();
|
||||||
|
self notify("kill_goal");
|
||||||
wait 2.5;
|
wait 2.5;
|
||||||
self crouch();
|
self crouch();
|
||||||
}
|
}
|
||||||
@ -1277,13 +1225,16 @@ walk()
|
|||||||
{
|
{
|
||||||
curweap = self getCurrentWeapon();
|
curweap = self getCurrentWeapon();
|
||||||
|
|
||||||
if(self.bot.target.entity.classname == "script_vehicle" || self.bot.isfraggingafter || self.bot.issmokingafter || self InLastStand() || self GetStance() == "prone")
|
if(self.bot.target.entity.classname == "script_vehicle" || self.bot.isfraggingafter || self.bot.issmokingafter)
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(self.bot.target.isplay && self.bot.target.trace_time && self canFire(curweap) && self isInRange(self.bot.target.dist, curweap))
|
if(self.bot.target.isplay && self.bot.target.trace_time && self canFire(curweap) && self isInRange(self.bot.target.dist, curweap))
|
||||||
{
|
{
|
||||||
|
if (self InLastStand() || self GetStance() == "prone")
|
||||||
|
continue;
|
||||||
|
|
||||||
if(self.bot.target.rand <= self.pers["bots"]["behavior"]["strafe"])
|
if(self.bot.target.rand <= self.pers["bots"]["behavior"]["strafe"])
|
||||||
self strafe(self.bot.target.entity);
|
self strafe(self.bot.target.entity);
|
||||||
continue;
|
continue;
|
||||||
@ -1857,6 +1808,20 @@ prone()
|
|||||||
{
|
{
|
||||||
self botAction("-gocrouch");
|
self botAction("-gocrouch");
|
||||||
self botAction("+goprone");
|
self botAction("+goprone");
|
||||||
|
}
|
||||||
self notify("kill_goal");
|
|
||||||
|
/*
|
||||||
|
Changes to the weap
|
||||||
|
*/
|
||||||
|
changeToWeap(weap)
|
||||||
|
{
|
||||||
|
toks = strtok(weap, "_");
|
||||||
|
if (toks[0] == "gl")
|
||||||
|
{
|
||||||
|
self setSpawnWeapon(weap);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
//self botWeapon(weap);
|
||||||
|
self setSpawnWeapon(weap);
|
||||||
}
|
}
|
||||||
|
@ -47,6 +47,14 @@ is_bot()
|
|||||||
return ((isDefined(self.pers["isBot"]) && self.pers["isBot"]) || (isDefined(self.pers["isBotWarfare"]) && self.pers["isBotWarfare"]) || self getguid() == "0");
|
return ((isDefined(self.pers["isBot"]) && self.pers["isBot"]) || (isDefined(self.pers["isBotWarfare"]) && self.pers["isBotWarfare"]) || self getguid() == "0");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
Bot changes to the weap
|
||||||
|
*/
|
||||||
|
BotChangeToWeapon(weap)
|
||||||
|
{
|
||||||
|
self maps\mp\bots\_bot_internal::changeToWeap(weap);
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Bot presses the button for time.
|
Bot presses the button for time.
|
||||||
*/
|
*/
|
||||||
|
Loading…
x
Reference in New Issue
Block a user