Jav location

This commit is contained in:
Your Name 2020-08-25 13:39:47 -06:00
parent 320d6854ac
commit d4b2a72025
3 changed files with 79 additions and 4 deletions

View File

@ -116,6 +116,7 @@ resetBotVars()
self.bot.targets = []; self.bot.targets = [];
self.bot.target = undefined; self.bot.target = undefined;
self.bot.target_this_frame = undefined; self.bot.target_this_frame = undefined;
self.bot.jav_loc = undefined;
self.bot.script_aimpos = undefined; self.bot.script_aimpos = undefined;
@ -188,6 +189,7 @@ onPlayerSpawned()
self thread reload_watch(); self thread reload_watch();
self thread grenade_watch(); self thread grenade_watch();
self thread lockon_watch(); self thread lockon_watch();
self thread jav_loc_watch();
self thread adsHack(); self thread adsHack();
self thread fireHack(); self thread fireHack();
@ -201,6 +203,32 @@ onPlayerSpawned()
} }
} }
jav_loc_watch()
{
self endon("disconnect");
self endon("death");
for (;;)
{
wait 0.05;
if(!gameFlag( "prematch_done" ) || level.gameEnded || self.bot.isfrozen || self maps\mp\_flashgrenades::isFlashbanged())
continue;
if (!isDefined(self.bot.jav_loc))
continue;
weap = self getCurrentWeapon();
if (weap != "javelin_mp")
continue;
if (!self GetCurrentWeaponClipAmmo())
continue;
self WeaponLockFinalize( self.bot.jav_loc, (0,0,0), true );
}
}
lockon_watch() lockon_watch()
{ {
self endon("disconnect"); self endon("disconnect");
@ -1642,6 +1670,16 @@ aim()
usingRemote = self IsUsingRemote(); usingRemote = self IsUsingRemote();
if (isDefined(self.bot.jav_loc) && !usingRemote)
{
lookPos = self.bot.jav_loc;
self thread bot_lookat(lookPos, aimspeed);
self thread pressAds();
self botFire();
continue;
}
if(isDefined(self.bot.target) && isDefined(self.bot.target.entity) && !self.bot.climbing) if(isDefined(self.bot.target) && isDefined(self.bot.target.entity) && !self.bot.climbing)
{ {
no_trace_look_time = self.pers["bots"]["skill"]["no_trace_look_time"]; no_trace_look_time = self.pers["bots"]["skill"]["no_trace_look_time"];
@ -1929,12 +1967,12 @@ walk()
continue; continue;
} }
hasTarget = (isDefined(self.bot.target) && isDefined(self.bot.target.entity) && !self.bot.climbing); hasTarget = (((isDefined(self.bot.target) && isDefined(self.bot.target.entity)) || isDefined(self.bot.jav_loc)) && !self.bot.climbing);
if(hasTarget) if(hasTarget)
{ {
curweap = self getCurrentWeapon(); curweap = self getCurrentWeapon();
if(entIsVehicle(self.bot.target.entity) || self.bot.isfraggingafter) if(isDefined(self.bot.jav_loc) || entIsVehicle(self.bot.target.entity) || self.bot.isfraggingafter)
{ {
continue; continue;
} }

View File

@ -1080,8 +1080,6 @@ onBotSpawned()
self waittill("bot_spawned"); self waittill("bot_spawned");
gameFlagWait("prematch_done"); gameFlagWait("prematch_done");
self GiveWeapon("at4_mp");
self thread bot_killstreak_think(); self thread bot_killstreak_think();
self thread bot_target_vehicle(); self thread bot_target_vehicle();
self thread bot_weapon_think(); self thread bot_weapon_think();
@ -1091,6 +1089,22 @@ onBotSpawned()
self thread bot_uav_think(); self thread bot_uav_think();
self thread bot_listen_to_steps(); self thread bot_listen_to_steps();
self thread bot_equipment_kill_think(); self thread bot_equipment_kill_think();
self thread bot_jav_loc_think();
}
}
bot_jav_loc_think()
{
self endon("disconnect");
self endon("death");
self GiveWeapon("javelin_mp");
for (;;)
{
wait 0.05;
self SetWeaponAmmoClip("javelin_mp", 1);
self SetBotJavelinLocation((randomIntRange(-10000, 10000),randomIntRange(-10000, 10000),1000));
} }
} }
@ -1694,6 +1708,14 @@ bot_weapon_think()
} }
} }
if (self HasBotJavelinLocation() && self GetAmmoCount("javelin_mp"))
{
if (curWeap != "javelin_mp")
self setSpawnWeapon("javelin_mp");
continue;
}
if(curWeap != "none" && self getAmmoCount(curWeap) && curWeap != "stinger_mp" && curWeap != "javelin_mp" && curWeap != "onemanarmy_mp") if(curWeap != "none" && self getAmmoCount(curWeap) && curWeap != "stinger_mp" && curWeap != "javelin_mp" && curWeap != "onemanarmy_mp")
{ {
if(randomInt(100) > self.pers["bots"]["behavior"]["switch"]) if(randomInt(100) > self.pers["bots"]["behavior"]["switch"])

View File

@ -134,6 +134,21 @@ ClearScriptGoal()
self SetScriptGoal(undefined, 0); self SetScriptGoal(undefined, 0);
} }
HasBotJavelinLocation()
{
return isDefined(self.bot.jav_loc);
}
SetBotJavelinLocation(loc)
{
self.bot.jav_loc = loc;
}
ClearBotJavelinLocation()
{
self SetBotJavelinLocation(undefined);
}
/* /*
Sets the script enemy for a bot. Sets the script enemy for a bot.
*/ */