mirror of
https://github.com/ineedbots/iw4_bot_warfare.git
synced 2025-04-19 13:02:54 +00:00
added knife lunge
This commit is contained in:
parent
a9b35c3502
commit
73b2cf5153
@ -150,7 +150,7 @@ init()
|
|||||||
level.bots_minGrenadeDistance *= level.bots_minGrenadeDistance;
|
level.bots_minGrenadeDistance *= level.bots_minGrenadeDistance;
|
||||||
level.bots_maxGrenadeDistance = 1024;
|
level.bots_maxGrenadeDistance = 1024;
|
||||||
level.bots_maxGrenadeDistance *= level.bots_maxGrenadeDistance;
|
level.bots_maxGrenadeDistance *= level.bots_maxGrenadeDistance;
|
||||||
level.bots_maxKnifeDistance = 80;
|
level.bots_maxKnifeDistance = 128;
|
||||||
level.bots_maxKnifeDistance *= level.bots_maxKnifeDistance;
|
level.bots_maxKnifeDistance *= level.bots_maxKnifeDistance;
|
||||||
level.bots_goalDistance = 27.5;
|
level.bots_goalDistance = 27.5;
|
||||||
level.bots_goalDistance *= level.bots_goalDistance;
|
level.bots_goalDistance *= level.bots_goalDistance;
|
||||||
|
@ -130,6 +130,7 @@ resetBotVars()
|
|||||||
self.bot.issmokingafter = false;
|
self.bot.issmokingafter = false;
|
||||||
self.bot.isknifing = false;
|
self.bot.isknifing = false;
|
||||||
self.bot.isknifingafter = false;
|
self.bot.isknifingafter = false;
|
||||||
|
self.bot.knifing_target = undefined;
|
||||||
|
|
||||||
self.bot.semi_time = false;
|
self.bot.semi_time = false;
|
||||||
self.bot.jump_time = undefined;
|
self.bot.jump_time = undefined;
|
||||||
@ -602,7 +603,7 @@ doBotMovement_loop( data )
|
|||||||
}
|
}
|
||||||
|
|
||||||
// move!
|
// move!
|
||||||
if ( self.bot.wantsprint && self.bot.issprinting )
|
if ( ( self.bot.wantsprint && self.bot.issprinting ) || isDefined( self.bot.knifing_target ) )
|
||||||
dir = ( 127, dir[1], 0 );
|
dir = ( 127, dir[1], 0 );
|
||||||
|
|
||||||
self BotBuiltinBotMovement( int( dir[0] ), int( dir[1] ) );
|
self BotBuiltinBotMovement( int( dir[0] ), int( dir[1] ) );
|
||||||
@ -1462,7 +1463,7 @@ aim_loop()
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if ( self canAds( dist, curweap ) )
|
if ( self canFire( curweap ) && self isInRange( dist, curweap ) && self canAds( dist, curweap ) )
|
||||||
{
|
{
|
||||||
if ( !self.bot.is_cur_sniper || !self.pers["bots"]["behavior"]["quickscope"] )
|
if ( !self.bot.is_cur_sniper || !self.pers["bots"]["behavior"]["quickscope"] )
|
||||||
self thread pressAds();
|
self thread pressAds();
|
||||||
@ -1488,7 +1489,9 @@ aim_loop()
|
|||||||
|
|
||||||
conedot = getConeDot( aimpos, eyePos, angles );
|
conedot = getConeDot( aimpos, eyePos, angles );
|
||||||
|
|
||||||
if ( conedot > 0.999 && lengthsquared( aimoffset ) < 0.05 )
|
if ( isDefined( self.bot.knifing_target ) )
|
||||||
|
self thread bot_lookat( target getTagOrigin( "j_spine4" ), 0.05 );
|
||||||
|
else if ( conedot > 0.999 && lengthsquared( aimoffset ) < 0.05 )
|
||||||
self thread bot_lookat( aimpos, 0.05 );
|
self thread bot_lookat( aimpos, 0.05 );
|
||||||
else
|
else
|
||||||
self thread bot_lookat( aimpos, aimspeed, target getVelocity(), true );
|
self thread bot_lookat( aimpos, aimspeed, target getVelocity(), true );
|
||||||
@ -1511,12 +1514,12 @@ aim_loop()
|
|||||||
knifeDist = level.bots_maxKnifeDistance;
|
knifeDist = level.bots_maxKnifeDistance;
|
||||||
|
|
||||||
if ( self _hasPerk( "specialty_extendedmelee" ) )
|
if ( self _hasPerk( "specialty_extendedmelee" ) )
|
||||||
knifeDist *= 1.4;
|
knifeDist *= 1.995;
|
||||||
|
|
||||||
if ( ( isplay || target.classname == "misc_turret" ) && !self.bot.isknifingafter && conedot > 0.9 && dist < knifeDist && trace_time > reaction_time && !usingRemote && getDvarInt( "bots_play_knife" ) )
|
if ( ( isplay || target.classname == "misc_turret" ) && !self.bot.isknifingafter && conedot > 0.9 && dist < knifeDist && trace_time > reaction_time && !usingRemote && getDvarInt( "bots_play_knife" ) )
|
||||||
{
|
{
|
||||||
self clear_bot_after_target();
|
self clear_bot_after_target();
|
||||||
self thread knife();
|
self thread knife( target );
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2290,16 +2293,54 @@ sprint()
|
|||||||
self BotBuiltinBotAction( "-sprint" );
|
self BotBuiltinBotAction( "-sprint" );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
Performs melee target
|
||||||
|
*/
|
||||||
|
do_knife_target( target )
|
||||||
|
{
|
||||||
|
self endon( "death" );
|
||||||
|
self endon( "disconnect" );
|
||||||
|
self endon( "bot_knife" );
|
||||||
|
|
||||||
|
if ( !isDefined( target ) || !isPlayer( target ) )
|
||||||
|
{
|
||||||
|
self.bot.knifing_target = undefined;
|
||||||
|
self BotBuiltinBotMeleeParams( 0, 0 );
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
dist = distance( target.origin, self.origin );
|
||||||
|
|
||||||
|
if ( !self _hasPerk( "specialty_extendedmelee" ) && dist > getDvarFloat( "aim_automelee_range" ) )
|
||||||
|
{
|
||||||
|
self.bot.knifing_target = undefined;
|
||||||
|
self BotBuiltinBotMeleeParams( 0, 0 );
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
self.bot.knifing_target = target;
|
||||||
|
|
||||||
|
angles = VectorToAngles( target.origin - self.origin );
|
||||||
|
self BotBuiltinBotMeleeParams( angles[1], dist );
|
||||||
|
|
||||||
|
wait 1;
|
||||||
|
|
||||||
|
self.bot.knifing_target = undefined;
|
||||||
|
self BotBuiltinBotMeleeParams( 0, 0 );
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Bot will knife.
|
Bot will knife.
|
||||||
*/
|
*/
|
||||||
knife()
|
knife( target )
|
||||||
{
|
{
|
||||||
self endon( "death" );
|
self endon( "death" );
|
||||||
self endon( "disconnect" );
|
self endon( "disconnect" );
|
||||||
self notify( "bot_knife" );
|
self notify( "bot_knife" );
|
||||||
self endon( "bot_knife" );
|
self endon( "bot_knife" );
|
||||||
|
|
||||||
|
self thread do_knife_target( target );
|
||||||
|
|
||||||
self.bot.isknifing = true;
|
self.bot.isknifing = true;
|
||||||
self.bot.isknifingafter = true;
|
self.bot.isknifingafter = true;
|
||||||
|
|
||||||
|
@ -3900,7 +3900,7 @@ doReloadCancel()
|
|||||||
*/
|
*/
|
||||||
bot_weapon_think_loop( data )
|
bot_weapon_think_loop( data )
|
||||||
{
|
{
|
||||||
self waittill_any_timeout( randomIntRange( 2, 4 ), "bot_force_check_switch" );
|
ret = self waittill_any_timeout( randomIntRange( 2, 4 ), "bot_force_check_switch" );
|
||||||
|
|
||||||
if ( self BotIsFrozen() )
|
if ( self BotIsFrozen() )
|
||||||
return;
|
return;
|
||||||
@ -3947,6 +3947,8 @@ bot_weapon_think_loop( data )
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
force = ( ret == "bot_force_check_switch" );
|
||||||
|
|
||||||
if ( data.first )
|
if ( data.first )
|
||||||
{
|
{
|
||||||
data.first = false;
|
data.first = false;
|
||||||
@ -3964,6 +3966,8 @@ bot_weapon_think_loop( data )
|
|||||||
if ( hasTarget )
|
if ( hasTarget )
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
force = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
weaponslist = self getweaponslistall();
|
weaponslist = self getweaponslistall();
|
||||||
@ -3974,7 +3978,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 ( !isWeaponPrimary( weapon ) )
|
if ( !isWeaponPrimary( weapon ) )
|
||||||
|
@ -117,6 +117,17 @@ BotBuiltinBotMovement( forward, right )
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
Sets melee params
|
||||||
|
*/
|
||||||
|
BotBuiltinBotMeleeParams( yaw, dist )
|
||||||
|
{
|
||||||
|
if ( isDefined( level.bot_builtins ) && isDefined( level.bot_builtins["botmeleeparams"] ) )
|
||||||
|
{
|
||||||
|
self [[ level.bot_builtins["botmeleeparams" ]]]( yaw, dist );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Returns if player is the host
|
Returns if player is the host
|
||||||
*/
|
*/
|
||||||
|
@ -7,6 +7,7 @@ init()
|
|||||||
level.bot_builtins["botaction"] = ::do_botaction;
|
level.bot_builtins["botaction"] = ::do_botaction;
|
||||||
level.bot_builtins["botstop"] = ::do_botstop;
|
level.bot_builtins["botstop"] = ::do_botstop;
|
||||||
level.bot_builtins["botmovement"] = ::do_botmovement;
|
level.bot_builtins["botmovement"] = ::do_botmovement;
|
||||||
|
level.bot_builtins["botmeleeparams"] = ::do_botmeleeparams;
|
||||||
}
|
}
|
||||||
|
|
||||||
do_printconsole( s )
|
do_printconsole( s )
|
||||||
@ -46,3 +47,8 @@ do_botmovement( forward, right )
|
|||||||
{
|
{
|
||||||
self BotMovement( forward, right );
|
self BotMovement( forward, right );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
do_botmeleeparams( yaw, dist )
|
||||||
|
{
|
||||||
|
self BotMeleeParams( yaw, dist );
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user