Skip to content

Commit

Permalink
Fix Titan Assist not tracking properly (#744)
Browse files Browse the repository at this point in the history
Titan Assist medals aren't given to players who assisted damage when someone kills a titan, that is due the fact that Titans stores damage history in their Soul component, not the NPC itself.
  • Loading branch information
Zanieon authored Oct 18, 2023
1 parent bc4e426 commit aa79ad4
Showing 1 changed file with 15 additions and 10 deletions.
25 changes: 15 additions & 10 deletions Northstar.CustomServers/mod/scripts/vscripts/mp/_score.nut
Original file line number Diff line number Diff line change
Expand Up @@ -202,18 +202,23 @@ void function ScoreEvent_TitanKilled( entity victim, entity attacker, var damage
AddPlayerScore( attacker, "KillTitan" )
}

table<int, bool> alreadyAssisted
foreach( DamageHistoryStruct attackerInfo in victim.e.recentDamageHistory )
entity soul = victim.GetTitanSoul()
if ( IsValid( soul ) )
{
if ( !IsValid( attackerInfo.attacker ) || !attackerInfo.attacker.IsPlayer() || attackerInfo.attacker == victim )
continue

bool exists = attackerInfo.attacker.GetEncodedEHandle() in alreadyAssisted ? true : false
if( attackerInfo.attacker != attacker && !exists )
table<int, bool> alreadyAssisted

foreach( DamageHistoryStruct attackerInfo in soul.e.recentDamageHistory )
{
alreadyAssisted[attackerInfo.attacker.GetEncodedEHandle()] <- true
AddPlayerScore(attackerInfo.attacker, "TitanAssist" )
Remote_CallFunction_NonReplay( attackerInfo.attacker, "ServerCallback_SetAssistInformation", attackerInfo.damageSourceId, attacker.GetEncodedEHandle(), victim.GetEncodedEHandle(), attackerInfo.time )
if ( !IsValid( attackerInfo.attacker ) || !attackerInfo.attacker.IsPlayer() || attackerInfo.attacker == soul )
continue

bool exists = attackerInfo.attacker.GetEncodedEHandle() in alreadyAssisted ? true : false
if( attackerInfo.attacker != attacker && !exists )
{
alreadyAssisted[attackerInfo.attacker.GetEncodedEHandle()] <- true
AddPlayerScore(attackerInfo.attacker, "TitanAssist" )
Remote_CallFunction_NonReplay( attackerInfo.attacker, "ServerCallback_SetAssistInformation", attackerInfo.damageSourceId, attacker.GetEncodedEHandle(), soul.GetEncodedEHandle(), attackerInfo.time )
}
}
}

Expand Down

0 comments on commit aa79ad4

Please sign in to comment.