aboutsummaryrefslogtreecommitdiff
path: root/Northstar.CustomServers/mod/scripts/vscripts/mp/_gamestate_mp.nut
diff options
context:
space:
mode:
authorDBmaoha <56738369+DBmaoha@users.noreply.github.com>2022-10-22 02:51:19 +0800
committerGitHub <noreply@github.com>2022-10-21 19:51:19 +0100
commitee0613f81248335191170ffccada19af0e85524c (patch)
tree5c4a363576b7cef9d3316cbc631050e2c255fa51 /Northstar.CustomServers/mod/scripts/vscripts/mp/_gamestate_mp.nut
parent133aa4c4d1559b680cc043fdfe9c4dafb5d486f8 (diff)
downloadNorthstarMods-ee0613f81248335191170ffccada19af0e85524c.tar.gz
NorthstarMods-ee0613f81248335191170ffccada19af0e85524c.zip
Added Music and Dialogue Event (#469)
* Added Music and Dialogue Event Added Music based on score event and time. Added Dialogue event based on score comparation and after killing a player's titan * Changed Filter Type to Only DM Gamemodes Only vanilla gamemodes those have unlimited respawns will automatically plays music * Added a ! omg * Removed Music Event Removed Music Event, Moved Dialogue Event to _gamestate_mp.nut * Changed mods.json * Changed RoundBased Gamemodes Check not hardcoded right now * Moved Killing Titan Dialogue to _score.nut dialogue is now together with scoreevent
Diffstat (limited to 'Northstar.CustomServers/mod/scripts/vscripts/mp/_gamestate_mp.nut')
-rw-r--r--Northstar.CustomServers/mod/scripts/vscripts/mp/_gamestate_mp.nut91
1 files changed, 91 insertions, 0 deletions
diff --git a/Northstar.CustomServers/mod/scripts/vscripts/mp/_gamestate_mp.nut b/Northstar.CustomServers/mod/scripts/vscripts/mp/_gamestate_mp.nut
index a44d7590f..46b39ebc1 100644
--- a/Northstar.CustomServers/mod/scripts/vscripts/mp/_gamestate_mp.nut
+++ b/Northstar.CustomServers/mod/scripts/vscripts/mp/_gamestate_mp.nut
@@ -220,6 +220,8 @@ void function GameStateEnter_Playing_Threaded()
{
WaitFrame() // ensure timelimits are all properly set
+ thread DialoguePlayNormal() // runs dialogue play function
+
while ( GetGameState() == eGameState.Playing )
{
// could cache these, but what if we update it midgame?
@@ -268,6 +270,8 @@ void function GameStateEnter_WinnerDetermined_Threaded()
// do win announcement
int winningTeam = GetWinningTeamWithFFASupport()
+ DialoguePlayWinnerDetermined() // play a faction dialogue when winner is determined
+
foreach ( entity player in GetPlayerArray() )
{
int announcementSubstr
@@ -888,3 +892,90 @@ float function GetTimeLimit_ForGameMode()
// default to 10 mins, because that seems reasonable
return GetCurrentPlaylistVarFloat( playlistString, 10 )
}
+
+// faction dialogue
+
+void function DialoguePlayNormal()
+{
+ int totalScore = GameMode_GetScoreLimit( GameRules_GetGameMode() )
+ int winningTeam
+ int losingTeam
+ float diagIntervel = 71 // play a faction dailogue every 70 + 1s to prevent play together with winner dialogue
+
+ while( GetGameState() == eGameState.Playing )
+ {
+ wait diagIntervel
+ if( GameRules_GetTeamScore( TEAM_MILITIA ) < GameRules_GetTeamScore( TEAM_IMC ) )
+ {
+ winningTeam = TEAM_IMC
+ losingTeam = TEAM_MILITIA
+ }
+ if( GameRules_GetTeamScore( TEAM_MILITIA ) > GameRules_GetTeamScore( TEAM_IMC ) )
+ {
+ winningTeam = TEAM_MILITIA
+ losingTeam = TEAM_IMC
+ }
+ if( GameRules_GetTeamScore( winningTeam ) - GameRules_GetTeamScore( losingTeam ) >= totalScore * 0.4 )
+ {
+ PlayFactionDialogueToTeam( "scoring_winningLarge", winningTeam )
+ PlayFactionDialogueToTeam( "scoring_losingLarge", losingTeam )
+ }
+ else if( GameRules_GetTeamScore( winningTeam ) - GameRules_GetTeamScore( losingTeam ) <= totalScore * 0.2 )
+ {
+ PlayFactionDialogueToTeam( "scoring_winningClose", winningTeam )
+ PlayFactionDialogueToTeam( "scoring_losingClose", losingTeam )
+ }
+ else if( GameRules_GetTeamScore( winningTeam ) == GameRules_GetTeamScore( losingTeam ) )
+ {
+ continue
+ }
+ else
+ {
+ PlayFactionDialogueToTeam( "scoring_winning", winningTeam )
+ PlayFactionDialogueToTeam( "scoring_losing", losingTeam )
+ }
+ }
+}
+
+void function DialoguePlayWinnerDetermined()
+{
+ int totalScore = GameMode_GetScoreLimit( GameRules_GetGameMode() )
+ int winningTeam
+ int losingTeam
+
+ if( GameRules_GetTeamScore( TEAM_MILITIA ) < GameRules_GetTeamScore( TEAM_IMC ) )
+ {
+ winningTeam = TEAM_IMC
+ losingTeam = TEAM_MILITIA
+ }
+ if( GameRules_GetTeamScore( TEAM_MILITIA ) > GameRules_GetTeamScore( TEAM_IMC ) )
+ {
+ winningTeam = TEAM_MILITIA
+ losingTeam = TEAM_IMC
+ }
+ if( IsRoundBased() ) // check for round based modes
+ {
+ if( GameRules_GetTeamScore( winningTeam ) != GameMode_GetRoundScoreLimit( GAMETYPE ) ) // no winner dialogue till game really ends
+ return
+ }
+ if( GameRules_GetTeamScore( winningTeam ) - GameRules_GetTeamScore( losingTeam ) >= totalScore * 0.4 )
+ {
+ PlayFactionDialogueToTeam( "scoring_wonMercy", winningTeam )
+ PlayFactionDialogueToTeam( "scoring_lostMercy", losingTeam )
+ }
+ else if( GameRules_GetTeamScore( winningTeam ) - GameRules_GetTeamScore( losingTeam ) <= totalScore * 0.2 )
+ {
+ PlayFactionDialogueToTeam( "scoring_wonClose", winningTeam )
+ PlayFactionDialogueToTeam( "scoring_lostClose", losingTeam )
+ }
+ else if( GameRules_GetTeamScore( winningTeam ) == GameRules_GetTeamScore( losingTeam ) )
+ {
+ PlayFactionDialogueToTeam( "scoring_tied", winningTeam )
+ PlayFactionDialogueToTeam( "scoring_tied", losingTeam )
+ }
+ else
+ {
+ PlayFactionDialogueToTeam( "scoring_won", winningTeam )
+ PlayFactionDialogueToTeam( "scoring_lost", losingTeam )
+ }
+}