aboutsummaryrefslogtreecommitdiff
path: root/Northstar.Custom/mod/scripts/vscripts/gamemodes
diff options
context:
space:
mode:
Diffstat (limited to 'Northstar.Custom/mod/scripts/vscripts/gamemodes')
-rw-r--r--Northstar.Custom/mod/scripts/vscripts/gamemodes/_gamemode_chamber.nut19
-rw-r--r--Northstar.Custom/mod/scripts/vscripts/gamemodes/_gamemode_fastball.gnut71
-rw-r--r--Northstar.Custom/mod/scripts/vscripts/gamemodes/_gamemode_gg.gnut127
-rw-r--r--Northstar.Custom/mod/scripts/vscripts/gamemodes/_gamemode_sns.gnut144
-rw-r--r--Northstar.Custom/mod/scripts/vscripts/gamemodes/cl_gamemode_gg.gnut2
-rw-r--r--Northstar.Custom/mod/scripts/vscripts/gamemodes/cl_gamemode_sns.gnut55
-rw-r--r--Northstar.Custom/mod/scripts/vscripts/gamemodes/gg_earn_meter/_gg_earn_meter.gnut56
-rw-r--r--Northstar.Custom/mod/scripts/vscripts/gamemodes/gg_earn_meter/cl_gg_earn_meter.gnut82
-rw-r--r--Northstar.Custom/mod/scripts/vscripts/gamemodes/gg_earn_meter/sh_gg_earn_meter.gnut16
-rw-r--r--Northstar.Custom/mod/scripts/vscripts/gamemodes/sh_gamemode_gg.gnut78
-rw-r--r--Northstar.Custom/mod/scripts/vscripts/gamemodes/sh_gamemode_sns.gnut51
11 files changed, 623 insertions, 78 deletions
diff --git a/Northstar.Custom/mod/scripts/vscripts/gamemodes/_gamemode_chamber.nut b/Northstar.Custom/mod/scripts/vscripts/gamemodes/_gamemode_chamber.nut
index bbd669cd0..5768dcfaf 100644
--- a/Northstar.Custom/mod/scripts/vscripts/gamemodes/_gamemode_chamber.nut
+++ b/Northstar.Custom/mod/scripts/vscripts/gamemodes/_gamemode_chamber.nut
@@ -22,6 +22,10 @@ void function ChamberInitPlayer( entity player )
UpdateLoadout( player )
}
+int function GetChamberWingmanN(){
+ return GetCurrentPlaylistVarInt( "chamber_wingman_n", 0 )
+}
+
void function ChamberOnPlayerKilled( entity victim, entity attacker, var damageInfo )
{
if ( !victim.IsPlayer() || GetGameState() != eGameState.Playing || attacker == victim)
@@ -29,10 +33,17 @@ void function ChamberOnPlayerKilled( entity victim, entity attacker, var damageI
if ( attacker.IsPlayer() )
{
- attacker.SetPlayerGameStat( PGS_ASSAULT_SCORE, attacker.GetPlayerGameStat( PGS_ASSAULT_SCORE ) + 1 )
- AddTeamScore( attacker.GetTeam(), 1 )
+ if ( (DamageInfo_GetDamageSourceIdentifier( damageInfo ) == eDamageSourceId.mp_weapon_wingman_n) || (DamageInfo_GetDamageSourceIdentifier( damageInfo ) == eDamageSourceId.mp_weapon_wingman) )
+ {
+ attacker.SetPlayerGameStat( PGS_ASSAULT_SCORE, attacker.GetPlayerGameStat( PGS_ASSAULT_SCORE ) + 1 )
+ AddTeamScore( attacker.GetTeam(), 1 )
+ }
+
if ( DamageInfo_GetDamageSourceIdentifier( damageInfo ) == eDamageSourceId.human_execution )
{
+ attacker.SetPlayerGameStat( PGS_ASSAULT_SCORE, attacker.GetPlayerGameStat( PGS_ASSAULT_SCORE ) + 1 )
+ AddTeamScore( attacker.GetTeam(), 1 )
+
string message = victim.GetPlayerName() + " got executed."
foreach ( entity player in GetPlayerArray() )
SendHudMessage( player, message, -1, 0.4, 255, 0, 0, 0, 0, 3, 0.15 )
@@ -75,8 +86,8 @@ void function UpdateLoadout( entity player )
player.TakeWeaponNow( weapon.GetWeaponClassName() )
array<string> mods = ["one_in_the_chamber"]
- player.GiveWeapon( "mp_weapon_wingman", mods)
- player.GiveOffhandWeapon( "melee_pilot_emptyhanded", OFFHAND_MELEE )
+ player.GiveWeapon( (GetChamberWingmanN() ? "mp_weapon_wingman_n" : "mp_weapon_wingman"), mods)
+ player.GiveOffhandWeapon( "melee_pilot_kunai", OFFHAND_MELEE )
thread SetAmmo( player )
}
diff --git a/Northstar.Custom/mod/scripts/vscripts/gamemodes/_gamemode_fastball.gnut b/Northstar.Custom/mod/scripts/vscripts/gamemodes/_gamemode_fastball.gnut
index 405ef16ea..f6c0968cf 100644
--- a/Northstar.Custom/mod/scripts/vscripts/gamemodes/_gamemode_fastball.gnut
+++ b/Northstar.Custom/mod/scripts/vscripts/gamemodes/_gamemode_fastball.gnut
@@ -120,6 +120,56 @@ void function GamemodeFastball_Init()
< -87, 1630, 22 >, < 0, 90.00, 0 >,
< -2167 , 448, 54 >, <0 , 90, 0 >
])
+
+ FastballAddBuddySpawnForLevel( "mp_glitch", TEAM_MILITIA, < -4450, -629, 320 >, < 0, 0, 0 > )
+ FastballAddBuddySpawnForLevel( "mp_glitch", TEAM_IMC, < 4100, 890, 320>, < 0, 180, 0 > )
+ FastballAddPanelSpawnsForLevel( "mp_glitch", [
+ < 2703, 2170, 25 >, < 0, 0.00, 0 >,
+ < -192, 129, -250 >, < 0, 90.00, 0 >,
+ < -3088, -1905, 25 >, < 0, -180.00, 0 >
+ ])
+
+ FastballAddPropForLevel("mp_glitch", $"models/containers/plastic_pallet_01.mdl", [
+ < -190, 0, -250 >, < 0, 90.00, 0 >,
+ < -190, 65, -250 >, < 0, 90.00, 0 >,
+ < -190, 130, -250 >, < 0, 90.00, 0 >,
+ < -190, 195, -250 >, < 0, 90.00, 0 >,
+ < -190, 250, -250 >, < 0, 90.00, 0 >,
+ < -125, 0, -250 >, < 0, 90.00, 0 >,
+ < -125, 65, -250 >, < 0, 90.00, 0 >,
+ < -125, 130, -250 >, < 0, 90.00, 0 >,
+ < -125, 195, -250 >, < 0, 90.00, 0 >,
+ < -125, 250, -250 >, < 0, 90.00, 0 >,
+ < -255, 0, -250 >, < 0, 90.00, 0 >,
+ < -255, 65, -250 >, < 0, 90.00, 0 >,
+ < -255, 130, -250 >, < 0, 90.00, 0 >,
+ < -255, 195, -250 >, < 0, 90.00, 0 >,
+ < -255, 250, -250 >, < 0, 90.00, 0 >
+ ] )
+
+ FastballAddBuddySpawnForLevel( "mp_relic02", TEAM_MILITIA, < 4504, -3500, 150 >, < 0, -170, 0 > )
+ FastballAddBuddySpawnForLevel( "mp_relic02", TEAM_IMC, < -4505, -3750, 367>, < 0, 10, 0 > )
+ FastballAddPanelSpawnsForLevel( "mp_relic02", [
+ < -2258, -5286, 356 >, < 0, 0.00, 0 >,
+ < -32, -2600, -75 >, < 0, 90.00, 0 >,
+ < 2028, -5332, 128 >, < 0, 90.00, 0 >
+ ])
+
+ FastballAddBuddySpawnForLevel( "mp_homestead", TEAM_MILITIA, < -3848.19.00, -2521, -25>, < 0, 0, 0 > )
+ FastballAddBuddySpawnForLevel( "mp_homestead", TEAM_IMC, < 6000, 1560, -137 >, < 0, -150, 0 > )
+ FastballAddPanelSpawnsForLevel( "mp_homestead", [
+ < 3672, -696, -10 >, < 0, 100.00, 0 > ,
+ < 1101, -911, 145 >, < -8, 40.00, 0 >,
+ < -1585 , -953, -79 >, <0, 135.00, 0 >
+ ])
+
+ FastballAddBuddySpawnForLevel( "mp_drydock", TEAM_MILITIA, < -4, -4350, 144 >, < 0, 80, 0 > )
+ FastballAddBuddySpawnForLevel( "mp_drydock", TEAM_IMC, < 679, 4674, 200>, < 0, -90, 0 > )
+ FastballAddPanelSpawnsForLevel( "mp_drydock", [
+ < 1726, 2290, 256 >, < 0, 0.00, 0 >,
+ < 100, 63, 265 >, < 0, 180.00, 0 >,
+ < -752, -863, 408>, <0, 180.00, 0 >
+ ])
}
void function SpawnPanelsForLevel()
@@ -159,6 +209,25 @@ void function FastballAddPanelSpawnsForLevel( string level, array<vector> positi
}
}
+void function FastballAddPropForLevel( string level, asset model, array<vector> positionsAndOrigins)
+{
+ if ( GetMapName() != level )
+ return
+
+ for ( int i = 0; i < positionsAndOrigins.len(); i += 2 )
+ {
+ entity prop = CreateEntity( "prop_control_panel" )
+ prop.SetValueForModelKey( model )
+ prop.SetOrigin( positionsAndOrigins[ i ] )
+ prop.SetAngles( positionsAndOrigins[ i + 1 ] )
+ prop.kv.solid = SOLID_VPHYSICS
+ DispatchSpawn( prop )
+
+ prop.SetModel( model )
+ }
+
+}
+
entity function CreatePanel( vector origin, vector angles )
{
entity panel = CreateEntity( "prop_control_panel" )
@@ -224,4 +293,4 @@ int function FastballDecideWinner()
return TEAM_IMC
return TEAM_UNASSIGNED
-}
+} \ No newline at end of file
diff --git a/Northstar.Custom/mod/scripts/vscripts/gamemodes/_gamemode_gg.gnut b/Northstar.Custom/mod/scripts/vscripts/gamemodes/_gamemode_gg.gnut
index 608fd869e..5943b8048 100644
--- a/Northstar.Custom/mod/scripts/vscripts/gamemodes/_gamemode_gg.gnut
+++ b/Northstar.Custom/mod/scripts/vscripts/gamemodes/_gamemode_gg.gnut
@@ -10,12 +10,14 @@ void function GamemodeGG_Init()
SetWeaponDropsEnabled( false )
Riff_ForceTitanAvailability( eTitanAvailability.Never )
Riff_ForceBoostAvailability( eBoostAvailability.Disabled )
-
+
AddCallback_OnPlayerRespawned( OnPlayerRespawned )
AddCallback_OnPlayerKilled( OnPlayerKilled )
-
+
AddCallback_GameStateEnter( eGameState.WinnerDetermined, OnWinnerDetermined )
-
+
+ AddCallback_GGEarnMeterFull( OnGGEarnMeterFilled )
+
// set scorelimit if it's wrong, sort of a jank way to do it but best i've got rn
try
{
@@ -44,76 +46,127 @@ void function OnPlayerKilled( entity victim, entity attacker, var damageInfo )
{
if ( !victim.IsPlayer() || !attacker.IsPlayer() || GetGameState() != eGameState.Playing )
return
-
+
if ( attacker == victim ) // suicide
{
string message = victim.GetPlayerName() + " committed suicide."
foreach ( entity player in GetPlayerArray() )
SendHudMessage( player, message, -1, 0.4, 255, 0, 0, 0, 0, 3, 0.15 )
-
- if ( GameRules_GetTeamScore( victim.GetTeam() ) != 0 )
- {
- AddTeamScore( victim.GetTeam(), -1 ) // get absolutely fucking destroyed lol
- victim.AddToPlayerGameStat( PGS_ASSAULT_SCORE, -1 )
- }
+
+ DeRank( victim )
}
- else
+ else
{
if ( DamageInfo_GetDamageSourceIdentifier( damageInfo ) != eDamageSourceId.melee_pilot_emptyhanded )
{
- AddTeamScore( attacker.GetTeam(), 1 )
- attacker.AddToPlayerGameStat( PGS_ASSAULT_SCORE, 1 )
- UpdateLoadout( attacker )
+ float percentageReward = GetCurrentPlaylistVarFloat( "gg_kill_reward", 1.0 )
+ string scoreEvent = "KillPilot"
+
+ if ( DamageInfo_GetDamageSourceIdentifier( damageInfo ) == eDamageSourceId.human_execution )
+ {
+ string message = victim.GetPlayerName() + " got executed."
+ foreach ( entity player in GetPlayerArray() )
+ SendHudMessage( player, message, -1, 0.4, 255, 0, 0, 0, 0, 3, 0.15 )
+
+ DeRank( victim )
+
+ percentageReward = GetCurrentPlaylistVarFloat( "gg_execution_reward", 1.0 )
+ scoreEvent = "Execution"
+ }
+
+ Reward( attacker, victim, scoreEvent, percentageReward )
}
-
- if ( DamageInfo_GetDamageSourceIdentifier( damageInfo ) == eDamageSourceId.human_execution )
+ }
+
+ table<int, bool> alreadyAssisted
+ foreach( DamageHistoryStruct attackerInfo in victim.e.recentDamageHistory )
+ {
+ if( attackerInfo.attacker != attacker && !alreadyAssisted[attackerInfo.attacker.GetEncodedEHandle()] )
{
- string message = victim.GetPlayerName() + " got executed."
- foreach ( entity player in GetPlayerArray() )
- SendHudMessage( player, message, -1, 0.4, 255, 0, 0, 0, 0, 3, 0.15 )
-
- if ( GameRules_GetTeamScore( victim.GetTeam() ) != 0 )
- {
- AddTeamScore( victim.GetTeam(), -1 ) // get absolutely fucking destroyed lol
- victim.AddToPlayerGameStat( PGS_ASSAULT_SCORE, -1 )
+ if ( attackerInfo.damageSourceId != eDamageSourceId.melee_pilot_emptyhanded ) {
+ alreadyAssisted[attackerInfo.attacker.GetEncodedEHandle()] <- true
+
+ Reward( attackerInfo.attacker, victim, "PilotAssist", GetCurrentPlaylistVarFloat( "gg_assist_reward", 0.0 ) )
}
}
}
}
+void function Reward( entity player, entity victim, string scoreEvent, float percentageReward )
+{
+ percentageReward = clamp(percentageReward, 0.0, 1.0)
+ Sv_GGEarnMeter_AddPercentage( player, percentageReward )
+ Remote_CallFunction_NonReplay( player, "ServerCallback_ScoreEvent", GetScoreEvent(scoreEvent).eventId, 0, eEventDisplayType.MEDAL, victim.GetEncodedEHandle(), 0.0, percentageReward)
+}
+
+void function DeRank( entity player )
+{
+ Sv_GGEarnMeter_SetPercentage( player, 0.0 )
+
+ if ( GameRules_GetTeamScore( player.GetTeam() ) != 0 )
+ {
+ AddTeamScore( player.GetTeam(), -1 ) // get absolutely fucking destroyed lol
+ player.AddToPlayerGameStat( PGS_ASSAULT_SCORE, -1 )
+ UpdateLoadout( player )
+ }
+}
+
+bool function OnGGEarnMeterFilled( entity player )
+{
+ AddTeamScore( player.GetTeam(), 1 )
+ player.AddToPlayerGameStat( PGS_ASSAULT_SCORE, 1 )
+ UpdateLoadout( player )
+
+ int currentScore = GameRules_GetTeamScore( player.GetTeam() )
+ int maxScore = GetGunGameWeapons().len()
+
+ return currentScore >= maxScore
+}
+
void function UpdateLoadout( entity player )
{
// todo: honestly, this should be reworked to use PilotLoadoutDefs instead of directly modifying weapons and shit
-
+
int currentWeaponIndex = GameRules_GetTeamScore( player.GetTeam() )
array<GunGameWeapon> weapons = GetGunGameWeapons()
-
+
if ( currentWeaponIndex >= weapons.len() )
currentWeaponIndex = weapons.len() - 1
-
+
if ( currentWeaponIndex > 18 ) // play end of game music for special weapons
PlayMusicToAll( eMusicPieceID.LEVEL_LAST_MINUTE ) // this *shouldn't* overlap if done multiple times
-
+
GunGameWeapon weapon = weapons[ currentWeaponIndex ]
-
+
foreach ( entity weapon in player.GetMainWeapons() )
player.TakeWeaponNow( weapon.GetWeaponClassName() )
-
+
foreach ( entity weapon in player.GetOffhandWeapons() )
player.TakeWeaponNow( weapon.GetWeaponClassName() )
-
+
if ( weapon.offhandSlot != -1 )
{
- // TEMP: give archer so player so player has a weapon which lets them use offhands
- // need to replace this with a custom empty weapon at some point
- player.GiveWeapon( "mp_weapon_rocket_launcher" )
-
player.GiveOffhandWeapon( weapon.weapon, weapon.offhandSlot, weapon.mods )
+
+ player.GiveOffhandWeapon( "melee_pilot_emptyhanded", OFFHAND_MELEE, [ "allow_as_primary" ] )
+ player.SetActiveWeaponByName( "melee_pilot_emptyhanded" ) // Let the player use the melee in the primary slot, and then force equip it. Effectively gives them an empty hand.
}
else
+ {
player.GiveWeapon( weapon.weapon, weapon.mods )
-
- player.GiveOffhandWeapon( "melee_pilot_emptyhanded", OFFHAND_MELEE )
+
+ player.GiveOffhandWeapon( "melee_pilot_emptyhanded", OFFHAND_MELEE )
+ }
+
+ if ( currentWeaponIndex == weapons.len() - 1 )
+ {
+ Sv_GGEarnMeter_SetFinalIcon( player )
+
+ return
+ }
+
+ GunGameWeapon nextWeapon = weapons[ currentWeaponIndex + 1 ]
+ Sv_GGEarnMeter_SetWeaponIcon( player, nextWeapon.weapon )
}
void function OnWinnerDetermined()
diff --git a/Northstar.Custom/mod/scripts/vscripts/gamemodes/_gamemode_sns.gnut b/Northstar.Custom/mod/scripts/vscripts/gamemodes/_gamemode_sns.gnut
new file mode 100644
index 000000000..f3b7d2eee
--- /dev/null
+++ b/Northstar.Custom/mod/scripts/vscripts/gamemodes/_gamemode_sns.gnut
@@ -0,0 +1,144 @@
+global function SNS_Init
+
+struct {
+ string score_leader_highlight = "enemy_boss_bounty" // highlight effect applied to person in 1st place
+ string offhand_weapon = "mp_weapon_thermite_grenade" // offhand weapon
+
+ bool reset_pulse_blade_cooldown_on_pulse_blade_kill = true
+
+ int wme_kill_value = 10
+ int offhand_kill_value = 10
+ int reset_kill_value = 5
+ int melee_kill_value = 5
+} file
+
+
+void function SNS_Init()
+{
+ SetShouldUseRoundWinningKillReplay( true )
+ ClassicMP_ForceDisableEpilogue( true )
+ SetLoadoutGracePeriodEnabled( false ) // prevent modifying loadouts with grace period
+ SetWeaponDropsEnabled( false )
+ Riff_ForceTitanAvailability( eTitanAvailability.Never )
+ Riff_ForceBoostAvailability( eBoostAvailability.Disabled )
+
+ AddCallback_OnPlayerKilled( OnPlayerKilled )
+ AddCallback_OnPlayerRespawned( OnPlayerRespawned )
+ AddCallback_GameStateEnter( eGameState.WinnerDetermined, OnWinnerDetermined )
+}
+
+void function OnPlayerKilled( entity victim, entity attacker, var damageInfo )
+{
+ if ( victim != attacker && victim.IsPlayer() && attacker.IsPlayer() && GetGameState() == eGameState.Playing )
+ {
+ SetRoundWinningKillReplayAttacker(attacker)
+ if ( DamageInfo_GetDamageSourceIdentifier( damageInfo ) == eDamageSourceId.mp_weapon_grenade_sonar || DamageInfo_GetDamageSourceIdentifier( damageInfo ) == eDamageSourceId.human_execution)
+ {
+ if (victim == GetWinningPlayer())
+ {
+ foreach ( entity otherPlayer in GetPlayerArray() )
+ {
+ if (otherPlayer == victim)
+ continue
+ Remote_CallFunction_NonReplay( otherPlayer, "ServerCallback_AnnounceKillLeaderBankrupt", victim.GetEncodedEHandle(), attacker.GetEncodedEHandle() )
+ }
+ }
+ if (file.reset_pulse_blade_cooldown_on_pulse_blade_kill)
+ {
+ attacker.TakeWeaponNow( "mp_weapon_grenade_sonar" ) // resets cooldown if you kill with it
+ attacker.GiveOffhandWeapon( "mp_weapon_grenade_sonar", OFFHAND_LEFT )
+ }
+
+ EmitSoundOnEntityOnlyToPlayer( attacker, attacker, "UI_CTF_3P_TeamGrabFlag" )
+ bankrupt(victim, attacker)
+
+ AddTeamScore( attacker.GetTeam(), file.reset_kill_value )
+ attacker.AddToPlayerGameStat( PGS_ASSAULT_SCORE, file.reset_kill_value )
+ attacker.AddToPlayerGameStat( PGS_TITAN_KILLS, 1 )
+ }
+ else if ( DamageInfo_GetDamageSourceIdentifier( damageInfo ) == eDamageSourceId.melee_pilot_emptyhanded )
+ {
+ AddTeamScore( attacker.GetTeam(), file.melee_kill_value )
+ attacker.AddToPlayerGameStat( PGS_ASSAULT_SCORE, file.melee_kill_value )
+ }
+ else if ( DamageInfo_GetDamageSourceIdentifier( damageInfo ) == eDamageSourceId.mp_weapon_wingman_n )
+ {
+ AddTeamScore( attacker.GetTeam(), file.wme_kill_value )
+ attacker.AddToPlayerGameStat( PGS_ASSAULT_SCORE, file.wme_kill_value )
+ }
+ else
+ {
+ AddTeamScore( attacker.GetTeam(), file.offhand_kill_value )
+ attacker.AddToPlayerGameStat( PGS_ASSAULT_SCORE, file.offhand_kill_value )
+ }
+
+ if (attacker == GetWinningPlayer())
+ SetHighlight( attacker )
+ }
+}
+
+void function bankrupt(entity player, entity attacker) {
+ while (GameRules_GetTeamScore(player.GetTeam()) > 0) {
+ AddTeamScore( player.GetTeam(), -1 )
+ }
+ player.SetPlayerGameStat( PGS_ASSAULT_SCORE, 0)
+
+ Remote_CallFunction_NonReplay( player , "ServerCallback_AnnounceBankrupt", attacker.GetEncodedEHandle() )
+ EmitSoundOnEntityOnlyToPlayer( player, player, "UI_InGame_MarkedForDeath_PlayerMarked" )
+}
+
+void function OnWinnerDetermined()
+{
+ SetRespawnsEnabled( false )
+ SetKillcamsEnabled( false )
+}
+
+void function OnPlayerRespawned( entity player )
+{
+ foreach ( entity weapon in player.GetMainWeapons() )
+ player.TakeWeaponNow( weapon.GetWeaponClassName() )
+
+ foreach ( entity weapon in player.GetOffhandWeapons() )
+ player.TakeWeaponNow( weapon.GetWeaponClassName() )
+
+ array<string> mods = ["sns", "pas_fast_ads", "tactical_cdr_on_kill", "pas_run_and_gun", "pas_fast_swap"]
+ player.GiveWeapon( "mp_weapon_wingman_n", mods)
+ player.GiveOffhandWeapon( "melee_pilot_emptyhanded", OFFHAND_MELEE )
+ player.GiveOffhandWeapon( file.offhand_weapon, OFFHAND_RIGHT )
+ player.GiveOffhandWeapon( "mp_weapon_grenade_sonar", OFFHAND_LEFT )
+
+ if (player == GetWinningPlayer())
+ SetHighlight( player )
+
+ thread OnPlayerRespawned_Threaded( player )
+}
+
+void function OnPlayerRespawned_Threaded( entity player )
+{
+ // bit of a hack, need to rework earnmeter code to have better support for completely disabling it
+ // rn though this just waits for earnmeter code to set the mode before we set it back
+ WaitFrame()
+ if ( IsValid( player ) )
+ PlayerEarnMeter_SetMode( player, eEarnMeterMode.DISABLED )
+}
+
+entity function GetWinningPlayer()
+{
+ entity bestplayer
+
+ foreach ( entity player in GetPlayerArray() ) {
+ if (bestplayer == null)
+ bestplayer = player
+
+ if (GameRules_GetTeamScore(player.GetTeam()) > GameRules_GetTeamScore(bestplayer.GetTeam()))
+ bestplayer = player
+ }
+
+ return bestplayer
+}
+
+void function SetHighlight(entity player) {
+ foreach ( entity player in GetPlayerArray() )
+ Highlight_ClearEnemyHighlight(player)
+ Highlight_SetEnemyHighlight( player, file.score_leader_highlight )
+} \ No newline at end of file
diff --git a/Northstar.Custom/mod/scripts/vscripts/gamemodes/cl_gamemode_gg.gnut b/Northstar.Custom/mod/scripts/vscripts/gamemodes/cl_gamemode_gg.gnut
index de8a34491..6f4e015ec 100644
--- a/Northstar.Custom/mod/scripts/vscripts/gamemodes/cl_gamemode_gg.gnut
+++ b/Northstar.Custom/mod/scripts/vscripts/gamemodes/cl_gamemode_gg.gnut
@@ -23,4 +23,6 @@ void function ClGamemodeGG_Init()
RegisterLevelMusicForTeam( eMusicPieceID.LEVEL_LAST_MINUTE, "music_mp_freeagents_lastminute", TEAM_IMC )
RegisterLevelMusicForTeam( eMusicPieceID.LEVEL_LAST_MINUTE, "music_mp_freeagents_lastminute", TEAM_MILITIA )
+
+ Cl_GGEarnMeter_Init()
} \ No newline at end of file
diff --git a/Northstar.Custom/mod/scripts/vscripts/gamemodes/cl_gamemode_sns.gnut b/Northstar.Custom/mod/scripts/vscripts/gamemodes/cl_gamemode_sns.gnut
new file mode 100644
index 000000000..f91c42556
--- /dev/null
+++ b/Northstar.Custom/mod/scripts/vscripts/gamemodes/cl_gamemode_sns.gnut
@@ -0,0 +1,55 @@
+global function ClGameModeSNS_Init
+global function ServerCallback_AnnounceKillLeaderBankrupt
+global function ServerCallback_AnnounceBankrupt
+
+void function ClGameModeSNS_Init()
+{
+ ClGameState_RegisterGameStateAsset( $"ui/gamestate_info_ffa.rpak" )
+
+ // add music for mode, this is copied directly from the ffa/fra music registered in cl_music.gnut
+ RegisterLevelMusicForTeam( eMusicPieceID.LEVEL_INTRO, "music_mp_freeagents_intro", TEAM_IMC )
+ RegisterLevelMusicForTeam( eMusicPieceID.LEVEL_INTRO, "music_mp_freeagents_intro", TEAM_MILITIA )
+
+ RegisterLevelMusicForTeam( eMusicPieceID.LEVEL_WIN, "music_mp_freeagents_outro_win", TEAM_IMC )
+ RegisterLevelMusicForTeam( eMusicPieceID.LEVEL_WIN, "music_mp_freeagents_outro_win", TEAM_MILITIA )
+
+ RegisterLevelMusicForTeam( eMusicPieceID.LEVEL_DRAW, "music_mp_freeagents_outro_lose", TEAM_IMC )
+ RegisterLevelMusicForTeam( eMusicPieceID.LEVEL_DRAW, "music_mp_freeagents_outro_lose", TEAM_MILITIA )
+
+ RegisterLevelMusicForTeam( eMusicPieceID.LEVEL_LOSS, "music_mp_freeagents_outro_lose", TEAM_IMC )
+ RegisterLevelMusicForTeam( eMusicPieceID.LEVEL_LOSS, "music_mp_freeagents_outro_lose", TEAM_MILITIA )
+
+ RegisterLevelMusicForTeam( eMusicPieceID.LEVEL_THREE_MINUTE, "music_mp_freeagents_almostdone", TEAM_IMC )
+ RegisterLevelMusicForTeam( eMusicPieceID.LEVEL_THREE_MINUTE, "music_mp_freeagents_almostdone", TEAM_MILITIA )
+
+ RegisterLevelMusicForTeam( eMusicPieceID.LEVEL_LAST_MINUTE, "music_mp_freeagents_lastminute", TEAM_IMC )
+ RegisterLevelMusicForTeam( eMusicPieceID.LEVEL_LAST_MINUTE, "music_mp_freeagents_lastminute", TEAM_MILITIA )
+ AddCallback_GameStateEnter( eGameState.Postmatch, DisplayPostMatchTop3 )
+}
+
+void function ServerCallback_AnnounceKillLeaderBankrupt( int leaderEHandle, int killerEHandle )
+{
+ entity player = GetEntityFromEncodedEHandle( leaderEHandle )
+ entity killer = GetEntityFromEncodedEHandle( killerEHandle )
+ AnnouncementData announcement = Announcement_Create( "#SNS_LEADER_BANKRUPT" )
+ Announcement_SetSubText( announcement, Localize( "#SNS_LEADER_BANKRUPT_SUB", player.GetPlayerName(), killer.GetPlayerName()))
+ Announcement_SetTitleColor( announcement, <1,1,0> )
+ Announcement_SetPurge( announcement, true )
+ Announcement_SetPriority( announcement, 200 ) //Be higher priority than Titanfall ready indicator etc
+ Announcement_SetSoundAlias( announcement, SFX_HUD_ANNOUNCE_QUICK )
+ Announcement_SetStyle( announcement, ANNOUNCEMENT_STYLE_QUICK )
+ AnnouncementFromClass( GetLocalViewPlayer(), announcement )
+}
+
+void function ServerCallback_AnnounceBankrupt(int killerEHandle)
+{
+ entity killer = GetEntityFromEncodedEHandle( killerEHandle )
+ AnnouncementData announcement = Announcement_Create( "#SNS_BANKRUPT" )
+ Announcement_SetSubText( announcement, Localize( "#SNS_BANKRUPT_SUB", killer.GetPlayerName() ))
+ Announcement_SetTitleColor( announcement, <1,0,0> )
+ Announcement_SetPurge( announcement, true )
+ Announcement_SetPriority( announcement, 200 ) //Be higher priority than Titanfall ready indicator etc
+ Announcement_SetSoundAlias( announcement, SFX_HUD_ANNOUNCE_QUICK )
+ Announcement_SetStyle( announcement, ANNOUNCEMENT_STYLE_QUICK )
+ AnnouncementFromClass( GetLocalViewPlayer(), announcement )
+} \ No newline at end of file
diff --git a/Northstar.Custom/mod/scripts/vscripts/gamemodes/gg_earn_meter/_gg_earn_meter.gnut b/Northstar.Custom/mod/scripts/vscripts/gamemodes/gg_earn_meter/_gg_earn_meter.gnut
new file mode 100644
index 000000000..1d4e73b73
--- /dev/null
+++ b/Northstar.Custom/mod/scripts/vscripts/gamemodes/gg_earn_meter/_gg_earn_meter.gnut
@@ -0,0 +1,56 @@
+global function Sv_GGEarnMeter_SetWeaponIcon
+global function Sv_GGEarnMeter_SetFinalIcon
+global function Sv_GGEarnMeter_SetPercentage
+global function Sv_GGEarnMeter_AddPercentage
+global function AddCallback_GGEarnMeterFull
+
+struct
+{
+ array< bool functionref( entity ) > onGGEarnMeterFullCallbacks
+} file
+
+void function Sv_GGEarnMeter_SetWeaponIcon( entity player, string weaponReference )
+{
+ Remote_CallFunction_Replay( player, "ServerCallback_GGEarnMeter_SetWeaponIcon", eDamageSourceId[weaponReference] )
+}
+
+void function Sv_GGEarnMeter_SetFinalIcon( entity player )
+{
+ Remote_CallFunction_Replay( player, "ServerCallback_GGEarnMeter_SetWeaponIcon", -1 )
+}
+
+void function Sv_GGEarnMeter_SetPercentage( entity player, float percentage )
+{
+ player.SetPlayerNetFloat( "gunGameLevelPercentage", clamp(percentage, 0.0, 1.0) )
+
+ thread CheckPercentage( player )
+}
+
+void function Sv_GGEarnMeter_AddPercentage( entity player, float percentage )
+{
+ Sv_GGEarnMeter_SetPercentage(player, player.GetPlayerNetFloat( "gunGameLevelPercentage") + percentage)
+}
+
+void function AddCallback_GGEarnMeterFull( bool functionref( entity ) callbackFunc )
+{
+ Assert( !file.onGGEarnMeterFullCallbacks.contains( callbackFunc ), "Already added " + FunctionToString( callbackFunc ) + " with AddCallback_GGEarnMeterFull" )
+
+ file.onGGEarnMeterFullCallbacks.append( callbackFunc )
+}
+
+void function CheckPercentage( entity player )
+{
+ float percentage = player.GetPlayerNetFloat( "gunGameLevelPercentage")
+
+ if ( percentage < 1.0 )
+ return
+
+ wait 0.2
+
+ bool lastWeapon = false
+ foreach ( callbackFunc in file.onGGEarnMeterFullCallbacks )
+ lastWeapon = callbackFunc( player )
+
+ if ( !lastWeapon )
+ Sv_GGEarnMeter_SetPercentage(player, 0.0)
+} \ No newline at end of file
diff --git a/Northstar.Custom/mod/scripts/vscripts/gamemodes/gg_earn_meter/cl_gg_earn_meter.gnut b/Northstar.Custom/mod/scripts/vscripts/gamemodes/gg_earn_meter/cl_gg_earn_meter.gnut
new file mode 100644
index 000000000..d6369b0cf
--- /dev/null
+++ b/Northstar.Custom/mod/scripts/vscripts/gamemodes/gg_earn_meter/cl_gg_earn_meter.gnut
@@ -0,0 +1,82 @@
+global function Cl_GGEarnMeter_Init
+global function Cl_GGEarnMeter_RegisterNetwork
+global function ServerCallback_GGEarnMeter_SetWeaponIcon
+
+const float FILL_ANIM_DURATION = 0.2
+
+struct EarnChangeData
+{
+ float startValue = 0.0
+ float endValue = 0.0
+ float updateTime = 0.0
+}
+
+struct {
+ EarnChangeData lastEarnedData
+ var earnMeterRui
+} file
+
+void function Cl_GGEarnMeter_Init()
+{
+ AddCallback_OnClientScriptInit( CreateGGEarnMeterUI )
+}
+
+void function CreateGGEarnMeterUI( entity player )
+{
+ file.earnMeterRui = CreateCockpitRui( $"ui/earn_meter.rpak" )
+
+ RuiSetFloat( file.earnMeterRui, "fillAnimDuration", FILL_ANIM_DURATION )
+ RuiSetGameTime( file.earnMeterRui, "lastEarnChangeTime", RUI_BADGAMETIME )
+ RuiSetFloat( file.earnMeterRui, "earnedStartFrac", 0.0 )
+ RuiSetInt( file.earnMeterRui, "meterMode", 5 )
+
+ RuiTrackFloat( file.earnMeterRui, "earnedFrac", player, RUI_TRACK_SCRIPT_NETWORK_VAR, GetNetworkedVariableIndex( "gunGameLevelPercentage" ) )
+}
+
+void function Cl_GGEarnMeter_RegisterNetwork()
+{
+ RegisterNetworkedVariableChangeCallback_float( "gunGameLevelPercentage", GunGamePercentageUpdate )
+}
+
+void function GunGamePercentageUpdate( entity player, float oldValue, float newValue, bool actuallyChanged )
+{
+ if ( !actuallyChanged )
+ return
+
+ float currentValue = Cl_GGEarnMeter_GetCurrentMeterValue( file.lastEarnedData )
+ RuiSetGameTime( file.earnMeterRui, "lastEarnChangeTime", Time() )
+ RuiSetFloat( file.earnMeterRui, "earnedStartFrac", currentValue )
+
+ file.lastEarnedData.startValue = oldValue
+ file.lastEarnedData.endValue = newValue
+ file.lastEarnedData.updateTime = Time()
+}
+
+float function Cl_GGEarnMeter_GetCurrentMeterValue( EarnChangeData earnData )
+{
+ float elapsedTime = Time() - earnData.updateTime
+ float delta = earnData.endValue - earnData.startValue
+ return earnData.endValue - (delta * EaseIn( GraphCapped( elapsedTime, 0.0, FILL_ANIM_DURATION, 1.0, 0.0 ) ) )
+}
+
+void function ServerCallback_GGEarnMeter_SetWeaponIcon( int damageSourceId )
+{
+ asset weaponImage
+
+ if ( damageSourceId > -1 )
+ {
+ if ( !DamageSourceIDHasString(damageSourceId) )
+ {
+ return
+ }
+
+ weaponImage = GetItemImage( DamageSourceIDToString( damageSourceId ) )
+ }
+ else
+ {
+ weaponImage = RandomFloat( 1 ) > 0.1 ? $"rui/menu/boosts/boost_icon_random" : $"rui/faction/faction_logo_mrvn"
+ }
+
+ RuiSetImage( file.earnMeterRui, "goalBuildingIcon", weaponImage )
+ RuiSetImage( file.earnMeterRui, "goalReadyIcon", weaponImage )
+} \ No newline at end of file
diff --git a/Northstar.Custom/mod/scripts/vscripts/gamemodes/gg_earn_meter/sh_gg_earn_meter.gnut b/Northstar.Custom/mod/scripts/vscripts/gamemodes/gg_earn_meter/sh_gg_earn_meter.gnut
new file mode 100644
index 000000000..0428ecfa7
--- /dev/null
+++ b/Northstar.Custom/mod/scripts/vscripts/gamemodes/gg_earn_meter/sh_gg_earn_meter.gnut
@@ -0,0 +1,16 @@
+global function Sh_GGEarnMeter_Init
+
+void function Sh_GGEarnMeter_Init()
+{
+ AddCallback_OnRegisteringCustomNetworkVars( RegisterSharedNetwork )
+}
+
+void function RegisterSharedNetwork()
+{
+ RegisterNetworkedVariable( "gunGameLevelPercentage", SNDC_PLAYER_EXCLUSIVE, SNVT_FLOAT_RANGE, 0.0, 0.0, 1.0 )
+ Remote_RegisterFunction( "ServerCallback_GGEarnMeter_SetWeaponIcon" )
+
+ #if CLIENT
+ Cl_GGEarnMeter_RegisterNetwork()
+ #endif
+} \ No newline at end of file
diff --git a/Northstar.Custom/mod/scripts/vscripts/gamemodes/sh_gamemode_gg.gnut b/Northstar.Custom/mod/scripts/vscripts/gamemodes/sh_gamemode_gg.gnut
index c4021a3cc..42d264d93 100644
--- a/Northstar.Custom/mod/scripts/vscripts/gamemodes/sh_gamemode_gg.gnut
+++ b/Northstar.Custom/mod/scripts/vscripts/gamemodes/sh_gamemode_gg.gnut
@@ -18,6 +18,9 @@ void function Sh_GamemodeGG_Init()
{
// create custom gamemode
AddCallback_OnCustomGamemodesInit( CreateGamemodeGG )
+
+ if ( GAMETYPE != GAMEMODE_GG )
+ Sh_GGEarnMeter_Init()
}
void function CreateGamemodeGG()
@@ -30,119 +33,122 @@ void function CreateGamemodeGG()
GameMode_AddScoreboardColumnData( GAMEMODE_GG, "#SCOREBOARD_SCORE", PGS_ASSAULT_SCORE, 2 )
GameMode_AddScoreboardColumnData( GAMEMODE_GG, "#SCOREBOARD_PILOT_KILLS", PGS_PILOT_KILLS, 2 )
GameMode_SetColor( GAMEMODE_GG, [147, 204, 57, 255] )
-
+
AddPrivateMatchMode( GAMEMODE_GG ) // add to private lobby modes
-
+ AddPrivateMatchModeSettingArbitrary( "#GAMEMODE_gg", "gg_kill_reward", "1.0" )
+ AddPrivateMatchModeSettingArbitrary( "#GAMEMODE_gg", "gg_assist_reward", "0.0" )
+ AddPrivateMatchModeSettingArbitrary( "#GAMEMODE_gg", "gg_execution_reward", "1.0" )
+
// setup guns
-
+
// smgs
// car
GunGameWeapon ggCar = { weapon = "mp_weapon_car", mods = [ "pas_run_and_gun" ], ... }
file.weapons.append( ggCar )
-
+
// alternator
GunGameWeapon ggAlternator = { weapon = "mp_weapon_alternator_smg", mods = [ "pas_run_and_gun" ], ... }
file.weapons.append( ggAlternator )
-
+
// volt
GunGameWeapon ggVolt = { weapon = "mp_weapon_hemlok_smg", ... }
file.weapons.append( ggVolt )
-
-
+
+
// rifles
// hemlok
GunGameWeapon ggHemlok = { weapon = "mp_weapon_hemlok", mods = [ ], ... }
file.weapons.append( ggHemlok )
-
+
// flatline
GunGameWeapon ggFlatline = { weapon = "mp_weapon_vinson", mods = [ "hcog" ], ... }
file.weapons.append( ggFlatline )
-
+
// r201
GunGameWeapon ggR101 = { weapon = "mp_weapon_rspn101", ... }
file.weapons.append( ggR101 )
-
-
+
+
// lmgs
// devotion
GunGameWeapon ggDevotion = { weapon = "mp_weapon_esaw", ... }
file.weapons.append( ggDevotion )
-
+
// l-star
GunGameWeapon ggLstar = { weapon = "mp_weapon_lstar", mods = [ "pas_run_and_gun" ], ... }
if ( RandomInt( 100 ) <= 5 )
ggLstar.mods.append( "rcee" ) // easter egg mod that changes the screen of the lstar
-
+
file.weapons.append( ggLstar )
-
-
+
+
// shotguns
// eva-8
GunGameWeapon ggEva = { weapon = "mp_weapon_shotgun", ... }
file.weapons.append( ggEva )
-
+
// mastiff
GunGameWeapon ggMastiff = { weapon = "mp_weapon_mastiff", ... }
file.weapons.append( ggMastiff )
-
-
+
+
// grenadiers
// softball
GunGameWeapon ggSoftball = { weapon = "mp_weapon_softball", ... }
file.weapons.append( ggSoftball )
-
+
// epg
GunGameWeapon ggEpg = { weapon = "mp_weapon_epg", mods = [ "jump_kit" ], ... }
file.weapons.append( ggEpg )
-
-
+
+
// primary pistols
// mozambique
GunGameWeapon ggMozam = { weapon = "mp_weapon_shotgun_pistol", mods = [ "pas_run_and_gun" ], ... }
file.weapons.append( ggMozam )
-
+
// wingman elite
GunGameWeapon ggWme = { weapon = "mp_weapon_wingman_n", mods = [ "pas_run_and_gun", "ricochet" ], ... }
file.weapons.append( ggWme )
-
-
+
+
// snipers
// double take
GunGameWeapon ggTaketake = { weapon = "mp_weapon_doubletake", ... }
file.weapons.append( ggTaketake )
-
+
// kraber
GunGameWeapon ggKraber = { weapon = "mp_weapon_sniper", mods = [ "pas_fast_ads", "ricochet" ], ... }
file.weapons.append( ggKraber )
-
-
+
+
// secondary pistols
// re-45
GunGameWeapon ggRe45 = { weapon = "mp_weapon_autopistol", mods = [ "pas_run_and_gun", "temp_sight" ], ... }
file.weapons.append( ggRe45 )
-
+
// p2016
GunGameWeapon ggP2016 = { weapon = "mp_weapon_semipistol", mods = [ "pas_run_and_gun" ], ... }
file.weapons.append( ggP2016 )
-
+
// wingman
GunGameWeapon ggWingman = { weapon = "mp_weapon_wingman", mods = [ "pas_run_and_gun" ], ... }
file.weapons.append( ggWingman )
-
-
+
+
// final/special weapons
// charge rifle
GunGameWeapon ggChargeRifle = { weapon = "mp_weapon_defender", ... }
file.weapons.append( ggChargeRifle )
-
+
// pulse blade
- GunGameWeapon ggPulseBlade = { weapon = "mp_weapon_grenade_sonar", mods = [ "pas_power_cell", "amped_tacticals" ], offhandSlot = 0 }
+ GunGameWeapon ggPulseBlade = { weapon = "mp_weapon_grenade_sonar", mods = [ "pas_power_cell", "amped_tacticals" ], offhandSlot = OFFHAND_SPECIAL }
file.weapons.append( ggPulseBlade )
-
-
+
+
// set this to the number of guns
GameMode_SetDefaultScoreLimits( GAMEMODE_GG, file.weapons.len(), 0 )
-
+
#if SERVER
GameMode_AddServerInit( GAMEMODE_GG, GamemodeGG_Init )
GameMode_AddServerInit( GAMEMODE_GG, GamemodeFFAShared_Init )
diff --git a/Northstar.Custom/mod/scripts/vscripts/gamemodes/sh_gamemode_sns.gnut b/Northstar.Custom/mod/scripts/vscripts/gamemodes/sh_gamemode_sns.gnut
new file mode 100644
index 000000000..b3d2c2da3
--- /dev/null
+++ b/Northstar.Custom/mod/scripts/vscripts/gamemodes/sh_gamemode_sns.gnut
@@ -0,0 +1,51 @@
+globalize_all_functions
+
+global array<var> consoleVars;
+global const string GAMEMODE_SNS = "sns"
+
+void function SNSMode_Init()
+{
+ AddCallback_OnCustomGamemodesInit( CreateGamemodeSNS )
+ AddCallback_OnRegisteringCustomNetworkVars( SNSRegisterNetworkVars )
+}
+
+
+void function CreateGamemodeSNS()
+{
+ GameMode_Create( GAMEMODE_SNS )
+ GameMode_SetName( GAMEMODE_SNS, "#GAMEMODE_SNS" )
+ GameMode_SetDesc( GAMEMODE_SNS, "#PL_sns_desc" )
+ GameMode_SetGameModeAnnouncement( GAMEMODE_SNS, "ffa_modeDesc" )
+ GameMode_SetDefaultTimeLimits( GAMEMODE_SNS, 15, 0.0 )
+ GameMode_AddScoreboardColumnData( GAMEMODE_SNS, "#SCOREBOARD_SCORE", PGS_ASSAULT_SCORE, 2 )
+ GameMode_AddScoreboardColumnData( GAMEMODE_SNS, "#SCOREBOARD_PILOT_KILLS", PGS_PILOT_KILLS, 2 )
+ GameMode_AddScoreboardColumnData( GAMEMODE_SNS, "#SCOREBOARD_BANKRUPTS", PGS_TITAN_KILLS, 2 )
+ GameMode_SetColor( GAMEMODE_SNS, [147, 204, 57, 255] )
+
+ AddPrivateMatchMode( GAMEMODE_SNS ) // add to private lobby modes
+
+ GameMode_SetDefaultScoreLimits( GAMEMODE_SNS, 300, 0 )
+
+ #if SERVER
+ GameMode_AddServerInit( GAMEMODE_SNS, SNS_Init )
+ GameMode_AddServerInit( GAMEMODE_SNS, GamemodeFFAShared_Init )
+ GameMode_SetPilotSpawnpointsRatingFunc( GAMEMODE_SNS, RateSpawnpoints_Generic )
+ GameMode_SetTitanSpawnpointsRatingFunc( GAMEMODE_SNS, RateSpawnpoints_Generic )
+ #elseif CLIENT
+ GameMode_AddClientInit( GAMEMODE_SNS, ClGameModeSNS_Init )
+ GameMode_AddClientInit( GAMEMODE_SNS, GamemodeFFAShared_Init )
+ GameMode_AddClientInit( GAMEMODE_SNS, ClGamemodeFFA_Init )
+ #endif
+ #if !UI
+ GameMode_SetScoreCompareFunc( GAMEMODE_SNS, CompareAssaultScore )
+ GameMode_AddSharedInit( GAMEMODE_SNS, GamemodeFFA_Dialogue_Init )
+ #endif
+}
+
+void function SNSRegisterNetworkVars()
+{
+ if ( GAMETYPE != GAMEMODE_SNS )
+ return
+ Remote_RegisterFunction( "ServerCallback_AnnounceBankrupt" )
+ Remote_RegisterFunction( "ServerCallback_AnnounceKillLeaderBankrupt" )
+} \ No newline at end of file