From ee0613f81248335191170ffccada19af0e85524c Mon Sep 17 00:00:00 2001 From: DBmaoha <56738369+DBmaoha@users.noreply.github.com> Date: Sat, 22 Oct 2022 02:51:19 +0800 Subject: 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 --- .../mod/scripts/vscripts/mp/_gamestate_mp.nut | 91 ++++++++++++++++++++++ .../mod/scripts/vscripts/mp/_score.nut | 42 ++++++++++ 2 files changed, 133 insertions(+) (limited to 'Northstar.CustomServers/mod/scripts') 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 ) + } +} diff --git a/Northstar.CustomServers/mod/scripts/vscripts/mp/_score.nut b/Northstar.CustomServers/mod/scripts/vscripts/mp/_score.nut index 457b2c9f1..dacd43b0f 100644 --- a/Northstar.CustomServers/mod/scripts/vscripts/mp/_score.nut +++ b/Northstar.CustomServers/mod/scripts/vscripts/mp/_score.nut @@ -215,6 +215,9 @@ void function ScoreEvent_TitanKilled( entity victim, entity attacker, var damage Remote_CallFunction_NonReplay( attackerInfo.attacker, "ServerCallback_SetAssistInformation", attackerInfo.damageSourceId, attacker.GetEncodedEHandle(), victim.GetEncodedEHandle(), attackerInfo.time ) } } + + if( !victim.IsNPC() ) // don't let killing a npc titan plays dialogue + KilledPlayerTitanDialogue( attacker, victim ) } void function ScoreEvent_NPCKilled( entity victim, entity attacker, var damageInfo ) @@ -261,3 +264,42 @@ void function ScoreEvent_SetupEarnMeterValuesForTitanModes() { // relatively sure we don't have to do anything here but leaving this function for consistency } + +// faction dialogue +void function KilledPlayerTitanDialogue( entity attacker, entity victim ) +{ + if( !attacker.IsPlayer() ) + return + entity titan + if ( victim.IsTitan() ) + titan = victim + + if( !IsValid( titan ) ) + return + string titanCharacterName = GetTitanCharacterName( titan ) + + switch( titanCharacterName ) + { + case "ion": + PlayFactionDialogueToPlayer( "kc_pilotkillIon", attacker ) + return + case "tone": + PlayFactionDialogueToPlayer( "kc_pilotkillTone", attacker ) + return + case "legion": + PlayFactionDialogueToPlayer( "kc_pilotkillLegion", attacker ) + return + case "scorch": + PlayFactionDialogueToPlayer( "kc_pilotkillScorch", attacker ) + return + case "ronin": + PlayFactionDialogueToPlayer( "kc_pilotkillRonin", attacker ) + return + case "northstar": + PlayFactionDialogueToPlayer( "kc_pilotkillNorthstar", attacker ) + return + default: + PlayFactionDialogueToPlayer( "kc_pilotkilltitan", attacker ) + return + } +} -- cgit v1.2.3