mirror of
https://github.com/ineedbots/iw4_bot_warfare.git
synced 2025-04-22 13:55:43 +00:00
Fixed weapon swap vars and added c4 watcher
This commit is contained in:
parent
6bd638ab00
commit
06990751c0
@ -210,26 +210,26 @@ onWeaponChange()
|
|||||||
self endon("disconnect");
|
self endon("disconnect");
|
||||||
self endon("death");
|
self endon("death");
|
||||||
|
|
||||||
weap = self GetCurrentWeapon();
|
first = true;
|
||||||
self.bot.is_cur_full_auto = WeaponIsFullAuto(weap);
|
|
||||||
self.bot.cur_weap_dist_multi = SetWeaponDistMulti(weap);
|
|
||||||
self.bot.is_cur_sniper = IsWeapSniper(weap);
|
|
||||||
|
|
||||||
if (weap != "none")
|
|
||||||
self changeToWeap(weap);
|
|
||||||
|
|
||||||
for(;;)
|
for(;;)
|
||||||
{
|
{
|
||||||
self waittill( "weapon_change", newWeapon );
|
newWeapon = undefined;
|
||||||
|
if (first)
|
||||||
|
{
|
||||||
|
first = false;
|
||||||
|
newWeapon = self getCurrentWeapon();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
self waittill( "weapon_change", newWeapon );
|
||||||
|
|
||||||
self.bot.is_cur_full_auto = WeaponIsFullAuto(newWeapon);
|
self.bot.is_cur_full_auto = WeaponIsFullAuto(newWeapon);
|
||||||
self.bot.cur_weap_dist_multi = SetWeaponDistMulti(weap);
|
self.bot.cur_weap_dist_multi = SetWeaponDistMulti(newWeapon);
|
||||||
self.bot.is_cur_sniper = IsWeapSniper(weap);
|
self.bot.is_cur_sniper = IsWeapSniper(newWeapon);
|
||||||
|
|
||||||
if (newWeapon == "none")
|
if (newWeapon == "none")
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
self changeToWeap(self GetCurrentWeapon());
|
self changeToWeap(newWeapon);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -440,10 +440,69 @@ spawned()
|
|||||||
self thread onNewEnemy();
|
self thread onNewEnemy();
|
||||||
self thread walk();
|
self thread walk();
|
||||||
self thread watchHoldBreath();
|
self thread watchHoldBreath();
|
||||||
|
self thread watchGrenadeFire();
|
||||||
|
|
||||||
self notify("bot_spawned");
|
self notify("bot_spawned");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
Watches when the bot fires a grenade
|
||||||
|
*/
|
||||||
|
watchGrenadeFire()
|
||||||
|
{
|
||||||
|
self endon("disconnect");
|
||||||
|
self endon("death");
|
||||||
|
|
||||||
|
for (;;)
|
||||||
|
{
|
||||||
|
self waittill( "grenade_fire", nade, weapname );
|
||||||
|
|
||||||
|
if (weapname == "c4_mp")
|
||||||
|
self thread watchC4Thrown(nade);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
Watches the c4
|
||||||
|
*/
|
||||||
|
watchC4Thrown(c4)
|
||||||
|
{
|
||||||
|
self endon("disconnect");
|
||||||
|
c4 endon("death");
|
||||||
|
|
||||||
|
wait 0.5;
|
||||||
|
|
||||||
|
for (;;)
|
||||||
|
{
|
||||||
|
wait 1 + randomInt(50) * 0.05;
|
||||||
|
|
||||||
|
shouldBreak = false;
|
||||||
|
for (i = 0; i < level.players.size; i++)
|
||||||
|
{
|
||||||
|
player = level.players[i];
|
||||||
|
|
||||||
|
if(player == self)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
if((level.teamBased && self.team == player.team) || player.sessionstate != "playing" || !isReallyAlive(player))
|
||||||
|
continue;
|
||||||
|
|
||||||
|
if (distanceSquared(c4.origin, player.origin) > 1024)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
if (!bulletTracePassed(c4.origin, player.origin + (0, 0, 25), false, c4))
|
||||||
|
continue;
|
||||||
|
|
||||||
|
shouldBreak = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (shouldBreak)
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
self notify( "alt_detonate" );
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Bot moves towards the point
|
Bot moves towards the point
|
||||||
*/
|
*/
|
||||||
|
Loading…
x
Reference in New Issue
Block a user