mirror of
https://github.com/ineedbots/t5_bot_warfare.git
synced 2025-04-20 16:45:43 +00:00
add melee lunge
This commit is contained in:
parent
5df8f4fcc6
commit
7d3bef6309
@ -120,24 +120,12 @@ bot_give_loadout()
|
|||||||
if ( self hasPerk( "specialty_extraammo" ) )
|
if ( self hasPerk( "specialty_extraammo" ) )
|
||||||
self giveMaxAmmo( weap );
|
self giveMaxAmmo( weap );
|
||||||
|
|
||||||
if ( !getDVarint( "bots_play_fire" ) )
|
|
||||||
{
|
|
||||||
self SetWeaponAmmoClip( weap, 0 );
|
|
||||||
self SetWeaponAmmoStock( weap, 0 );
|
|
||||||
}
|
|
||||||
|
|
||||||
if ( self.pers["bot"]["class_secondary"] != "" )
|
if ( self.pers["bot"]["class_secondary"] != "" )
|
||||||
{
|
{
|
||||||
self GiveWeapon( self.pers["bot"]["class_secondary"], 0, int( self.pers["bot"]["class_secondary_opts"] ) );
|
self GiveWeapon( self.pers["bot"]["class_secondary"], 0, int( self.pers["bot"]["class_secondary_opts"] ) );
|
||||||
|
|
||||||
if ( self hasPerk( "specialty_extraammo" ) )
|
if ( self hasPerk( "specialty_extraammo" ) )
|
||||||
self giveMaxAmmo( self.pers["bot"]["class_secondary"] );
|
self giveMaxAmmo( self.pers["bot"]["class_secondary"] );
|
||||||
|
|
||||||
if ( !getDVarint( "bots_play_fire" ) )
|
|
||||||
{
|
|
||||||
self SetWeaponAmmoClip( self.pers["bot"]["class_secondary"], 0 );
|
|
||||||
self SetWeaponAmmoStock( self.pers["bot"]["class_secondary"], 0 );
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
self SetActionSlot( 3, "altMode" );
|
self SetActionSlot( 3, "altMode" );
|
||||||
|
@ -178,6 +178,17 @@ bot_watch_stop_move()
|
|||||||
|
|
||||||
if ( !getDvarInt( "bots_play_move" ) )
|
if ( !getDvarInt( "bots_play_move" ) )
|
||||||
self thread botStopMove( true );
|
self thread botStopMove( true );
|
||||||
|
|
||||||
|
if ( !getDvarInt( "bots_play_fire" ) )
|
||||||
|
{
|
||||||
|
weaps = self getweaponslist();
|
||||||
|
|
||||||
|
for ( i = 0; i < weaps.size; i++ )
|
||||||
|
{
|
||||||
|
self SetWeaponAmmoClip( weaps[i], 0 );
|
||||||
|
self SetWeaponAmmoStock( weaps[i], 0 );
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -415,6 +426,7 @@ bot_spawn()
|
|||||||
}
|
}
|
||||||
|
|
||||||
self thread watch_for_override_stuff();
|
self thread watch_for_override_stuff();
|
||||||
|
self thread watch_for_melee_override();
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -2846,12 +2858,26 @@ bot_watch_think_mw2()
|
|||||||
*/
|
*/
|
||||||
bot_weapon_think_loop( data )
|
bot_weapon_think_loop( data )
|
||||||
{
|
{
|
||||||
|
ret = self waittill_any_timeout( randomIntRange( 2, 4 ), "bot_force_check_switch" );
|
||||||
|
|
||||||
|
if ( self isDefusing() || self isPlanting() )
|
||||||
|
return;
|
||||||
|
|
||||||
|
if ( self IsRemoteControlling() )
|
||||||
|
return;
|
||||||
|
|
||||||
|
if ( self InLastStand() )
|
||||||
|
return;
|
||||||
|
|
||||||
curWeap = self GetCurrentWeapon();
|
curWeap = self GetCurrentWeapon();
|
||||||
threat = self getThreat();
|
threat = self getThreat();
|
||||||
|
|
||||||
if ( isDefined( threat ) && !isPlayer( threat ) )
|
// code handles vehicle weapon switching
|
||||||
|
if ( isDefined( threat ) && !isPlayer( threat ) && !isAi( threat ) )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
force = ( ret == "bot_force_check_switch" );
|
||||||
|
|
||||||
if ( data.first )
|
if ( data.first )
|
||||||
{
|
{
|
||||||
data.first = false;
|
data.first = false;
|
||||||
@ -2869,6 +2895,8 @@ bot_weapon_think_loop( data )
|
|||||||
if ( isDefined( threat ) )
|
if ( isDefined( threat ) )
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
force = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
weaponslist = self getweaponslist();
|
weaponslist = self getweaponslist();
|
||||||
@ -2879,7 +2907,7 @@ bot_weapon_think_loop( data )
|
|||||||
weapon = weaponslist[randomInt( weaponslist.size )];
|
weapon = weaponslist[randomInt( weaponslist.size )];
|
||||||
weaponslist = array_remove( weaponslist, weapon );
|
weaponslist = array_remove( weaponslist, weapon );
|
||||||
|
|
||||||
if ( !self getAmmoCount( weapon ) )
|
if ( !self getAmmoCount( weapon ) && !force )
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if ( !maps\mp\gametypes\_weapons::isPrimaryWeapon( weapon ) && !maps\mp\gametypes\_weapons::isSideArm( weapon ) && !isWeaponAltmode( weapon ) )
|
if ( !maps\mp\gametypes\_weapons::isPrimaryWeapon( weapon ) && !maps\mp\gametypes\_weapons::isSideArm( weapon ) && !isWeaponAltmode( weapon ) )
|
||||||
@ -2913,17 +2941,6 @@ bot_weapon_think()
|
|||||||
|
|
||||||
for ( ;; )
|
for ( ;; )
|
||||||
{
|
{
|
||||||
self waittill_any_timeout( randomIntRange( 2, 4 ), "bot_force_check_switch" );
|
|
||||||
|
|
||||||
if ( self isDefusing() || self isPlanting() )
|
|
||||||
continue;
|
|
||||||
|
|
||||||
if ( self IsRemoteControlling() )
|
|
||||||
continue;
|
|
||||||
|
|
||||||
if ( self InLastStand() )
|
|
||||||
continue;
|
|
||||||
|
|
||||||
self bot_weapon_think_loop( data );
|
self bot_weapon_think_loop( data );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -5382,6 +5399,64 @@ bot_dem_defend_spawnkill()
|
|||||||
self notify( "bad_path" );
|
self notify( "bad_path" );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
custom movement stuff
|
||||||
|
*/
|
||||||
|
watch_for_melee_override()
|
||||||
|
{
|
||||||
|
self endon( "disconnect" );
|
||||||
|
self endon( "death" );
|
||||||
|
|
||||||
|
self BotBuiltinClearMeleeParams();
|
||||||
|
|
||||||
|
for ( ;; )
|
||||||
|
{
|
||||||
|
threat = self getThreat();
|
||||||
|
|
||||||
|
while ( !isDefined( threat ) || ( !isPlayer( threat ) && !isAi( threat ) ) || self IsRemoteControlling() || !self HasWeapon( "knife_mp" ) || !getDvarInt( "aim_automelee_enabled" ) )
|
||||||
|
{
|
||||||
|
wait 0.05;
|
||||||
|
threat = self getThreat();
|
||||||
|
}
|
||||||
|
|
||||||
|
thisThreat = self getThreat();
|
||||||
|
|
||||||
|
while ( isDefined( thisThreat ) && isDefined( threat ) && thisThreat == threat )
|
||||||
|
{
|
||||||
|
dist = distance( self.origin, threat.origin );
|
||||||
|
|
||||||
|
if ( self isOnGround() && self GetStance() != "prone" && !self InLastStand() && dist < getDvarFloat( "aim_automelee_range" ) && ( getConeDot( threat.origin, self.origin, self getPlayerAngles() ) > 0.9 || dist < 10 ) )
|
||||||
|
{
|
||||||
|
angles = VectorToAngles( threat.origin - self.origin );
|
||||||
|
|
||||||
|
self BotBuiltinBotMeleeParams( angles[1], dist );
|
||||||
|
self BotBuiltinButtonOverride( "melee", "enable" );
|
||||||
|
|
||||||
|
time_left = 1;
|
||||||
|
|
||||||
|
while ( time_left > 0 && isDefined( threat ) && isAlive( threat ) )
|
||||||
|
{
|
||||||
|
self BotBuiltinAimOverride();
|
||||||
|
self setPlayerAngles( VectorToAngles( threat getTagOrigin( "j_spine4" ) - self getEye() ) );
|
||||||
|
time_left -= 0.05;
|
||||||
|
wait 0.05;
|
||||||
|
self BotBuiltinClearMeleeParams();
|
||||||
|
self BotBuiltinClearButtonOverride( "melee" );
|
||||||
|
}
|
||||||
|
|
||||||
|
self BotBuiltinClearButtonOverride( "melee" );
|
||||||
|
self BotBuiltinClearMeleeParams();
|
||||||
|
self BotBuiltinClearAimOverride();
|
||||||
|
wait 1;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
wait 0.05;
|
||||||
|
thisThreat = self getThreat();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
custom movement stuff
|
custom movement stuff
|
||||||
*/
|
*/
|
||||||
@ -5416,7 +5491,7 @@ watch_for_override_stuff()
|
|||||||
{
|
{
|
||||||
threat = self getThreat();
|
threat = self getThreat();
|
||||||
|
|
||||||
while ( !isDefined( threat ) || !isPlayer( threat ) )
|
while ( !isDefined( threat ) || !isPlayer( threat ) || self IsRemoteControlling() )
|
||||||
{
|
{
|
||||||
wait 0.05;
|
wait 0.05;
|
||||||
threat = self getThreat();
|
threat = self getThreat();
|
||||||
@ -5424,6 +5499,7 @@ watch_for_override_stuff()
|
|||||||
|
|
||||||
dist = Distance( threat.origin, self.origin );
|
dist = Distance( threat.origin, self.origin );
|
||||||
time = GetTime();
|
time = GetTime();
|
||||||
|
weap = self GetCurrentWeapon();
|
||||||
|
|
||||||
if ( need_to_clear_mantle_override && ( time - last_jump_time ) > 3000 )
|
if ( need_to_clear_mantle_override && ( time - last_jump_time ) > 3000 )
|
||||||
{
|
{
|
||||||
@ -5431,7 +5507,12 @@ watch_for_override_stuff()
|
|||||||
self BotBuiltinClearMantleOverride();
|
self BotBuiltinClearMantleOverride();
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( ( dist > NEAR_DIST ) && ( dist < LONG_DIST ) && ( randomInt( 100 ) < chance ) && ( ( time - last_jump_time ) > SPAM_JUMP_TIME ) )
|
weapon_is_good = true;
|
||||||
|
|
||||||
|
if ( weap == "none" || !self GetWeaponAmmoClip( weap ) )
|
||||||
|
weapon_is_good = false;
|
||||||
|
|
||||||
|
if ( weapon_is_good && ( dist > NEAR_DIST ) && ( dist < LONG_DIST ) && ( randomInt( 100 ) < chance ) && ( ( time - last_jump_time ) > SPAM_JUMP_TIME ) )
|
||||||
{
|
{
|
||||||
if ( randomInt( 2 ) )
|
if ( randomInt( 2 ) )
|
||||||
{
|
{
|
||||||
@ -5466,7 +5547,7 @@ watch_for_override_stuff()
|
|||||||
|
|
||||||
thisThreat = self getThreat();
|
thisThreat = self getThreat();
|
||||||
|
|
||||||
while ( isDefined( thisThreat ) && isPlayer( thisThreat ) && thisThreat == threat )
|
while ( isDefined( thisThreat ) && isDefined( threat ) && thisThreat == threat )
|
||||||
{
|
{
|
||||||
wait 0.05;
|
wait 0.05;
|
||||||
thisThreat = self getThreat();
|
thisThreat = self getThreat();
|
||||||
|
@ -174,6 +174,16 @@ BotBuiltinBotMeleeParams( yaw, dist )
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
*/
|
||||||
|
BotBuiltinClearMeleeParams()
|
||||||
|
{
|
||||||
|
if ( isDefined( level.bot_builtins ) && isDefined( level.bot_builtins["clearbotmeleeparams"] ) )
|
||||||
|
{
|
||||||
|
self [[ level.bot_builtins["clearbotmeleeparams" ]]]();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Returns an array of all the bots in the game.
|
Returns an array of all the bots in the game.
|
||||||
*/
|
*/
|
||||||
|
@ -14,6 +14,7 @@ init()
|
|||||||
level.bot_builtins["botaimoverride"] = ::do_botaimoverride;
|
level.bot_builtins["botaimoverride"] = ::do_botaimoverride;
|
||||||
level.bot_builtins["botclearaimoverride"] = ::do_botclearaimoverride;
|
level.bot_builtins["botclearaimoverride"] = ::do_botclearaimoverride;
|
||||||
level.bot_builtins["botmeleeparams"] = ::do_botmeleeparams;
|
level.bot_builtins["botmeleeparams"] = ::do_botmeleeparams;
|
||||||
|
level.bot_builtins["clearbotmeleeparams"] = ::do_clearbotmeleeparams;
|
||||||
}
|
}
|
||||||
|
|
||||||
do_printconsole( s )
|
do_printconsole( s )
|
||||||
@ -85,3 +86,8 @@ do_botmeleeparams( yaw, dist )
|
|||||||
{
|
{
|
||||||
// self botMeleeParams( yaw, dist );
|
// self botMeleeParams( yaw, dist );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
do_clearbotmeleeparams()
|
||||||
|
{
|
||||||
|
// self botClearMeleeParams();
|
||||||
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user