mirror of
https://github.com/ineedbots/iw3_bot_warfare.git
synced 2025-04-22 10:15:44 +00:00
Fix weap swap vars, partial c4 support
This commit is contained in:
parent
8b73445e89
commit
a84133d928
@ -224,10 +224,69 @@ spawned()
|
|||||||
self thread watchHoldBreath();
|
self thread watchHoldBreath();
|
||||||
self thread onNewEnemy();
|
self thread onNewEnemy();
|
||||||
self thread doBotMovement();
|
self thread doBotMovement();
|
||||||
|
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" || !isAlive(player))
|
||||||
|
continue;
|
||||||
|
|
||||||
|
if (distanceSquared(c4.origin, player.origin) > 200*200)
|
||||||
|
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
|
||||||
*/
|
*/
|
||||||
@ -376,25 +435,24 @@ 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(;;)
|
||||||
{
|
{
|
||||||
|
newWeapon = undefined;
|
||||||
|
if (first)
|
||||||
|
{
|
||||||
|
first = false;
|
||||||
|
newWeapon = self getCurrentWeapon();
|
||||||
|
}
|
||||||
|
else
|
||||||
self waittill( "weapon_change", newWeapon );
|
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(newWeapon);
|
self changeToWeap(newWeapon);
|
||||||
}
|
}
|
||||||
@ -1215,8 +1273,6 @@ aim()
|
|||||||
if(!self canFire(curweap) || !self isInRange(dist, curweap))
|
if(!self canFire(curweap) || !self isInRange(dist, curweap))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
//c4 logic here, but doesnt work anyway
|
|
||||||
|
|
||||||
canADS = (self canAds(dist, curweap) && conedot > 0.75);
|
canADS = (self canAds(dist, curweap) && conedot > 0.75);
|
||||||
if (canADS)
|
if (canADS)
|
||||||
{
|
{
|
||||||
|
@ -673,7 +673,6 @@ get_random_perk(perkslot, rank, att1, att2)
|
|||||||
{
|
{
|
||||||
case "specialty_parabolic":
|
case "specialty_parabolic":
|
||||||
case "specialty_holdbreath":
|
case "specialty_holdbreath":
|
||||||
case "specialty_weapon_c4":
|
|
||||||
case "specialty_explosivedamage":
|
case "specialty_explosivedamage":
|
||||||
case "specialty_twoprimaries":
|
case "specialty_twoprimaries":
|
||||||
continue;
|
continue;
|
||||||
@ -1794,6 +1793,8 @@ bot_use_equipment_think()
|
|||||||
nade = undefined;
|
nade = undefined;
|
||||||
if (self GetAmmoCount("claymore_mp"))
|
if (self GetAmmoCount("claymore_mp"))
|
||||||
nade = "claymore_mp";
|
nade = "claymore_mp";
|
||||||
|
if (self GetAmmoCount("c4_mp"))
|
||||||
|
nade = "c4_mp";
|
||||||
|
|
||||||
if (!isDefined(nade))
|
if (!isDefined(nade))
|
||||||
continue;
|
continue;
|
||||||
@ -1871,6 +1872,7 @@ bot_use_equipment_think()
|
|||||||
|
|
||||||
if (self changeToWeapon(nade))
|
if (self changeToWeapon(nade))
|
||||||
{
|
{
|
||||||
|
if (nade != "c4_mp")
|
||||||
self thread fire_current_weapon();
|
self thread fire_current_weapon();
|
||||||
self waittill_any_timeout(5, "grenade_fire", "weapon_change");
|
self waittill_any_timeout(5, "grenade_fire", "weapon_change");
|
||||||
self notify("stop_firing_weapon");
|
self notify("stop_firing_weapon");
|
||||||
@ -2256,7 +2258,7 @@ bot_weapon_think()
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if(curWeap != "none" && self getAmmoCount(curWeap) && curWeap != "c4_mp")
|
if(curWeap != "none" && self getAmmoCount(curWeap))
|
||||||
{
|
{
|
||||||
if(randomInt(100) > self.pers["bots"]["behavior"]["switch"])
|
if(randomInt(100) > self.pers["bots"]["behavior"]["switch"])
|
||||||
continue;
|
continue;
|
||||||
@ -2282,7 +2284,7 @@ bot_weapon_think()
|
|||||||
if (maps\mp\gametypes\_weapons::isGrenade( weapon ))
|
if (maps\mp\gametypes\_weapons::isGrenade( weapon ))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if(curWeap == weapon || weapon == "c4_mp" || weapon == "none" || weapon == "claymore_mp" || weapon == "")//c4 no work
|
if(curWeap == weapon || weapon == "c4_mp" || weapon == "none" || weapon == "claymore_mp" || weapon == "")
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
weap = weapon;
|
weap = weapon;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user