From 4c5244971a92eb5ef74fb489bc0e6a15a09ec442 Mon Sep 17 00:00:00 2001 From: Zanieon Date: Sun, 5 Nov 2023 17:23:39 -0300 Subject: [PATCH] Sanity checks, minor fixes --- Northstar.CustomServers/mod/scripts/vscripts/_xp.gnut | 5 +++-- .../mod/scripts/vscripts/faction_xp.gnut | 3 ++- .../mod/scripts/vscripts/gamemodes/_gamemode_cp.nut | 7 ++++++- .../mod/scripts/vscripts/gamemodes/_gamemode_fra.nut | 1 + .../mod/scripts/vscripts/mp/_gamestate_mp.nut | 2 -- Northstar.CustomServers/mod/scripts/vscripts/titan_xp.gnut | 6 ++++-- .../mod/scripts/vscripts/weapon_xp.gnut | 3 ++- 7 files changed, 18 insertions(+), 9 deletions(-) diff --git a/Northstar.CustomServers/mod/scripts/vscripts/_xp.gnut b/Northstar.CustomServers/mod/scripts/vscripts/_xp.gnut index 50794cbeb..cbe9f7cbb 100644 --- a/Northstar.CustomServers/mod/scripts/vscripts/_xp.gnut +++ b/Northstar.CustomServers/mod/scripts/vscripts/_xp.gnut @@ -33,7 +33,7 @@ bool function PlayerProgressionAllowed( entity player ) void function HandleXPGainForScoreEvent( entity player, ScoreEvent event ) { // note: obviously all xp stuff can be cheated in if people want to on customs, this is mainly just here for fun for those who want it and feature completeness - + int xpValue = ScoreEvent_GetXPValue( event ) int weaponXp = ScoreEvent_GetXPValueWeapon( event ) int titanXp = ScoreEvent_GetXPValueTitan( event ) @@ -76,6 +76,7 @@ void function AddXP( entity player, int amount ) if ( newLevel != oldLevel ) { Remote_CallFunction_NonReplay( player, "ServerCallback_PlayerLeveledUp", player.GetPersistentVarAsInt( "gen" ), newLevel ) - AwardRandomItemsForPlayerLevels( player, player.GetPersistentVarAsInt( "gen" ), newLevel ) + if( PlayerLevelHasRandomUnlock( PlayerGetRawLevel( player ) ) ) + AwardRandomItemsForPlayerLevels( player, player.GetPersistentVarAsInt( "gen" ), newLevel ) } } diff --git a/Northstar.CustomServers/mod/scripts/vscripts/faction_xp.gnut b/Northstar.CustomServers/mod/scripts/vscripts/faction_xp.gnut index 9ea51448e..3480d6057 100644 --- a/Northstar.CustomServers/mod/scripts/vscripts/faction_xp.gnut +++ b/Northstar.CustomServers/mod/scripts/vscripts/faction_xp.gnut @@ -13,8 +13,9 @@ void function AddFactionXP( entity player, int amount ) if ( FactionGetLevel( player, faction ) != oldLevel ) { AddPlayerScore( player, "FactionLevelUp" ) - AwardRandomItemsForFactionLevels( player, faction, oldLevel, FactionGetLevel( player, faction ) ) IncrementPlayerChallengeFactionLeveledUp( player ) player.SetPersistentVar( "xp_match[" + XP_TYPE.FACTION_LEVELED + "]", FactionXPMatch + 1 ) + if( FactionLevelHasRandomUnlock( FactionGetRawLevel( player, faction ) ) ) + AwardRandomItemsForFactionLevels( player, faction, oldLevel, FactionGetLevel( player, faction ) ) } } \ No newline at end of file diff --git a/Northstar.CustomServers/mod/scripts/vscripts/gamemodes/_gamemode_cp.nut b/Northstar.CustomServers/mod/scripts/vscripts/gamemodes/_gamemode_cp.nut index d25804d2c..d8b0c9bdd 100644 --- a/Northstar.CustomServers/mod/scripts/vscripts/gamemodes/_gamemode_cp.nut +++ b/Northstar.CustomServers/mod/scripts/vscripts/gamemodes/_gamemode_cp.nut @@ -327,12 +327,17 @@ void function GamemodeCP_InitPlayer(entity player) playerStruct.timeOnPoints = [0.0,0.0,0.0] playerStruct.isOnHardpoint = false file.players.append(playerStruct) + file.playerAssaultPoints[player] <- 0 + file.playerDefensePoints[player] <- 0 thread PlayerThink(playerStruct) } void function GamemodeCP_RemovePlayer(entity player) { - + if(player in file.playerAssaultPoints) + delete file.playerAssaultPoints[player] + if(player in file.playerDefensePoints) + delete file.playerDefensePoints[player] foreach(index,CP_PlayerStruct playerStruct in file.players) { if(playerStruct.player==player) diff --git a/Northstar.CustomServers/mod/scripts/vscripts/gamemodes/_gamemode_fra.nut b/Northstar.CustomServers/mod/scripts/vscripts/gamemodes/_gamemode_fra.nut index 9d8f84b5c..6d0fd3c7b 100644 --- a/Northstar.CustomServers/mod/scripts/vscripts/gamemodes/_gamemode_fra.nut +++ b/Northstar.CustomServers/mod/scripts/vscripts/gamemodes/_gamemode_fra.nut @@ -17,6 +17,7 @@ void function GamemodeFRA_Init() ScoreEvent_SetEarnMeterValues( "PilotBatteryPickup", 0.0, 0.34 ) EarnMeterMP_SetPassiveMeterGainEnabled( false ) PilotBattery_SetMaxCount( 3 ) + SetupGenericFFAChallenge() AddCallback_OnPlayerKilled( FRARemoveEarnMeter ) } diff --git a/Northstar.CustomServers/mod/scripts/vscripts/mp/_gamestate_mp.nut b/Northstar.CustomServers/mod/scripts/vscripts/mp/_gamestate_mp.nut index c44d7dc60..a11994860 100644 --- a/Northstar.CustomServers/mod/scripts/vscripts/mp/_gamestate_mp.nut +++ b/Northstar.CustomServers/mod/scripts/vscripts/mp/_gamestate_mp.nut @@ -597,8 +597,6 @@ void function OnPlayerKilled( entity victim, entity attacker, var damageInfo ) else return } - - ShowDeathHint( victim, damageInfo ) entity inflictor = DamageInfo_GetInflictor( damageInfo ) bool shouldUseInflictor = IsValid( inflictor ) && ShouldTryUseProjectileReplay( victim, attacker, damageInfo, true ) diff --git a/Northstar.CustomServers/mod/scripts/vscripts/titan_xp.gnut b/Northstar.CustomServers/mod/scripts/vscripts/titan_xp.gnut index 40daf5998..5e5688672 100644 --- a/Northstar.CustomServers/mod/scripts/vscripts/titan_xp.gnut +++ b/Northstar.CustomServers/mod/scripts/vscripts/titan_xp.gnut @@ -17,8 +17,9 @@ void function AddTitanXP( entity player, int amount ) Remote_CallFunction_NonReplay( player, "ServerCallback_TitanLeveledUp", shTitanXP.titanClasses.find( titan ), TitanGetGen( player, titan ), TitanGetLevel( player, titan ) ) AddPlayerScore( player, "TitanLevelUp" ) IncrementPlayerChallengeTitanLeveledUp( player ) - AwardRandomItemsForTitanLevels( player, titan, oldLevel, TitanGetLevel( player, titan ) ) player.SetPersistentVar( "xp_match[" + XP_TYPE.TITAN_LEVELED + "]", TitanXPMatch + 1 ) + if( TitanLevelHasRandomUnlock( TitanGetRawLevel( player, titan ) ) ) + AwardRandomItemsForTitanLevels( player, titan, oldLevel, TitanGetLevel( player, titan ) ) } } @@ -31,5 +32,6 @@ void function AddFDTitanXP( entity player, int fdXPamount ) int endingLevel = FD_TitanGetLevelForXP( titanRef, FD_TitanGetXP( player, titanRef ) ) Player_GiveFDUnlockPoints( player, endingLevel - startingLevel ) - AwardRandomItemsForFDTitanLevels( player, titanRef, startingLevel, endingLevel ) + if( FDTitanLevelHasRandomUnlock( FD_TitanGetRawLevel( player, titan ) ) ) + AwardRandomItemsForFDTitanLevels( player, titanRef, startingLevel, endingLevel ) } \ No newline at end of file diff --git a/Northstar.CustomServers/mod/scripts/vscripts/weapon_xp.gnut b/Northstar.CustomServers/mod/scripts/vscripts/weapon_xp.gnut index 8e2338e6c..4fb1fd19e 100644 --- a/Northstar.CustomServers/mod/scripts/vscripts/weapon_xp.gnut +++ b/Northstar.CustomServers/mod/scripts/vscripts/weapon_xp.gnut @@ -18,8 +18,9 @@ void function AddWeaponXP( entity player, int amount ) Remote_CallFunction_NonReplay( player, "ServerCallback_WeaponLeveledUp", shWeaponXP.weaponClassNames.find( weaponClassname ), WeaponGetGen( player, weaponClassname ), WeaponGetLevel( player, weaponClassname ) ) AddPlayerScore( player, "WeaponLevelUp" ) IncrementPlayerChallengeWeaponLeveledUp( player ) - AwardRandomItemsForWeaponLevels( player, weaponClassname, oldLevel, WeaponGetLevel( player, weaponClassname ) ) player.SetPersistentVar( "xp_match[" + XP_TYPE.WEAPON_LEVELED + "]", WeaponXPMatch + 1 ) + if( WeaponLevelHasRandomUnlock( WeaponGetRawLevel( player, weaponClassname ) ) ) + AwardRandomItemsForWeaponLevels( player, weaponClassname, oldLevel, WeaponGetLevel( player, weaponClassname ) ) } // proscreen