mirror of
https://github.com/ineedbots/iw4_bot_warfare.git
synced 2025-04-22 22:05:44 +00:00
func and airdrop
This commit is contained in:
parent
e143a65941
commit
86097d7d51
@ -126,6 +126,7 @@ init()
|
|||||||
level thread fixGamemodes();
|
level thread fixGamemodes();
|
||||||
|
|
||||||
level thread onPlayerConnect();
|
level thread onPlayerConnect();
|
||||||
|
level thread addNotifyOnAirdrops();
|
||||||
|
|
||||||
level thread handleBots();
|
level thread handleBots();
|
||||||
}
|
}
|
||||||
@ -201,6 +202,38 @@ fixGamemodes()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
addNotifyOnAirdrops()
|
||||||
|
{
|
||||||
|
for (;;)
|
||||||
|
{
|
||||||
|
wait 1;
|
||||||
|
dropCrates = getEntArray( "care_package", "targetname" );
|
||||||
|
|
||||||
|
for (i = dropCrates.size - 1; i >= 0; i--)
|
||||||
|
{
|
||||||
|
airdrop = dropCrates[i];
|
||||||
|
|
||||||
|
if (!isDefined(airdrop.owner))
|
||||||
|
continue;
|
||||||
|
|
||||||
|
if (isDefined(airdrop.doingPhysics))
|
||||||
|
continue;
|
||||||
|
|
||||||
|
airdrop.doingPhysics = true;
|
||||||
|
airdrop thread doNotifyOnAirdrop();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
doNotifyOnAirdrop()
|
||||||
|
{
|
||||||
|
self endon( "death" );
|
||||||
|
self waittill( "physics_finished" );
|
||||||
|
|
||||||
|
self.doingPhysics = false;
|
||||||
|
self.owner notify("crate_physics_done");
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Thread when any player connects. Starts the threads needed.
|
Thread when any player connects. Starts the threads needed.
|
||||||
*/
|
*/
|
||||||
|
@ -349,7 +349,7 @@ UseRunThink()
|
|||||||
self.bot.run_time -= 0.05;
|
self.bot.run_time -= 0.05;
|
||||||
|
|
||||||
if (self.bot.run_time <= 0 ||
|
if (self.bot.run_time <= 0 ||
|
||||||
isDefined(self.lastStand) || self getStance() != "stand" ||
|
self inLastStand() || self getStance() != "stand" ||
|
||||||
level.gameEnded || !gameFlag( "prematch_done" ) ||
|
level.gameEnded || !gameFlag( "prematch_done" ) ||
|
||||||
self.bot.isfrozen || self.bot.climbing ||
|
self.bot.isfrozen || self.bot.climbing ||
|
||||||
self.bot.isreloading ||
|
self.bot.isreloading ||
|
||||||
@ -395,7 +395,7 @@ stanceHack()
|
|||||||
{
|
{
|
||||||
wait 0.05;
|
wait 0.05;
|
||||||
|
|
||||||
if(isDefined(self.lastStand))
|
if(self inLastStand())
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (level.gameEnded || !gameFlag( "prematch_done" ))
|
if (level.gameEnded || !gameFlag( "prematch_done" ))
|
||||||
@ -503,7 +503,7 @@ moveHack()
|
|||||||
stance = self getStance();
|
stance = self getStance();
|
||||||
curWeap = self GetCurrentWeapon();
|
curWeap = self GetCurrentWeapon();
|
||||||
weapClass = weaponClass(curWeap);
|
weapClass = weaponClass(curWeap);
|
||||||
inLastStand = isDefined(self.lastStand);
|
inLastStand = self inLastStand();
|
||||||
usingRemote = self isUsingRemote();
|
usingRemote = self isUsingRemote();
|
||||||
botAnim = "";
|
botAnim = "";
|
||||||
|
|
||||||
@ -887,7 +887,7 @@ doSwitch(newWeapon)
|
|||||||
if (isDefined(self.lastDroppableWeapon) && self.lastDroppableWeapon != newWeapon)
|
if (isDefined(self.lastDroppableWeapon) && self.lastDroppableWeapon != newWeapon)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (!isDefined(self.lastStand) && !self.bot.isfraggingafter && !self.bot.knifingafter)
|
if (!self inLastStand() && !self.bot.isfraggingafter && !self.bot.knifingafter)
|
||||||
self thread botDoAnim("pt_stand_core_pullout", 0.5, true);
|
self thread botDoAnim("pt_stand_core_pullout", 0.5, true);
|
||||||
|
|
||||||
self.bot.isswitching = true;
|
self.bot.isswitching = true;
|
||||||
@ -922,10 +922,10 @@ onLastStand()
|
|||||||
|
|
||||||
while (true)
|
while (true)
|
||||||
{
|
{
|
||||||
while (!isDefined(self.lastStand))
|
while (!self inLastStand())
|
||||||
wait 0.05;
|
wait 0.05;
|
||||||
|
|
||||||
if (!isDefined(self.inFinalStand) || !self.inFinalStand)
|
if (!self inFinalStand())
|
||||||
{
|
{
|
||||||
pistol = undefined;
|
pistol = undefined;
|
||||||
weaponsList = self GetWeaponsListPrimaries();
|
weaponsList = self GetWeaponsListPrimaries();
|
||||||
@ -939,7 +939,7 @@ onLastStand()
|
|||||||
self setSpawnWeapon(pistol);
|
self setSpawnWeapon(pistol);
|
||||||
}
|
}
|
||||||
|
|
||||||
while (isDefined(self.lastStand))
|
while (self inLastStand())
|
||||||
wait 0.05;
|
wait 0.05;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -2140,7 +2140,7 @@ knife(ent, knifeDist)
|
|||||||
isplay = isPlayer(ent);
|
isplay = isPlayer(ent);
|
||||||
usedRiot = self.hasRiotShieldEquipped;
|
usedRiot = self.hasRiotShieldEquipped;
|
||||||
distsq = DistanceSquared(self.origin, ent.origin);
|
distsq = DistanceSquared(self.origin, ent.origin);
|
||||||
inLastStand = isDefined(self.lastStand);
|
inLastStand = self inLastStand();
|
||||||
stance = self getStance();
|
stance = self getStance();
|
||||||
damage = 135;
|
damage = 135;
|
||||||
if (usedRiot)
|
if (usedRiot)
|
||||||
@ -2295,7 +2295,7 @@ botThrowGrenade(grenName)
|
|||||||
self endon("disconnect");
|
self endon("disconnect");
|
||||||
level endon ( "game_ended" );
|
level endon ( "game_ended" );
|
||||||
|
|
||||||
if (isDefined(self.lastStand) && !self _hasPerk("specialty_laststandoffhand") && (!isDefined(self.inFinalStand) || !self.inFinalStand))
|
if (self inLastStand() && !self _hasPerk("specialty_laststandoffhand") && !self inFinalStand())
|
||||||
return "laststand";
|
return "laststand";
|
||||||
|
|
||||||
if (level.gameEnded || !gameFlag( "prematch_done" ) || self.bot.isfrozen || self.bot.climbing)
|
if (level.gameEnded || !gameFlag( "prematch_done" ) || self.bot.isfrozen || self.bot.climbing)
|
||||||
@ -2387,7 +2387,7 @@ jump()
|
|||||||
self endon("disconnect");
|
self endon("disconnect");
|
||||||
level endon ( "game_ended" );
|
level endon ( "game_ended" );
|
||||||
|
|
||||||
if (isDefined(self.lastStand) || self getStance() != "stand" ||
|
if (self inLastStand() || self getStance() != "stand" ||
|
||||||
level.gameEnded || !gameFlag( "prematch_done" ) || self IsUsingRemote() ||
|
level.gameEnded || !gameFlag( "prematch_done" ) || self IsUsingRemote() ||
|
||||||
self.bot.isfrozen || self.bot.climbing || self.bot.jumpingafter)
|
self.bot.isfrozen || self.bot.climbing || self.bot.jumpingafter)
|
||||||
return;
|
return;
|
||||||
|
@ -1019,13 +1019,6 @@ bot_killstreak_think()
|
|||||||
self endon("death");
|
self endon("death");
|
||||||
level endon("game_ended");
|
level endon("game_ended");
|
||||||
|
|
||||||
if (randomInt(2))
|
|
||||||
self maps\mp\killstreaks\_killstreaks::tryGiveKillstreak("airdrop");
|
|
||||||
else if (randomInt(2))
|
|
||||||
self maps\mp\killstreaks\_killstreaks::tryGiveKillstreak("airdrop_sentry_minigun");
|
|
||||||
else
|
|
||||||
self maps\mp\killstreaks\_killstreaks::tryGiveKillstreak("airdrop_mega");
|
|
||||||
|
|
||||||
for (;;)
|
for (;;)
|
||||||
{
|
{
|
||||||
wait randomIntRange(1, 3);
|
wait randomIntRange(1, 3);
|
||||||
@ -1039,7 +1032,7 @@ bot_killstreak_think()
|
|||||||
if(self HasThreat())
|
if(self HasThreat())
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if(self IsBotReloading() || self IsBotFragging() || self IsKnifing())
|
if(self IsBotReloading() || self IsBotFragging() || self IsBotKnifing())
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if(self isDefusing() || self isPlanting())
|
if(self isDefusing() || self isPlanting())
|
||||||
@ -1052,6 +1045,9 @@ bot_killstreak_think()
|
|||||||
if (self isEMPed())
|
if (self isEMPed())
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
if (self botIsClimbing())
|
||||||
|
continue;
|
||||||
|
|
||||||
streakName = self.pers["killstreaks"][0].streakName;
|
streakName = self.pers["killstreaks"][0].streakName;
|
||||||
|
|
||||||
ksWeap = maps\mp\killstreaks\_killstreaks::getKillstreakWeapon( streakName );
|
ksWeap = maps\mp\killstreaks\_killstreaks::getKillstreakWeapon( streakName );
|
||||||
@ -1088,9 +1084,13 @@ bot_killstreak_think()
|
|||||||
continue;
|
continue;
|
||||||
|
|
||||||
self SetScriptGoal(self.origin, 16);
|
self SetScriptGoal(self.origin, 16);
|
||||||
self throwBotGrenade(ksWeap);
|
if (self throwBotGrenade(ksWeap) != "grenade_fire")
|
||||||
|
{
|
||||||
|
self ClearScriptGoal();
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
self waittill_any_timeout( 1, "bad_path" );
|
self waittill_any_timeout( 15, "bad_path", "crate_physics_done" );
|
||||||
self ClearScriptGoal();
|
self ClearScriptGoal();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -1139,6 +1139,9 @@ bot_killstreak_think()
|
|||||||
location = self.origin + (randomIntRange(-512, 512), randomIntRange(-512, 512), 0);
|
location = self.origin + (randomIntRange(-512, 512), randomIntRange(-512, 512), 0);
|
||||||
|
|
||||||
directionYaw = randomInt(360);
|
directionYaw = randomInt(360);
|
||||||
|
|
||||||
|
if (!isDefined(location))
|
||||||
|
continue;
|
||||||
case "helicopter":
|
case "helicopter":
|
||||||
case "helicopter_flares":
|
case "helicopter_flares":
|
||||||
case "uav":
|
case "uav":
|
||||||
|
@ -191,7 +191,7 @@ HasThreat()
|
|||||||
return (isDefined(self GetThreat()));
|
return (isDefined(self GetThreat()));
|
||||||
}
|
}
|
||||||
|
|
||||||
IsKnifing()
|
IsBotKnifing()
|
||||||
{
|
{
|
||||||
return self.bot.knifing;
|
return self.bot.knifing;
|
||||||
}
|
}
|
||||||
@ -206,6 +206,16 @@ isPlanting()
|
|||||||
return (isDefined(self.isPlanting) && self.isPlanting);
|
return (isDefined(self.isPlanting) && self.isPlanting);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
inLastStand()
|
||||||
|
{
|
||||||
|
return (isDefined(self.lastStand) && self.lastStand);
|
||||||
|
}
|
||||||
|
|
||||||
|
inFinalStand()
|
||||||
|
{
|
||||||
|
return (isDefined(self.inFinalStand) && self.inFinalStand);
|
||||||
|
}
|
||||||
|
|
||||||
isWeaponDroppable(weap)
|
isWeaponDroppable(weap)
|
||||||
{
|
{
|
||||||
return (maps\mp\gametypes\_weapons::mayDropWeapon(weap));
|
return (maps\mp\gametypes\_weapons::mayDropWeapon(weap));
|
||||||
|
Loading…
x
Reference in New Issue
Block a user