aboutsummaryrefslogtreecommitdiff
path: root/Northstar.CustomServers/mod/scripts
diff options
context:
space:
mode:
authorBobTheBob <32057864+BobTheBob9@users.noreply.github.com>2021-12-14 02:20:10 +0000
committerBobTheBob <32057864+BobTheBob9@users.noreply.github.com>2021-12-14 02:20:10 +0000
commit1b6e5af70bf442c684b891003e516329b190c130 (patch)
treeb8df2155f13ac612bfa45bfadf783b3789f117cb /Northstar.CustomServers/mod/scripts
parent4eaace462efe15328fcc171f2c7f85ff29a9e821 (diff)
downloadNorthstarMods-1b6e5af70bf442c684b891003e516329b190c130.tar.gz
NorthstarMods-1b6e5af70bf442c684b891003e516329b190c130.zip
various fixes
Diffstat (limited to 'Northstar.CustomServers/mod/scripts')
-rw-r--r--Northstar.CustomServers/mod/scripts/vscripts/_xp.gnut27
-rw-r--r--Northstar.CustomServers/mod/scripts/vscripts/mp/_changemap.nut32
-rw-r--r--Northstar.CustomServers/mod/scripts/vscripts/mp/_playlist.gnut3
-rw-r--r--Northstar.CustomServers/mod/scripts/vscripts/mp/_score.nut2
-rw-r--r--Northstar.CustomServers/mod/scripts/vscripts/weapon_xp.gnut2
5 files changed, 48 insertions, 18 deletions
diff --git a/Northstar.CustomServers/mod/scripts/vscripts/_xp.gnut b/Northstar.CustomServers/mod/scripts/vscripts/_xp.gnut
index 150de8bbe..0be171d12 100644
--- a/Northstar.CustomServers/mod/scripts/vscripts/_xp.gnut
+++ b/Northstar.CustomServers/mod/scripts/vscripts/_xp.gnut
@@ -31,23 +31,20 @@ 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
// most score events don't have this, so we'll set this to the xp value of other categories later if needed
int xpValue = ScoreEvent_GetXPValue( event )
-
- entity activeWeapon = player.GetActiveWeapon()
int weaponXp = ScoreEvent_GetXPValueWeapon( event )
- if ( weaponXp != 0 && ShouldTrackXPForWeapon( activeWeapon.GetWeaponClassName() ) )
- {
- AddWeaponXP( player, ScoreEvent_GetXPValueWeapon( event ) )
- if ( xpValue < weaponXp )
- xpValue = weaponXp
- }
-
int titanXp = ScoreEvent_GetXPValueTitan( event )
- if ( titanXp != 0 && player.IsTitan() )
- {
- AddTitanXP( player, ScoreEvent_GetXPValueTitan( event ) )
- if ( xpValue < titanXp )
- xpValue = titanXp
- }
+
+ if ( xpValue < weaponXp )
+ xpValue = weaponXp
+ else if ( xpValue < titanXp )
+ xpValue = titanXp
+
+ if ( ShouldTrackXPForWeapon( player.GetActiveWeapon().GetWeaponClassName() ) )
+ AddWeaponXP( player, xpValue )
+
+ // if we specifically gain titan xp, then give titan xp no matter what, otherwise only give it when we're in a titan
+ if ( titanXp != 0 || player.IsTitan() )
+ AddTitanXP( player, xpValue )
// most events don't have faction xp but almost everything should give it
int factionXp = ScoreEvent_GetXPValueFaction( event )
diff --git a/Northstar.CustomServers/mod/scripts/vscripts/mp/_changemap.nut b/Northstar.CustomServers/mod/scripts/vscripts/mp/_changemap.nut
index a2e95e082..470fa6a41 100644
--- a/Northstar.CustomServers/mod/scripts/vscripts/mp/_changemap.nut
+++ b/Northstar.CustomServers/mod/scripts/vscripts/mp/_changemap.nut
@@ -6,9 +6,11 @@ void function CodeCallback_MatchIsOver()
SetUIVar( level, "putPlayerInMatchmakingAfterDelay", true )
else
SetUIVar( level, "putPlayerInMatchmakingAfterDelay", false )
-
+
+ #if MP
AddCreditsForXPGained()
PopulatePostgameData()
+ #endif
if ( ShouldReturnToLobby() )
{
@@ -19,6 +21,30 @@ void function CodeCallback_MatchIsOver()
else
GameRules_ChangeMap( "mp_lobby", GAMETYPE )
}
+ else
+ {
+ // iterate over all gamemodes/maps in current playlist, choose map/mode combination that's directly after our current one
+ // if we reach the end, go back to the first map/mode
+ bool changeOnNextIteration = false
+
+ for ( int i = 0; i < GetCurrentPlaylistGamemodesCount(); i++ )
+ {
+ if ( GetCurrentPlaylistGamemodeByIndex( i ) == GAMETYPE )
+ {
+ for ( int j = 0; j < GetCurrentPlaylistGamemodeByIndexMapsCount( i ); j++ )
+ {
+ if ( changeOnNextIteration )
+ GameRules_ChangeMap( GetCurrentPlaylistGamemodeByIndexMapByIndex( i, j ), GetCurrentPlaylistGamemodeByIndex( i ) )
+
+ if ( GetCurrentPlaylistGamemodeByIndexMapByIndex( i, j ) == GetMapName() )
+ changeOnNextIteration = true // change to next map/mode we iterate over
+ }
+ }
+ }
+
+ // go back to first map/mode
+ GameRules_ChangeMap( GetCurrentPlaylistGamemodeByIndexMapByIndex( 0, 0 ), GetCurrentPlaylistGamemodeByIndex( 0 ) )
+ }
#if DEV
if ( !IsMatchmakingServer() )
@@ -26,6 +52,7 @@ void function CodeCallback_MatchIsOver()
#endif // #if DEV
}
+#if MP
void function PopulatePostgameData()
{
// something's busted here because this isn't showing automatically on match end, ag
@@ -94,4 +121,5 @@ void function PopulatePostgameData()
player.SetPersistentVar( "isPostGameScoreboardValid", true )
}
-} \ No newline at end of file
+}
+#endif \ No newline at end of file
diff --git a/Northstar.CustomServers/mod/scripts/vscripts/mp/_playlist.gnut b/Northstar.CustomServers/mod/scripts/vscripts/mp/_playlist.gnut
index 0d610e37b..8db52b118 100644
--- a/Northstar.CustomServers/mod/scripts/vscripts/mp/_playlist.gnut
+++ b/Northstar.CustomServers/mod/scripts/vscripts/mp/_playlist.gnut
@@ -61,8 +61,10 @@ void function FeaturedModeSettingsSetupPilotLoadouts( entity player )
shouldChangeLoadout = true
+ // have to set attachments too, otherwise we could give invalid mods for this weapon
modifiedLoadout.primary = "mp_weapon_epg"
modifiedLoadout.primaryMods = [ "rocket_arena" ]
+ modifiedLoadout.primaryAttachments = [ "" ]
// set secondary to whatever one is pistol
if ( GetWeaponInfoFileKeyField_Global( player.GetMainWeapons()[ 1 ].GetWeaponClassName(), "menu_category" ) == "at" )
@@ -87,6 +89,7 @@ void function FeaturedModeSettingsSetupPilotLoadouts( entity player )
// this one was never released, assuming it just gives you a mastiff and a kraber with quick swap
modifiedLoadout.primary = "mp_weapon_sniper"
modifiedLoadout.primaryMods = [ "pas_fast_swap", "pas_fast_ads" ]
+ modifiedLoadout.primaryAttachments = [ "" ]
// set secondary to whatever one is pistol
if ( GetWeaponInfoFileKeyField_Global( player.GetMainWeapons()[ 1 ].GetWeaponClassName(), "menu_category" ) == "at" )
diff --git a/Northstar.CustomServers/mod/scripts/vscripts/mp/_score.nut b/Northstar.CustomServers/mod/scripts/vscripts/mp/_score.nut
index 399407694..ac64af37c 100644
--- a/Northstar.CustomServers/mod/scripts/vscripts/mp/_score.nut
+++ b/Northstar.CustomServers/mod/scripts/vscripts/mp/_score.nut
@@ -79,6 +79,8 @@ void function AddPlayerScore( entity targetPlayer, string scoreEventName, entity
if ( ScoreEvent_HasConversation( event ) )
PlayFactionDialogueToPlayer( event.conversation, targetPlayer )
+
+ HandleXPGainForScoreEvent( targetPlayer, event )
}
void function ScoreEvent_PlayerKilled( entity victim, entity attacker, var damageInfo )
diff --git a/Northstar.CustomServers/mod/scripts/vscripts/weapon_xp.gnut b/Northstar.CustomServers/mod/scripts/vscripts/weapon_xp.gnut
index f495e5879..8e1002576 100644
--- a/Northstar.CustomServers/mod/scripts/vscripts/weapon_xp.gnut
+++ b/Northstar.CustomServers/mod/scripts/vscripts/weapon_xp.gnut
@@ -20,7 +20,7 @@ void function AddWeaponXP( entity player, int amount )
player.SetPersistentVar( GetItemPersistenceStruct( weaponClassname ) + ".proScreenKills", WeaponGetProScreenKills( player, weaponClassname ) + amount )
// not currently used rn, but adding a script var so scripts can handle proscreen values manually if wanted
- if ( "manualProscreenControl" in activeWeapon.s && activeWeapon.s.manualProscreenControl )
+ if ( !( "manualProscreenControl" in activeWeapon.s && activeWeapon.s.manualProscreenControl ) )
activeWeapon.SetProScreenIntValForIndex( 0, WeaponGetProScreenKills( player, weaponClassname ) )
}
} \ No newline at end of file