changeToWeap

This commit is contained in:
INeedGames 2020-11-10 01:12:08 -06:00
parent b6826c15d5
commit 3e9bd1b54e
2 changed files with 23 additions and 56 deletions

View File

@ -166,7 +166,7 @@ onWeaponChange()
weap = self GetCurrentWeapon(); weap = self GetCurrentWeapon();
self.bot.is_cur_full_auto = WeaponIsFullAuto(weap); self.bot.is_cur_full_auto = WeaponIsFullAuto(weap);
if (weap != "none") if (weap != "none")
self botWeapon(weap); self changeToWeap(weap);
for(;;) for(;;)
{ {
@ -177,7 +177,7 @@ onWeaponChange()
if (newWeapon == "none") if (newWeapon == "none")
continue; continue;
self botWeapon(self GetCurrentWeapon()); self changeToWeap(self GetCurrentWeapon());
} }
} }
@ -243,7 +243,7 @@ onLastStand()
} }
if (isDefined(pistol)) if (isDefined(pistol))
self botWeapon(pistol); self changeToWeap(pistol);
} }
while (self inLastStand()) while (self inLastStand())
@ -275,7 +275,7 @@ watchUsingRemote()
if (isReallyAlive(self)) if (isReallyAlive(self))
{ {
self botWeapon(self getLastWeapon()); self changeToWeap(self getLastWeapon());
self.bot.targets = []; self.bot.targets = [];
} }
} }
@ -287,7 +287,7 @@ watchUsingRemote()
if (isReallyAlive(self)) if (isReallyAlive(self))
{ {
self botWeapon(self getLastWeapon()); self changeToWeap(self getLastWeapon());
self.bot.targets = []; self.bot.targets = [];
} }
} }
@ -305,7 +305,7 @@ watchUsingMinigun()
{ {
if (self getCurrentWeapon() != "heli_remote_mp") if (self getCurrentWeapon() != "heli_remote_mp")
{ {
self botWeapon("heli_remote_mp"); self changeToWeap("heli_remote_mp");
} }
if (isDefined(self.bot.target)) if (isDefined(self.bot.target))
@ -329,7 +329,7 @@ watchAc130Weapon()
curWeap = self GetCurrentWeapon(); curWeap = self GetCurrentWeapon();
if (curWeap != "ac130_105mm_mp" && curWeap != "ac130_40mm_mp" && curWeap != "ac130_25mm_mp") if (curWeap != "ac130_105mm_mp" && curWeap != "ac130_40mm_mp" && curWeap != "ac130_25mm_mp")
self botWeapon("ac130_105mm_mp"); self changeToWeap("ac130_105mm_mp");
if (isDefined(self.bot.target)) if (isDefined(self.bot.target))
self thread pressFire(); self thread pressFire();
@ -347,11 +347,11 @@ watchUsingAc130()
while (isDefined(level.ac130Player) && level.ac130player == self) while (isDefined(level.ac130Player) && level.ac130player == self)
{ {
self botWeapon("ac130_105mm_mp"); self changeToWeap("ac130_105mm_mp");
wait 1+randomInt(2); wait 1+randomInt(2);
self botWeapon("ac130_40mm_mp"); self changeToWeap("ac130_40mm_mp");
wait 2+randomInt(2); wait 2+randomInt(2);
self botWeapon("ac130_25mm_mp"); self changeToWeap("ac130_25mm_mp");
wait 3+randomInt(2); wait 3+randomInt(2);
} }
} }
@ -1994,6 +1994,11 @@ prone()
self botAction("+goprone"); self botAction("+goprone");
} }
changeToWeap(weap)
{
self botWeapon(weap);
}
/* /*
Bot will move towards here Bot will move towards here
*/ */

View File

@ -57,6 +57,14 @@ is_bot()
return ((isDefined(self.pers["isBot"]) && self.pers["isBot"]) || (isDefined(self.pers["isBotWarfare"]) && self.pers["isBotWarfare"]) || isSubStr( self.guid, "bot" )); return ((isDefined(self.pers["isBot"]) && self.pers["isBot"]) || (isDefined(self.pers["isBotWarfare"]) && self.pers["isBotWarfare"]) || isSubStr( self.guid, "bot" ));
} }
/*
Bot changes to the weap
*/
BotChangeToWeapon(weap)
{
self maps\mp\bots\_bot_internal::changeToWeap(weap);
}
/* /*
Bot presses the frag button for time. Bot presses the frag button for time.
*/ */
@ -381,52 +389,6 @@ isArtShocked()
return (isDefined(self.beingArtilleryShellshocked) && self.beingArtilleryShellshocked); return (isDefined(self.beingArtilleryShellshocked) && self.beingArtilleryShellshocked);
} }
/*
UNUSED cause buggy
Bots change weapons, does the anims
*/
botChangeWeapon(weapon)// intrestingly, this allows the bots to use pullout and pulldown anims and etc, but bugs out when the bot is frozen while midburst of a firerate limited weapon (m16, only shot one shot, or two shots, even though its a 3 round burst) (never switches until unfrozen)
{
self endon("death");
self endon("disconnect");
if (level.gameEnded || !gameFlag( "prematch_done" ) || self.bot.isfrozen)
return;
if (self.bot.knifing || self.bot.isfraggingafter)
return;
if (self.disabledWeapon)
return;
if (self InLastStand() && !self InFinalStand())
return;
self.bot.switch_to_after_none = weapon;
self.bot.switching = true;
ret = undefined;
if (self GetCurrentWeapon() == "none")
{
self notify("weapon_change");
ret = self waittill_any_timeout(5, "weapon_change");
}
else
{
self _DisableWeapon();
self waittill_any_timeout(5, "weapon_change");
self _EnableWeapon();
ret = self waittill_any_timeout(5, "weapon_change");
}
if (ret == "timeout")
return false;
waittillframeend;
self notify("bot_weapon_change", self GetCurrentWeapon());
return true;
}
/* /*
Returns a valid grenade launcher weapon Returns a valid grenade launcher weapon
*/ */