diff --git a/LastManStanding.Script.txt b/LastManStanding.Script.txt index 8f8c994..69622e4 100644 --- a/LastManStanding.Script.txt +++ b/LastManStanding.Script.txt @@ -47,7 +47,7 @@ #Const Description "$zIn $<$t$6F9LastManStanding$> mode, The goal is to be the last player not to fall off the structure. Collisions are activated and you can push your opponents to win. From a certain time, malus are sent to all the players of the game to accelerate its end." #Const C_HudModulePath "" //< Path to the hud module -#Const C_ManiaAppUrl "file://Media/ManiaApps/Nadeo/TMNext/TrackMania/Rounds/Rounds.Script.txt" //< Url of the mania app +#Const C_ManiaAppUrl "file://Media/ManiaApps/Nadeo/Trackmania/Modes/Rounds.Script.txt" //< Url of the mania app #Const C_FakeUsersNb 0 #Const C_Malus_Reset 0 diff --git a/TM_Alfadream.Script.txt b/TM_Alfadream.Script.txt new file mode 100644 index 0000000..8e57f0d --- /dev/null +++ b/TM_Alfadream.Script.txt @@ -0,0 +1,248 @@ +#Extends "Modes/TrackMania/TM_Cup_Online.Script.txt" + +#Setting S_PointsLimit 50 +#Setting S_RoundsPerMap 4 +#Setting S_PointsRepartition "10,6,4,3,0" +#Setting S_PlayersPerMatch 12 + +#Const C_ML_TeamPicker "Custom_TeamPicker" + +***Match_StartServer*** +*** +Clans::SetClansNb(6); +Clans::SetUseForcedClans(True); +WarmUp::SetSpawnInRequestedClan(False); // Must be disabled because Clans are forced +*** + +***Match_StartMatch*** +*** +declare netwrite Integer[Text] Net_Custom_PlayersClan for Teams[0] ; +Net_Custom_PlayersClan = []; + +Teams[2].Name = "Cyan"; +Teams[3].Name = "Pink"; +Teams[4].Name = "Yellow"; +Teams[5].Name = "Green"; +*** + + +***Match_InitMap*** +*** +log(Dbg_DumpDeclareForVariables(This, False)); + +Users_SetNbFakeUsers(11,0); +if (GetPlayersNb() < S_PlayersPerMatch) { + SendPickManialink(); + declare netwrite Integer[Text] Net_Custom_PlayersClan for Teams[0] = []; + + foreach (Player in AllPlayers) { + if (Player.IsFakePlayer) { + Net_Custom_PlayersClan[Player.User.WebServicesUserId] = ML::Rand(1,6); + Player.Score.LadderClan = Net_Custom_PlayersClan[Player.User.WebServicesUserId]; + } + } + + + while (GetPlayersNb() < S_PlayersPerMatch) { + MB_Yield(); + + foreach (Event in UIManager.PendingEvents) { + if (Event.Type == CUIConfigEvent::EType::OnLayerCustomEvent && Event.CustomEventType == "Custom_Join_Clan") { + declare CSmPlayer Player = GetPlayer(Event.UI); + if (Player != Null) { + Net_Custom_PlayersClan[Player.User.WebServicesUserId] = TL::ToInteger(Event.CustomEventData[0]); + Player.Score.LadderClan = Net_Custom_PlayersClan[Player.User.WebServicesUserId]; + SetPlayerClan(Player, Net_Custom_PlayersClan[Player.User.WebServicesUserId]); + } + } + } + } + + Layers::Detach(C_ML_TeamPicker); +} +declare Int2[] Custom_RoundsVersus for This = []; +Custom_RoundsVersus = GenerateRoundVersus(); +*** + + +***Match_InitRound*** +*** +declare Integer Custom_NbOfValidRounds for This = 0; +Custom_NbOfValidRounds = G_NbOfValidRounds; +declare Int2[] Custom_RoundsVersus for This = []; +if (Custom_NbOfValidRounds >= 3) { + UIModules_BigMessage::SetMessage("All teams play"); +} else { + declare CTeam Team1 <=> Teams[Custom_RoundsVersus[Custom_NbOfValidRounds].X - 1]; + declare CTeam Team2 <=> Teams[Custom_RoundsVersus[Custom_NbOfValidRounds].Y - 1]; + + UIModules_BigMessage::SetMessage(Team1.Name ^ " vs " ^ Team2.Name); +} +MB_Sleep(3000); +UIModules_BigMessage::SetMessage(""); +*** + +***Match_Yield*** +*** +foreach (Event in PendingEvents) { + if (Event.Type == CSmModeEvent::EType::OnPlayerAdded) { + declare netwrite Integer[Text] Net_Custom_PlayersClan for Teams[0] = []; + if (Net_Custom_PlayersClan.existskey(Event.Player.User.WebServicesUserId)) { + Event.Player.Score.LadderClan = Net_Custom_PlayersClan[Event.Player.User.WebServicesUserId]; + SetPlayerClan(Event.Player, Net_Custom_PlayersClan[Event.Player.User.WebServicesUserId]); + } + } +} +*** + +***Rounds_SpawnPlayer*** +*** +SetPlayerClan(Player, Player.Score.LadderClan); +Race::Start(Player, StartTime); +*** + + +***Rounds_CheckCanSpawn*** +*** + +declare netwrite Integer[Text] Net_Custom_PlayersClan for Teams[0] = []; +if (!Net_Custom_PlayersClan.existskey(_Player.Score.User.WebServicesUserId)) return False; +// TODO Team can spawn +declare Integer Custom_NbOfValidRounds for This = 0; +if (Custom_NbOfValidRounds <= 2) { + declare Int2[] Custom_RoundsVersus for This = []; + if (Custom_RoundsVersus.existskey(Custom_NbOfValidRounds)) { + if (Custom_RoundsVersus[Custom_NbOfValidRounds].X != Net_Custom_PlayersClan[_Player.Score.User.WebServicesUserId] + && Custom_RoundsVersus[Custom_NbOfValidRounds].Y != Net_Custom_PlayersClan[_Player.Score.User.WebServicesUserId]) { + return False; + } + } +} +log(_Player.Score.User.Name ^" " ^_Player.Score.LadderClan); +*** + +Integer GetPlayersNb() { + declare netwrite Integer[Text] Net_Custom_PlayersClan for Teams[0] = []; + return Net_Custom_PlayersClan.count; +} + +Int2[] GenerateRoundVersus() { + declare Integer[Integer] SortingTeam; + for (I, 1, 6) { + SortingTeam[I] = ML::Rand(0, 10000); + } + + SortingTeam = SortingTeam.sort(); + + declare Integer[] SortedTeam; + + foreach (ClanId => Rand in SortingTeam.sort()) { + SortedTeam.add(ClanId); + } + + declare Int2[] RoundOrder; + for (I, 0, 2) { + RoundOrder.add(); + } + return RoundOrder; +} + +Void SendPickManialink() { + declare Text Manialink = """ + + + +