Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added Music and Dialogue Event #469

Merged
merged 9 commits into from Oct 21, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
91 changes: 91 additions & 0 deletions Northstar.CustomServers/mod/scripts/vscripts/mp/_gamestate_mp.nut
Original file line number Diff line number Diff line change
Expand Up @@ -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?
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -871,3 +875,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 )
}
}
42 changes: 42 additions & 0 deletions Northstar.CustomServers/mod/scripts/vscripts/mp/_score.nut
Original file line number Diff line number Diff line change
Expand Up @@ -205,6 +205,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 )
Expand Down Expand Up @@ -251,3 +254,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
}
}