mirror of
https://github.com/ineedbots/iw4_bot_warfare.git
synced 2025-04-21 21:45:43 +00:00
fast continue jav
This commit is contained in:
parent
4905d51c9d
commit
0b13d26eb4
@ -1094,6 +1094,22 @@ nearAnyOfWaypoints(dist, waypoints)
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
getNearestWaypointOfWaypoints(waypoints)
|
||||||
|
{
|
||||||
|
answer = undefined;
|
||||||
|
for (i = 0; i < waypoints.size; i++)
|
||||||
|
{
|
||||||
|
waypoint = waypoints[i];
|
||||||
|
|
||||||
|
if (isDefined(answer) && closer(self.origin, answer.origin, waypoint.origin))
|
||||||
|
continue;
|
||||||
|
|
||||||
|
answer = waypoint;
|
||||||
|
}
|
||||||
|
|
||||||
|
return answer;
|
||||||
|
}
|
||||||
|
|
||||||
bot_escort_obj(obj, carrier)
|
bot_escort_obj(obj, carrier)
|
||||||
{
|
{
|
||||||
self endon( "death" );
|
self endon( "death" );
|
||||||
@ -1900,16 +1916,22 @@ bot_jav_loc_think()
|
|||||||
self endon("death");
|
self endon("death");
|
||||||
level endon("game_ended");
|
level endon("game_ended");
|
||||||
|
|
||||||
|
doFastContinue = false;
|
||||||
for (;;)
|
for (;;)
|
||||||
{
|
{
|
||||||
wait randomintRange(2, 4);
|
if (doFastContinue)
|
||||||
|
doFastContinue = false;
|
||||||
|
else
|
||||||
|
{
|
||||||
|
wait randomintRange(2, 4);
|
||||||
|
|
||||||
chance = self.pers["bots"]["behavior"]["nade"] / 2;
|
chance = self.pers["bots"]["behavior"]["nade"] / 2;
|
||||||
if (chance > 20)
|
if (chance > 20)
|
||||||
chance = 20;
|
chance = 20;
|
||||||
|
|
||||||
if (randomInt(100) > chance)
|
if (randomInt(100) > chance)
|
||||||
continue;
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
if (!self GetAmmoCount("javelin_mp"))
|
if (!self GetAmmoCount("javelin_mp"))
|
||||||
continue;
|
continue;
|
||||||
@ -1942,46 +1964,56 @@ bot_jav_loc_think()
|
|||||||
if (self isEMPed())
|
if (self isEMPed())
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
javWps = [];
|
|
||||||
for (i = 0; i < level.waypointsJav.size; i++)
|
|
||||||
{
|
|
||||||
if (Distance(self.origin, level.waypointsJav[i].origin) > 1024)
|
|
||||||
continue;
|
|
||||||
|
|
||||||
javWps[javWps.size] = level.waypointsJav[i];
|
|
||||||
}
|
|
||||||
javWp = random(javWps);
|
|
||||||
|
|
||||||
loc = undefined;
|
loc = undefined;
|
||||||
if (!isDefined(javWp) || self HasScriptGoal() || self.bot_lock_goal)
|
|
||||||
|
if (!self nearAnyOfWaypoints(128, level.waypointsJav))
|
||||||
{
|
{
|
||||||
traceForward = self maps\mp\_javelin::EyeTraceForward();
|
javWps = [];
|
||||||
if (!isDefined(traceForward))
|
for (i = 0; i < level.waypointsJav.size; i++)
|
||||||
continue;
|
{
|
||||||
|
if (Distance(self.origin, level.waypointsJav[i].origin) > 1024)
|
||||||
|
continue;
|
||||||
|
|
||||||
loc = traceForward[0];
|
javWps[javWps.size] = level.waypointsJav[i];
|
||||||
if (self maps\mp\_javelin::TargetPointTooClose(loc))
|
}
|
||||||
continue;
|
javWp = random(javWps);
|
||||||
|
|
||||||
|
if (!isDefined(javWp) || self HasScriptGoal() || self.bot_lock_goal)
|
||||||
|
{
|
||||||
|
traceForward = self maps\mp\_javelin::EyeTraceForward();
|
||||||
|
if (!isDefined(traceForward))
|
||||||
|
continue;
|
||||||
|
|
||||||
if (!bulletTracePassed(self.origin + (0, 0, 5), self.origin + (0, 0, 2048), false, self))
|
loc = traceForward[0];
|
||||||
continue;
|
if (self maps\mp\_javelin::TargetPointTooClose(loc))
|
||||||
|
continue;
|
||||||
|
|
||||||
if (!bulletTracePassed(loc + (0, 0, 5), loc + (0, 0, 2048), false, self))
|
if (!bulletTracePassed(self.origin + (0, 0, 5), self.origin + (0, 0, 2048), false, self))
|
||||||
|
continue;
|
||||||
|
|
||||||
|
if (!bulletTracePassed(loc + (0, 0, 5), loc + (0, 0, 2048), false, self))
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
self SetScriptGoal(javWp.origin, 16);
|
||||||
|
|
||||||
|
ret = self waittill_any_return("new_goal", "goal", "bad_path");
|
||||||
|
|
||||||
|
if (ret != "new_goal")
|
||||||
|
self ClearScriptGoal();
|
||||||
|
|
||||||
|
if (ret != "goal")
|
||||||
|
continue;
|
||||||
|
|
||||||
|
doFastContinue = true;
|
||||||
continue;
|
continue;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
javWp = self getNearestWaypointOfWaypoints(level.waypointsJav);
|
||||||
loc = javWp.jav_point;
|
loc = javWp.jav_point;
|
||||||
|
|
||||||
self SetScriptGoal(javWp.origin, 16);
|
|
||||||
|
|
||||||
ret = self waittill_any_return("new_goal", "goal", "bad_path");
|
|
||||||
|
|
||||||
if (ret != "new_goal")
|
|
||||||
self ClearScriptGoal();
|
|
||||||
|
|
||||||
if (ret != "goal")
|
|
||||||
continue;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
self SetBotJavelinLocation(loc);
|
self SetBotJavelinLocation(loc);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user