Complete new bot commands

This commit is contained in:
INeedGames 2020-11-10 02:29:09 -06:00
parent 3e9bd1b54e
commit 2fd7dfdf78
2 changed files with 96 additions and 121 deletions

View File

@ -463,9 +463,6 @@ grenade_danager()
if(self isDefusing() || self isPlanting()) if(self isDefusing() || self isPlanting())
continue; continue;
if (self.disabledWeapon)
continue;
myEye = self getEye(); myEye = self getEye();
for (i = level.bots_fragList.count-1; i >= 0; i--) for (i = level.bots_fragList.count-1; i >= 0; i--)
{ {

View File

@ -546,7 +546,7 @@ chooseRandomAttachmentComboForGun(gun)
{ {
if (att1 == "shotgun" || att2 == "shotgun") if (att1 == "shotgun" || att2 == "shotgun")
continue; continue;
if ((att1 == "akimbo" || att2 == "akimbo") && gun != "ranger" && gun != "model1887") if ((att1 == "akimbo" || att2 == "akimbo") && gun != "ranger" && gun != "model1887" && gun != "glock")
continue; continue;
if (att1 == "acog" || att2 == "acog") if (att1 == "acog" || att2 == "acog")
continue; continue;
@ -1838,9 +1838,6 @@ bot_perk_think()
for (;self _hasPerk("specialty_onemanarmy") && self hasWeapon("onemanarmy_mp");) for (;self _hasPerk("specialty_onemanarmy") && self hasWeapon("onemanarmy_mp");)
{ {
if(self IsBotReloading() || self IsBotFragging() || self IsBotKnifing() || self IsBotSmoking())
break;
if (self HasThreat() || self HasBotJavelinLocation()) if (self HasThreat() || self HasBotJavelinLocation())
break; break;
@ -1920,14 +1917,16 @@ bot_use_tube_think()
if(self BotIsFrozen()) if(self BotIsFrozen())
continue; continue;
if(self IsBotReloading() || self IsBotFragging() || self IsBotKnifing()) if (self IsBotFragging() || self IsBotSmoking())
continue;
if(self IsBotReloading() || self IsBotKnifing())
continue; continue;
if(self isDefusing() || self isPlanting()) if(self isDefusing() || self isPlanting())
continue; continue;
curWeap = self GetCurrentWeapon(); if (self.disabledWeapon)
if (!isWeaponPrimary(curWeap) || self.disabledWeapon)
continue; continue;
if (self IsUsingRemote()) if (self IsUsingRemote())
@ -2069,16 +2068,12 @@ bot_use_equipment_think()
if(self BotIsFrozen()) if(self BotIsFrozen())
continue; continue;
if(self IsBotReloading() || self IsBotFragging() || self IsBotKnifing()) if(self IsBotFragging() || self IsBotSmoking())
continue; continue;
if(self isDefusing() || self isPlanting()) if(self isDefusing() || self isPlanting())
continue; continue;
curWeap = self GetCurrentWeapon();
if (!isWeaponPrimary(curWeap) || self.disabledWeapon)
continue;
if (self IsUsingRemote()) if (self IsUsingRemote())
continue; continue;
@ -2137,7 +2132,7 @@ bot_use_equipment_think()
self BotStopMoving(true); self BotStopMoving(true);
wait 1; wait 1;
//self throwBotGrenade(nade); self botThrowGrenade(nade, 0.05);
self ClearScriptAimPos(); self ClearScriptAimPos();
self BotStopMoving(false); self BotStopMoving(false);
@ -2181,16 +2176,12 @@ bot_use_grenade_think()
if(self BotIsFrozen()) if(self BotIsFrozen())
continue; continue;
if(self IsBotReloading() || self IsBotFragging() || self IsBotKnifing()) if(self IsBotFragging() || self IsBotSmoking())
continue; continue;
if(self isDefusing() || self isPlanting()) if(self isDefusing() || self isPlanting())
continue; continue;
curWeap = self GetCurrentWeapon();
if (!isWeaponPrimary(curWeap) || self.disabledWeapon)
continue;
if (self IsUsingRemote()) if (self IsUsingRemote())
continue; continue;
@ -2262,7 +2253,7 @@ bot_use_grenade_think()
time = 0.5; time = 0.5;
if (nade == "frag_grenade_mp") if (nade == "frag_grenade_mp")
time = 2; time = 2;
//self throwBotGrenade(nade, time); self botThrowGrenade(nade, time);
self ClearScriptAimPos(); self ClearScriptAimPos();
self BotStopMoving(false); self BotStopMoving(false);
@ -2294,6 +2285,28 @@ changeToWeapon(weap)
return (self GetCurrentWeapon() == weap); return (self GetCurrentWeapon() == weap);
} }
/*
Bots throw the grenade
*/
botThrowGrenade(nade, time)
{
self endon("disconnect");
self endon("death");
level endon("game_ended");
if (!self GetAmmoCount(nade))
return false;
if (isSecondaryGrenade(nade))
self thread BotPressSmoke(time);
else
self thread BotPressFrag(time);
ret = self waittill_any_timeout(5, "grenade_fire");
return (ret == "grenade_fire");
}
/* /*
BOts thinking of using javelins BOts thinking of using javelins
*/ */
@ -2329,16 +2342,9 @@ bot_jav_loc_think()
if(self BotIsFrozen()) if(self BotIsFrozen())
continue; continue;
if(self IsBotReloading() || self IsBotFragging() || self IsBotKnifing())
continue;
if(self isDefusing() || self isPlanting()) if(self isDefusing() || self isPlanting())
continue; continue;
curWeap = self GetCurrentWeapon();
if (!isWeaponPrimary(curWeap) || self.disabledWeapon)
continue;
if (self IsUsingRemote()) if (self IsUsingRemote())
continue; continue;
@ -3045,9 +3051,6 @@ bot_weapon_think()
{ {
self waittill_any_timeout(randomIntRange(2, 4), "bot_force_check_switch"); self waittill_any_timeout(randomIntRange(2, 4), "bot_force_check_switch");
if(self IsBotReloading() || self IsBotFragging() || self IsBotKnifing())
continue;
if(self BotIsFrozen() || self.disabledWeapon) if(self BotIsFrozen() || self.disabledWeapon)
continue; continue;
@ -3070,7 +3073,7 @@ bot_weapon_think()
if(entIsVehicle(threat) && isDefined(rocketAmmo)) if(entIsVehicle(threat) && isDefined(rocketAmmo))
{ {
if (curWeap != rocketAmmo) if (curWeap != rocketAmmo)
self setSpawnWeapon(rocketAmmo); self BotChangeToWeapon(rocketAmmo);
continue; continue;
} }
} }
@ -3078,7 +3081,7 @@ bot_weapon_think()
if (self HasBotJavelinLocation() && self GetAmmoCount("javelin_mp")) if (self HasBotJavelinLocation() && self GetAmmoCount("javelin_mp"))
{ {
if (curWeap != "javelin_mp") if (curWeap != "javelin_mp")
self setSpawnWeapon("javelin_mp"); self BotChangeToWeapon("javelin_mp");
continue; continue;
} }
@ -3086,14 +3089,14 @@ bot_weapon_think()
if (isDefined(self.bot_oma_class)) if (isDefined(self.bot_oma_class))
{ {
if (curWeap != "onemanarmy_mp") if (curWeap != "onemanarmy_mp")
self setSpawnWeapon("onemanarmy_mp"); self BotChangeToWeapon("onemanarmy_mp");
continue; continue;
} }
if (isDefined(self.bot_perf_switch_weapon)) if (isDefined(self.bot_perf_switch_weapon))
{ {
if (curWeap != self.bot_perf_switch_weapon) if (curWeap != self.bot_perf_switch_weapon)
self setSpawnWeapon(self.bot_perf_switch_weapon); self BotChangeToWeapon(self.bot_perf_switch_weapon);
self.bot_perf_switch_weapon = undefined; self.bot_perf_switch_weapon = undefined;
continue; continue;
@ -3131,7 +3134,7 @@ bot_weapon_think()
if(weap == "") if(weap == "")
continue; continue;
self setSpawnWeapon(weap); self BotChangeToWeapon(weap);
} }
} }
@ -3362,16 +3365,9 @@ bot_killstreak_think()
if(self HasThreat() || self HasBotJavelinLocation()) if(self HasThreat() || self HasBotJavelinLocation())
continue; continue;
if(self IsBotReloading() || self IsBotFragging() || self IsBotKnifing())
continue;
if(self isDefusing() || self isPlanting()) if(self isDefusing() || self isPlanting())
continue; continue;
curWeap = self GetCurrentWeapon();
if (!isWeaponPrimary(curWeap) || self.disabledWeapon)
continue;
if (self isEMPed()) if (self isEMPed())
continue; continue;
@ -3387,6 +3383,7 @@ bot_killstreak_think()
continue; continue;
ksWeap = maps\mp\killstreaks\_killstreaks::getKillstreakWeapon( streakName ); ksWeap = maps\mp\killstreaks\_killstreaks::getKillstreakWeapon( streakName );
curWeap = self GetCurrentWeapon();
if (isStrStart(streakName, "helicopter_") && self isAnyEnemyPlanes() && self.pers["bots"]["skill"]["base"] > 3) if (isStrStart(streakName, "helicopter_") && self isAnyEnemyPlanes() && self.pers["bots"]["skill"]["base"] > 3)
continue; continue;
@ -3431,21 +3428,21 @@ bot_killstreak_think()
if (DistanceSquared(self.origin, forwardTrace["position"]) < 1000*1000 && self.pers["bots"]["skill"]["base"] > 3) if (DistanceSquared(self.origin, forwardTrace["position"]) < 1000*1000 && self.pers["bots"]["skill"]["base"] > 3)
continue; continue;
self BotFreezeControls(true); self BotStopMoving(true);
wait 1;
sentryGun = maps\mp\killstreaks\_autosentry::createSentryForPlayer( "sentry_minigun", self ); if (!self changeToWeapon(ksWeap))
sentryGun maps\mp\killstreaks\_autosentry::sentry_setPlaced(); {
self notify( "sentry_placement_finished", sentryGun ); self BotStopMoving(false);
continue;
}
self maps\mp\_matchdata::logKillstreakEvent( "sentry", self.origin ); self thread fire_current_weapon();
wait 0.5;
self maps\mp\killstreaks\_killstreaks::usedKillstreak( "sentry", true ); self notify("stop_firing_weapon");
self maps\mp\killstreaks\_killstreaks::shuffleKillStreaksFILO( "sentry" ); self thread changeToWeapon(curWeap);
self maps\mp\killstreaks\_killstreaks::giveOwnedKillstreakItem();
wait 1;
self BotFreezeControls(false); self BotStopMoving(false);
} }
else if (streakName == "predator_missile") else if (streakName == "predator_missile")
{ {
@ -3455,15 +3452,23 @@ bot_killstreak_think()
continue; continue;
self setUsingRemote( "remotemissile" ); self setUsingRemote( "remotemissile" );
self setSpawnWeapon(ksWeap);
self thread clear_remote_on_death(); self thread clear_remote_on_death();
if (!self changeToWeapon(ksWeap))
{
self ClearUsingRemote();
self notify("bot_clear_remote_on_death");
self thread changeToWeapon(curWeap);
continue;
}
wait 1; wait 1;
self notify("bot_clear_remote_on_death"); self notify("bot_clear_remote_on_death");
if (self isEMPed()) if (self isEMPed())
{ {
self ClearUsingRemote(); self ClearUsingRemote();
self setSpawnWeapon(curWeap); self thread changeToWeapon(curWeap);
continue; continue;
} }
@ -3482,72 +3487,25 @@ bot_killstreak_think()
self waittill( "stopped_using_remote" ); self waittill( "stopped_using_remote" );
wait 1; wait 1;
self setSpawnWeapon(curWeap); self thread changeToWeapon(curWeap);
} }
else if (streakName == "ac130") else if (streakName == "ac130")
{ {
if ( isDefined( level.ac130player ) || level.ac130InUse ) if ( isDefined( level.ac130player ) || level.ac130InUse )
continue; continue;
level.ac130InUse = true; self BotStopMoving(true);
self setUsingRemote( "ac130" ); self changeToWeapon(ksWeap);
self setSpawnWeapon(ksWeap); self BotStopMoving(false);
self thread clear_remote_on_death(true);
wait 1;
self notify("bot_clear_remote_on_death");
if (self isEMPed()) // bcuz of the wait
{
level.ac130InUse = false;
self ClearUsingRemote();
self setSpawnWeapon(curWeap);
continue;
}
self maps\mp\_matchdata::logKillstreakEvent( "ac130", self.origin );
self.ac130LifeId = self.pers["killstreaks"][0].lifeId;
level.ac130.planeModel.crashed = undefined;
thread maps\mp\killstreaks\_ac130::setAC130Player( self );
self maps\mp\killstreaks\_killstreaks::usedKillstreak( "ac130", true );
self maps\mp\killstreaks\_killstreaks::shuffleKillStreaksFILO( "ac130" );
self maps\mp\killstreaks\_killstreaks::giveOwnedKillstreakItem();
self waittill( "stopped_using_remote" );
wait 1;
self setSpawnWeapon(curWeap);
} }
else if (streakName == "helicopter_minigun") else if (streakName == "helicopter_minigun")
{ {
if (isDefined( level.chopper )) if (isDefined( level.chopper ))
continue; continue;
self setUsingRemote( "helicopter_minigun" ); self BotStopMoving(true);
self setSpawnWeapon(ksWeap); self changeToWeapon(ksWeap);
self thread clear_remote_on_death(); self BotStopMoving(false);
wait 1;
self notify("bot_clear_remote_on_death");
if (isDefined( level.chopper ) || self isEMPed())
{
self ClearUsingRemote();
self setSpawnWeapon(curWeap);
continue;
}
self thread maps\mp\killstreaks\_helicopter::startHelicopter(self.pers["killstreaks"][0].lifeId, "minigun");
self maps\mp\killstreaks\_killstreaks::usedKillstreak( "helicopter_minigun", true );
self maps\mp\killstreaks\_killstreaks::shuffleKillStreaksFILO( "helicopter_minigun" );
self maps\mp\killstreaks\_killstreaks::giveOwnedKillstreakItem();
self waittill( "stopped_using_remote" );
wait 1;
self setSpawnWeapon(curWeap);
} }
} }
else else
@ -3572,11 +3530,25 @@ bot_killstreak_think()
continue; continue;
self BotStopMoving(true); self BotStopMoving(true);
/*if (self throwBotGrenade(ksWeap) != "grenade_fire")
if (!self changeToWeapon(ksWeap))
{ {
self BotStopMoving(false); self BotStopMoving(false);
continue; continue;
}*/ }
self thread fire_current_weapon();
ret = self waittill_any_timeout( 5, "grenade_fire" );
self notify("stop_firing_weapon");
self thread changeToWeapon(curWeap);
if (ret == "timeout")
{
self BotStopMoving(false);
continue;
}
if (randomInt(100) < 80) if (randomInt(100) < 80)
self waittill_any_timeout( 15, "crate_physics_done" ); self waittill_any_timeout( 15, "crate_physics_done" );
@ -3618,16 +3590,22 @@ bot_killstreak_think()
case "nuke": case "nuke":
case "counter_uav": case "counter_uav":
case "emp": case "emp":
self BotFreezeControls(true); self BotStopMoving(true);
self setSpawnWeapon(ksWeap);
if (self changeToWeapon(ksWeap))
{
wait 1; wait 1;
if (isDefined(location)) if (isDefined(location))
{ {
self notify( "confirm_location", location, directionYaw ); self notify( "confirm_location", location, directionYaw );
wait 1; wait 1;
} }
self setSpawnWeapon(curWeap);
self BotFreezeControls(false); self thread changeToWeapon(curWeap);
}
self BotStopMoving(false);
break; break;
} }
} }