[Mod FF]: Fixed blackout battlechatter, refactored the battlechatter script and some fix in _damagefeedback

This commit is contained in:
JerryALT 2024-03-29 20:50:58 +03:00
parent 698d14d73f
commit e29fb79d36
3 changed files with 102 additions and 290 deletions

View File

@ -12,7 +12,7 @@ init()
// if ( getDvar( "scr_damagefeedback" ) == "0" )
// return;
axis = getaiarray( "axis" );
axis = getAIArray( "axis" );
array_thread( axis, ::monitorDamage );
add_global_spawn_function( "axis", ::monitorDamage );
@ -56,18 +56,18 @@ damagefeedback_took_damage( damage, attacker, direction_vec, point, type, modelN
legal_bullet_types = [];
legal_bullet_types[ "MOD_PISTOL_BULLET" ] = true;
legal_bullet_types[ "MOD_RIFLE_BULLET" ] = true;
if ( isdefined( self.bullet_resistance ) )
if ( isDefined( self.bullet_resistance ) )
{
if ( isdefined( legal_bullet_types[ type ] ) )
if ( isDefined( legal_bullet_types[ type ] ) )
{
if ( damage <= self.bullet_resistance )
return;
}
}
if ( !isalive( self ) )
if ( !isAlive( self ) )
{
headshot = false;
if ( ( self.damageLocation == "helmet" || self.damageLocation == "head" ) && isdefined( legal_bullet_types[ type ] ) )
if ( ( self.damageLocation == "helmet" || self.damageLocation == "head" ) && isDefined( legal_bullet_types[ type ] ) )
headshot = true;
attacker updateDamageFeedback( self, true, headshot );
@ -79,22 +79,51 @@ damagefeedback_took_damage( damage, attacker, direction_vec, point, type, modelN
}
updateDamageFeedback( attacked, kill, headshot )
{
if ( !isPlayer( self ) )
return;
if ( !isDefined( attacked.team ) )
return;
if ( ( attacked.team == "allies" ) || ( attacked.team == "neutral" ) )
return;
/*
if ( isDefined( attacked.magic_bullet_shield ) && attacked.magic_bullet_shield )
return;
if ( isDefined( attacked.godmode ) && attacked.godmode )
return;
if ( isDefined( attacked.script_godmode ) && attacked.script_godmode )
return;
*/
self updateDamageFeedbackSnd();
self updateDamageFeedbackHUD( attacked, kill, headshot );
}
updateDamageFeedbackSnd()
{
if ( getDvar( "snd_hitsoundDisabled" ) == "1" )
return;
if ( !isPlayer( self ) )
return;
if ( soundExists( "SP_hit_alert_npc" ) )
self playLocalSound( "SP_hit_alert_npc" );
}
updateDamageFeedbackHUD( attacked, kill, headshot )
{
if ( getDvar( "cg_drawDamageFeedbackOption" ) == "0" )
return;
if ( !isPlayer( self ) )
return;
if ( !isdefined( attacked.team ) )
return;
if ( ( attacked.team == "allies" ) || ( attacked.team == "neutral" ) )
return;
if ( getDvar( "snd_hitsoundDisabled" ) == "0" )
self playlocalsound( "SP_hit_alert_npc" );
fadeTime = 1; //fade out crosshair damage indicator over this time
//If in slomo, fade out damage indicator faster (the value entered for the slomo time fraction
if ( isDefined( level.slowmo.speed_slow ) )
fadeTime = level.slowmo.speed_slow;
if ( kill )
self.hud_damagefeedback.color = ( 1, 0.2, 0.2 );
else

View File

@ -1,78 +1,6 @@
main()
init()
{
ReplaceFunc(animscripts\battlechatter::init_battlechatter, ::init_battlechatter);
}
init_battleChatter()
{
if (isdefined (anim.chatInitialized) && anim.chatInitialized)
return;
if (getdvar ("bcs_enable") == "")
setdvar ("bcs_enable", "on");
if (getdvar ("bcs_enable") == "off")
{
anim.chatInitialized = false;
anim.player.chatInitialized = false;
return;
}
anim.chatInitialized = true;
anim.player.chatInitialized = false;
if (getdvar ("bcs_filterThreat") == "")
setdvar ("bcs_filterThreat", "off");
if (getdvar ("bcs_filterInform") == "")
setdvar ("bcs_filterInform", "off");
if (getdvar ("bcs_filterOrder") == "")
setdvar ("bcs_filterOrder", "off");
if (getdvar ("bcs_filterReaction") == "")
setdvar ("bcs_filterReaction", "off");
if (getdvar ("bcs_filterResponse") == "")
setdvar ("bcs_filterResponse", "off");
if (getdvar ("bcs_threatLimitTargettedBySelf") == "")
setdvar ("bcs_threatLimitTargettedBySelf", "off");
if (getdvar ("bcs_threatLimitTargetingPlayer") == "")
setdvar ("bcs_threatLimitTargetingPlayer", "off");
if (getdvar ("bcs_threatLimitInPlayerFOV") == "")
setdvar ("bcs_threatLimitInPlayerFOV", "on");
if (getdvar ("bcs_threatLimitInLocation") == "")
setdvar ("bcs_threatLimitInLocation", "on");
if (getdvar ("bcs_threatLimitSpeakerDist") == "")
setdvar ("bcs_threatLimitSpeakerDist", "512");
if (getdvar ("bcs_threatLimitThreatDist") == "")
setdvar ("bcs_threatLimitThreatDist", "2048");
if (getdvar ("bcs_threatPlayerRelative") == "")
setdvar ("bcs_threatPlayerRelative", "off");
if (getdvar("debug_bcprint") == "")
setdvar("debug_bcprint", "off");
if (getdvar("debug_bcshowqueue") == "")
setdvar("debug_bcshowqueue", "off");
/#
if (getdvar("debug_bcthreat") == "")
setdvar("debug_bcthreat", "off");
if (getdvar("debug_bcresponse") == "")
setdvar("debug_bcresponse", "off");
if (getdvar("debug_bcorder") == "")
setdvar("debug_bcorder", "off");
if (getdvar("debug_bcinform") == "")
setdvar("debug_bcinform", "off");
if (getdvar("debug_bcdrawobjects") == "")
setdvar("debug_bcdrawobjects", "off");
if (getdvar("debug_bcinteraction") == "")
setdvar("debug_bcinteraction", "off");
#/
anim.countryIDs["british"] = "UK";
anim.countryIDs["american"] = "US";
anim.countryIDs["russian"] = "RU";
anim.countryIDs["arab"] = "AB";
anim.usedIDs = undefined;
// IDs Updated 13.04.2023 (10:24 PM)
anim.usedIDs = [];
anim.usedIDs["russian"] = [];
@ -127,157 +55,4 @@ init_battleChatter()
anim.usedIDs["arab"][3] = spawnstruct();
anim.usedIDs["arab"][3].count = 0;
anim.usedIDs["arab"][3].npcID = "3";
anim.eventTypeMinWait = [];
anim.eventTypeMinWait["threat"] = [];
anim.eventTypeMinWait["response"] = [];
anim.eventTypeMinWait["reaction"] = [];
anim.eventTypeMinWait["order"] = [];
anim.eventTypeMinWait["inform"] = [];
anim.eventTypeMinWait["custom"] = [];
anim.eventTypeMinWait["direction"] = [];
// If you want to tweak how often battlechatter messages happen,
// this is place to do it.
// A priority of 1 will force an event to be added to the queue, and
// will make it override pre-existing events of the same type.
// times are in milliseconds
/*
anim.eventActionMinWait["threat"]["self"] = 12000;
anim.eventActionMinWait["threat"]["squad"] = 6000;
anim.eventActionMinWait["response"]["self"] = 1000;
anim.eventActionMinWait["response"]["squad"] = 1000;
anim.eventActionMinWait["reaction"]["self"] = 1000;
anim.eventActionMinWait["reaction"]["squad"] = 1000;
anim.eventActionMinWait["order"]["self"] = 16000;
anim.eventActionMinWait["order"]["squad"] = 12000;
anim.eventActionMinWait["inform"]["self"] = 12000;
anim.eventActionMinWait["inform"]["squad"] = 6000;
anim.eventActionMinWait["custom"]["self"] = 0;
anim.eventActionMinWait["custom"]["squad"] = 0;
*/
if ( isDefined( level._stealth ) )
{
anim.eventActionMinWait["threat"]["self"] = 20000;
anim.eventActionMinWait["threat"]["squad"] = 30000;
}
else
{
anim.eventActionMinWait["threat"]["self"] = 12000;
anim.eventActionMinWait["threat"]["squad"] = 8000;
}
anim.eventActionMinWait["response"]["self"] = 1000;
anim.eventActionMinWait["response"]["squad"] = 1000;
anim.eventActionMinWait["reaction"]["self"] = 1000;
anim.eventActionMinWait["reaction"]["squad"] = 1000;
anim.eventActionMinWait["order"]["self"] = 8000;
anim.eventActionMinWait["order"]["squad"] = 40000;
anim.eventActionMinWait["inform"]["self"] = 6000;
anim.eventActionMinWait["inform"]["squad"] = 8000;
anim.eventActionMinWait["custom"]["self"] = 0;
anim.eventActionMinWait["custom"]["squad"] = 5000;
anim.eventTypeMinWait["reaction"]["casualty"] = 20000;
anim.eventTypeMinWait["reaction"]["taunt"] = 200000;
anim.eventTypeMinWait["inform"]["reloading"] = 20000;
anim.eventPriority["threat"]["infantry"] = 0.5;
anim.eventPriority["threat"]["emplacement"] = 0.6;
anim.eventPriority["threat"]["vehicle"] = 0.7;
anim.eventPriority["response"]["killfirm"] = 0.8;
anim.eventPriority["response"]["ack"] = 0.9;
anim.eventPriority["reaction"]["casualty"] = 0.5;
anim.eventPriority["reaction"]["taunt"] = 0.9;
anim.eventPriority["order"]["cover"] = 0.9;
anim.eventPriority["order"]["action"] = 0.5;
anim.eventPriority["order"]["move"] = 0.9;
anim.eventPriority["order"]["displace"] = 0.5;
anim.eventPriority["inform"]["killfirm"] = 0.6;
anim.eventPriority["inform"]["attack"] = 0.9;
anim.eventPriority["inform"]["incoming"] = 0.8;
anim.eventPriority["inform"]["reloading"] = 0.2;
anim.eventPriority["inform"]["suppressed"] = 0.2;
anim.eventPriority["custom"]["generic"] = 1.0;
anim.eventDuration["threat"]["emplacement"] = 1000;
anim.eventDuration["threat"]["infantry"] = 1000;
anim.eventDuration["threat"]["vehicle"] = 1000;
anim.eventDuration["response"]["killfirm"] = 3000;
anim.eventDuration["response"]["ack"] = 2000;
anim.eventDuration["reaction"]["casualty"] = 2000;
anim.eventDuration["reaction"]["taunt"] = 2000;
anim.eventDuration["order"]["cover"] = 3000;
anim.eventDuration["order"]["action"] = 3000;
anim.eventDuration["order"]["move"] = 3000;
anim.eventDuration["order"]["displace"] = 3000;
anim.eventDuration["inform"]["killfirm"] = 1000;
anim.eventDuration["inform"]["attack"] = 1000;
anim.eventDuration["inform"]["incoming"] = 1000;
anim.eventDuration["inform"]["reloading"] = 1000;
anim.eventDuration["inform"]["suppressed"] = 2000;
anim.eventDuration["custom"]["generic"] = 1000;
anim.chatCount = 0;
anim.moveOrigin = spawn ("script_origin", (0, 0, 0));
anim.areas = getentarray ("trigger_location", "targetname");
anim.locations = getentarray ("trigger_location", "targetname");
anim.landmarks = getentarray ("trigger_landmark", "targetname");
/#
if (getdvar("debug_bcdrawobjects") == "on")
thread bcDrawObjects();
#/
anim.squadCreateFuncs[anim.squadCreateFuncs.size] = animscripts\battlechatter::init_squadBattleChatter;
anim.squadCreateStrings[anim.squadCreateStrings.size] = "::init_squadBattleChatter";
anim.isTeamSpeaking["allies"] = false;
anim.isTeamSaying["allies"]["threat"] = false;
anim.isTeamSaying["allies"]["order"] = false;
anim.isTeamSaying["allies"]["reaction"] = false;
anim.isTeamSaying["allies"]["response"] = false;
anim.isTeamSaying["allies"]["inform"] = false;
anim.isTeamSaying["allies"]["custom"] = false;
anim.isTeamSpeaking["axis"] = false;
anim.isTeamSaying["axis"]["threat"] = false;
anim.isTeamSaying["axis"]["order"] = false;
anim.isTeamSaying["axis"]["reaction"] = false;
anim.isTeamSaying["axis"]["response"] = false;
anim.isTeamSaying["axis"]["inform"] = false;
anim.isTeamSaying["axis"]["custom"] = false;
anim.isTeamSpeaking["neutral"] = false;
anim.isTeamSaying["neutral"]["threat"] = false;
anim.isTeamSaying["neutral"]["order"] = false;
anim.isTeamSaying["neutral"]["reaction"] = false;
anim.isTeamSaying["neutral"]["response"] = false;
anim.isTeamSaying["neutral"]["inform"] = false;
anim.isTeamSaying["neutral"]["custom"] = false;
if (!isdefined(level.battlechatter))
{
level.battlechatter = [];
level.battlechatter["allies"] = true;
level.battlechatter["axis"] = true;
level.battlechatter["neutral"] = true;
}
anim.lastTeamSpeakTime = [];
anim.lastTeamSpeakTime["allies"] = -5000; // so it doesnt pause if nobody has ever spoken
anim.lastTeamSpeakTime["axis"] = -5000;
for (index = 0; index < anim.squadIndex.size; index++)
{
if (isdefined(anim.squadIndex[index].chatInitialized) && anim.squadIndex[index].chatInitialized )
continue;
anim.squadIndex[index] animscripts\battlechatter::init_squadbattlechatter();
}
level notify ("battlechatter initialized");
anim notify ("battlechatter initialized");
}

View File

@ -0,0 +1,8 @@
init()
{
/* Original
level.scr_sound[ "gaz" ][ "tango_down" ] = "UK_2_inform_killfirm_generic_s";
*/
// Modded
level.scr_sound[ "gaz" ][ "tango_down" ] = "UK_gaz_inform_killfirm_generic_s";
}