From f806c470fa4eafe0ceb2af738340907ec65e0188 Mon Sep 17 00:00:00 2001 From: Beu Date: Wed, 16 Feb 2022 00:59:43 +0100 Subject: [PATCH 1/4] Add bonus points for finishers --- TM_RoyalRounds_Online.Script.txt | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/TM_RoyalRounds_Online.Script.txt b/TM_RoyalRounds_Online.Script.txt index e65f821..099a0b7 100644 --- a/TM_RoyalRounds_Online.Script.txt +++ b/TM_RoyalRounds_Online.Script.txt @@ -36,6 +36,8 @@ #Setting S_StrictPointDistribution False as "Give points only to players who complete all segments" #Setting S_AllowCam7DuringWaitingScreen False as "" #Setting S_RoundWaitingScreenDuration 20 as _("Round waiting screen duration") //< Maximum time spent waiting for players at the beginning of each round +#Setting S_FinisherBonusBase 5 as "Base of Bonus for finishers" +#Setting S_FinisherBonusNumber 10 as "if only one player finish, they get S_FinisherBonusBase x This value. if 2, it's This - 1, etc..." #Setting S_WarmUpNb 0 as _("Number of warm up") #Setting S_WarmUpDuration 0 as _("Duration of one warm up") @@ -211,7 +213,7 @@ if (WaitingScreenDuration >= 0) { // If all players are connected before the end of the countdown start immediatly declare Integer WaitEndTime = Now + (WaitingScreenDuration * 1000); - while (S_RoundWaitingScreenDuration - WaitingScreenDuration > 0) { + while (MB_MapIsRunning() && S_RoundWaitingScreenDuration - WaitingScreenDuration > 0) { if (S_RoundWaitingScreenDuration - WaitingScreenDuration > 3) { UIModules_BigMessage::SetMessage("""The map starts in {{{S_RoundWaitingScreenDuration - WaitingScreenDuration}}} seconds"""); } else { @@ -328,7 +330,7 @@ CurrentRanking[0] = Integer[Text]; // Init white section declare Boolean IsStartRound = True; // Reset players for the race -foreach (Score in Scores) { // TODO Change segment for spectators alwell (Test if change works) +foreach (Score in Scores) { declare Integer CurrentSegment for Score = -1; CurrentSegment = 1; CurrentRanking[0][Score.User.WebServicesUserId] = 0; @@ -656,18 +658,28 @@ Integer GetFinishTimeout(Integer _FinishTimeout) { } } + declare Integer BonusForFinishers = 0; + if (S_FinisherBonusBase > 0 && S_FinisherBonusNumber > 0 && CurrentRanking.existskey(S_SegmentsPerRound)) { + BonusForFinishers = S_FinisherBonusBase * (S_FinisherBonusNumber + 1 - CurrentRanking[S_SegmentsPerRound].count); + } + if (PointsRepartition.count > 0) { CustomTimes = CustomTimes.sort(); declare Integer I = 0; - foreach (ID => Time in CustomTimes) { - declare CSmPlayer Player = ModeUtils::GetPlayerFromAccountId(ID); + foreach (AccountId => DummyVar in CustomTimes) { + declare CSmPlayer Player = ModeUtils::GetPlayerFromAccountId(AccountId); if (Player == Null) continue; + declare Integer Points = 0; if (PointsRepartition.existskey(I)) { Points = PointsRepartition[I]; } else { Points = PointsRepartition[PointsRepartition.count - 1]; } + declare Integer CurrentSegment for Player.Score; + if (CurrentSegment == S_SegmentsPerRound) { + Points += BonusForFinishers; + } Scores::SetPlayerRoundPoints(Player.Score, Points); I += 1; } From 433b98fdb5e77f314c68d9f3bc6671b1ce2b0ebb Mon Sep 17 00:00:00 2001 From: Beu Date: Wed, 16 Feb 2022 01:09:06 +0100 Subject: [PATCH 2/4] Keep displayed the Checkpoint UI if the player skip the outro --- TM_RoyalRounds_Online.Script.txt | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/TM_RoyalRounds_Online.Script.txt b/TM_RoyalRounds_Online.Script.txt index 099a0b7..63ef32e 100644 --- a/TM_RoyalRounds_Online.Script.txt +++ b/TM_RoyalRounds_Online.Script.txt @@ -790,7 +790,7 @@ Boolean MapIsOver(Boolean _UseTieBreak, Integer _PointsLimit, Integer _ValidRoun #Include "TextLib" as TL main() { - declare Integer TimeToDisplay = 0; + declare Ident Last_GUIPlayerId; declare Integer LastUpdate = 0; declare Frame_Global <=> (Page.GetFirstChild("frame-global") as CMlFrame); @@ -815,20 +815,19 @@ Boolean MapIsOver(Boolean _UseTieBreak, Integer _PointsLimit, Integer _ValidRoun Label_Time.Value = TL::TimeToText(GUIPlayer.RaceWaypointTimes[0], True, True); Label_Rank.Value = TL::FormatRank(Net_RoyalRounds_CheckpointUI_Rank, False); Label_Segments.Value = TL::Compose("Segment %1/%2", TL::ToText(Net_RoyalRounds_CheckpointUI_CurrentNbSegments), TL::ToText(Net_RoyalRounds_CheckpointUI_TotalNbSegments)); + Frame_Global.Visible = True; - TimeToDisplay = Now + 3000; - } else { - TimeToDisplay = -1; // Force hide UI + AnimMgr.Flush(Frame_Global); + AnimMgr.Add(Frame_Global, "", Now, 3000, CAnimManager::EAnimManagerEasing::Linear); } } - - if (TimeToDisplay != 0 && TimeToDisplay < Now) { - Frame_Global.Visible = False; - TimeToDisplay = 0; + if (Last_GUIPlayerId != GUIPlayer.Id) { + Last_GUIPlayerId = GUIPlayer.Id; + if (Frame_Global.Visible) { + AnimMgr.Flush(Frame_Global); + Frame_Global.Visible = False; + } } - } else if (Frame_Global.Visible) { - Frame_Global.Visible = False; - TimeToDisplay = 0; } } } From 34fae09cd5343bd913b77420110d27efc2d242b8 Mon Sep 17 00:00:00 2001 From: Beu Date: Wed, 16 Feb 2022 10:54:03 +0100 Subject: [PATCH 3/4] Add Chat message --- TM_RoyalRounds_Online.Script.txt | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/TM_RoyalRounds_Online.Script.txt b/TM_RoyalRounds_Online.Script.txt index b62a796..73a3948 100644 --- a/TM_RoyalRounds_Online.Script.txt +++ b/TM_RoyalRounds_Online.Script.txt @@ -156,7 +156,6 @@ Clans::SetClansNb(0); Scores::SaveInScore(Scores::C_Points_Match); StateMgr::ForcePlayersStates([StateMgr::C_State_Waiting]); UsePvECollisions = False; //< Synchronize obstacles between all players -WarmUp::SetAvailability(False); // (Impossible at the moment https://forum.nadeo.com/viewtopic.php?f=51&p=8745#p8745) Race::UseAutomaticDossardColor(False); Server_PointsLimit = S_PointsLimit - 1; @@ -660,7 +659,10 @@ Integer GetFinishTimeout(Integer _FinishTimeout) { declare Integer BonusForFinishers = 0; if (S_FinisherBonusBase > 0 && S_FinisherBonusNumber > 0 && CurrentRanking.existskey(S_SegmentsPerRound)) { - BonusForFinishers = S_FinisherBonusBase * (S_FinisherBonusNumber + 1 - CurrentRanking[S_SegmentsPerRound].count); + BonusForFinishers = ML::Max(0, S_FinisherBonusBase * (S_FinisherBonusNumber + 1 - CurrentRanking[S_SegmentsPerRound].count)); + if (_Player == Null && BonusForFinishers > 0) {// If End round + UIManager.UIAll.SendChat("$<$ff3$> " ^ CurrentRanking[S_SegmentsPerRound].count ^ " players received " ^ BonusForFinishers ^ " bonus points for being the only finishers" ); + } } if (PointsRepartition.count > 0) { From 3743ae496c3576d9b1286d71399fae712c3480e5 Mon Sep 17 00:00:00 2001 From: Beu Date: Sun, 27 Feb 2022 10:21:11 +0100 Subject: [PATCH 4/4] Add Winner message after the match --- TM_TimeAttackRounds_Online.Script.txt | 2 -- 1 file changed, 2 deletions(-) diff --git a/TM_TimeAttackRounds_Online.Script.txt b/TM_TimeAttackRounds_Online.Script.txt index 3a8d565..3ab622b 100644 --- a/TM_TimeAttackRounds_Online.Script.txt +++ b/TM_TimeAttackRounds_Online.Script.txt @@ -92,7 +92,6 @@ StateMgr::Unload(); *** MB_Settings_UseDefaultTimer = False; MB_Settings_UseDefaultHud = (C_HudModulePath == ""); -MB_Settings_UseDefaultPodiumSequence = False; *** ***Match_Rules*** @@ -394,7 +393,6 @@ if (Round_ForceEndRound || Round_SkipPauseRound || Round_Skipped) { *** EndTime = -1; - Scores::SetPlayerWinner(Scores::GetBestPlayer(Scores::C_Sort_MatchPoints)); Match_MatchDuration = ML::Max(0, Now - Map_MapStartTime);