diff options
author | Will Castro <39478251+VITALISED@users.noreply.github.com> | 2022-01-10 20:38:50 +1100 |
---|---|---|
committer | Will Castro <39478251+VITALISED@users.noreply.github.com> | 2022-01-10 20:38:50 +1100 |
commit | af2f675a13c1e82fc4900bd61aadc88facd4775a (patch) | |
tree | d2bb2463e38a91b74f6cafddcf5f7412959dc7fb /Northstar.CustomServers/mod/scripts | |
parent | 62ff78cefebfb2c525adea2bd11deba664fc04f3 (diff) | |
download | NorthstarMods-af2f675a13c1e82fc4900bd61aadc88facd4775a.tar.gz NorthstarMods-af2f675a13c1e82fc4900bd61aadc88facd4775a.zip |
Add assist medals and scoring
Diffstat (limited to 'Northstar.CustomServers/mod/scripts')
4 files changed, 43 insertions, 6 deletions
diff --git a/Northstar.CustomServers/mod/scripts/vscripts/gamemodes/_gamemode_ps.nut b/Northstar.CustomServers/mod/scripts/vscripts/gamemodes/_gamemode_ps.nut index 4f05d87a..965557b6 100644 --- a/Northstar.CustomServers/mod/scripts/vscripts/gamemodes/_gamemode_ps.nut +++ b/Northstar.CustomServers/mod/scripts/vscripts/gamemodes/_gamemode_ps.nut @@ -32,13 +32,20 @@ void function GiveScoreForPlayerKill( entity victim, entity attacker, var damage {
if ( victim != attacker && victim.IsPlayer() && attacker.IsPlayer() || GetGameState() != eGameState.Playing )
AddTeamScore( attacker.GetTeam(), 1 )
+
+ var existingAttackers = []
+ foreach(DamageHistoryStruct attackerInfo in victim.e.recentDamageHistory)
+ {
+ if( attackerInfo.attacker != attacker && !(attackerInfo.attacker in existingAttackers) )
+ attackerInfo.attacker.AddToPlayerGameStat( PGS_ASSISTS, 1 )
+ }
}
int function CheckScoreForDraw()
{
- if ( GameRules_GetTeamScore( TEAM_IMC ) > GameRules_GetTeamScore( TEAM_MILITIA ) )
+ if (GameRules_GetTeamScore(TEAM_IMC) > GameRules_GetTeamScore(TEAM_MILITIA))
return TEAM_IMC
- else if ( GameRules_GetTeamScore( TEAM_MILITIA ) > GameRules_GetTeamScore( TEAM_IMC ) )
+ else if (GameRules_GetTeamScore(TEAM_MILITIA) > GameRules_GetTeamScore(TEAM_IMC))
return TEAM_MILITIA
return TEAM_UNASSIGNED
diff --git a/Northstar.CustomServers/mod/scripts/vscripts/gamemodes/_gamemode_tdm.nut b/Northstar.CustomServers/mod/scripts/vscripts/gamemodes/_gamemode_tdm.nut index ba180790..3248d72e 100644 --- a/Northstar.CustomServers/mod/scripts/vscripts/gamemodes/_gamemode_tdm.nut +++ b/Northstar.CustomServers/mod/scripts/vscripts/gamemodes/_gamemode_tdm.nut @@ -12,6 +12,13 @@ void function GiveScoreForPlayerKill( entity victim, entity attacker, var damage {
if ( victim != attacker && victim.IsPlayer() && attacker.IsPlayer() || GetGameState() != eGameState.Playing )
AddTeamScore( attacker.GetTeam(), 1 )
+
+ var existingAttackers = []
+ foreach(DamageHistoryStruct attackerInfo in victim.e.recentDamageHistory)
+ {
+ if( attackerInfo.attacker != attacker && !(attackerInfo.attacker in existingAttackers) )
+ attackerInfo.attacker.AddToPlayerGameStat( PGS_ASSISTS, 1 )
+ }
}
void function RateSpawnpoints_Directional( int checkclass, array<entity> spawnpoints, int team, entity player )
diff --git a/Northstar.CustomServers/mod/scripts/vscripts/mp/_base_gametype_mp.gnut b/Northstar.CustomServers/mod/scripts/vscripts/mp/_base_gametype_mp.gnut index 4b2e539c..1fb90732 100644 --- a/Northstar.CustomServers/mod/scripts/vscripts/mp/_base_gametype_mp.gnut +++ b/Northstar.CustomServers/mod/scripts/vscripts/mp/_base_gametype_mp.gnut @@ -222,7 +222,6 @@ void function CodeCallback_OnPlayerRespawned( entity player ) player.SetPredictionEnabled( true ) Loadouts_TryGivePilotLoadout( player ) SetHumanRagdollImpactTable( player ) - ClearLastAttacker( player ) // so dying to anything doesn't credit the same attacker after respawning foreach ( entity weapon in player.GetMainWeapons() ) weapon.SetProScreenOwner( player ) @@ -277,9 +276,21 @@ void function PostDeathThread_MP( entity player, var damageInfo ) // based on ga player.s.inPostDeath = false }) + entity attacker = DamageInfo_GetAttacker( damageInfo ) int methodOfDeath = DamageInfo_GetDamageSourceIdentifier( damageInfo ) + var existingAttackers = [] + foreach(DamageHistoryStruct attackerInfo in player.e.recentDamageHistory) + { + if( attackerInfo.attacker != attacker && !(attackerInfo.attacker in existingAttackers) ) + { + AddPlayerScore(attackerInfo.attacker, "PilotAssist" ) + existingAttackers.append(attackerInfo.attacker) + Remote_CallFunction_NonReplay( attackerInfo.attacker, "ServerCallback_SetAssistInformation", attackerInfo.damageSourceId, attacker.GetEncodedEHandle(), player.GetEncodedEHandle(), attackerInfo.time ) + } + } + player.p.rematchOrigin = player.p.deathOrigin if ( IsValid( attacker ) && methodOfDeath == eDamageSourceId.titan_execution ) { @@ -407,14 +418,15 @@ void function RespawnAsPilot( entity player ) player.RespawnPlayer( FindSpawnPoint( player, false, ( ShouldStartSpawn( player ) || Flag( "ForceStartSpawn" ) ) && !IsFFAGame() ) ) } -void function RespawnAsTitan( entity player, bool manualPosition = false ) +void function RespawnAsTitan( entity player, bool manualPosition = false, TitanLoadoutDef ornull titanLoadoutCustom = null ) { player.Signal( "PlayerRespawnStarted" ) player.isSpawning = true entity spawnpoint = FindSpawnPoint( player, true, ( ShouldStartSpawn( player ) || Flag( "ForceStartSpawn" ) ) && !IsFFAGame() ) - TitanLoadoutDef titanLoadout = GetTitanLoadoutForPlayer( player ) + // +ratio this is awesome + TitanLoadoutDef titanLoadout = titanLoadoutCustom ? expect TitanLoadoutDef( titanLoadoutCustom ) : GetTitanLoadoutForPlayer( player ) asset model = GetPlayerSettingsAssetForClassName( titanLoadout.setFile, "bodymodel" ) Attachment warpAttach = GetAttachmentAtTimeFromModel( model, "at_hotdrop_01", "offset", spawnpoint.GetOrigin(), spawnpoint.GetAngles(), 0 ) @@ -634,4 +646,4 @@ float function GetTitanBuildTime(entity player) void function TitanPlayerHotDropsIntoLevel( entity player ) { -} +}
\ No newline at end of file diff --git a/Northstar.CustomServers/mod/scripts/vscripts/mp/_score.nut b/Northstar.CustomServers/mod/scripts/vscripts/mp/_score.nut index 002b1331..19d58a17 100644 --- a/Northstar.CustomServers/mod/scripts/vscripts/mp/_score.nut +++ b/Northstar.CustomServers/mod/scripts/vscripts/mp/_score.nut @@ -190,6 +190,17 @@ void function ScoreEvent_TitanKilled( entity victim, entity attacker, var damage AddPlayerScore( attacker, "TitanKillTitan", victim.GetTitanSoul().GetOwner() ) else AddPlayerScore( attacker, "KillTitan", victim.GetTitanSoul().GetOwner() ) + + var existingAttackers = [] + foreach(DamageHistoryStruct attackerInfo in victim.e.recentDamageHistory) + { + if( attackerInfo.attacker != attacker && !(attackerInfo.attacker in existingAttackers) ) + { + AddPlayerScore(attackerInfo.attacker, "TitanAssist" ) + existingAttackers.append(attackerInfo.attacker) + Remote_CallFunction_NonReplay( attackerInfo.attacker, "ServerCallback_SetAssistInformation", attackerInfo.damageSourceId, attacker.GetEncodedEHandle(), victim.GetEncodedEHandle(), attackerInfo.time ) + } + } } void function ScoreEvent_NPCKilled( entity victim, entity attacker, var damageInfo ) |