From f88c62e3635699f489ea193c1f0dca304077137d Mon Sep 17 00:00:00 2001 From: Dan9550 <56kflyingtoaster@gmail.com> Date: Mon, 22 Jul 2013 19:47:04 +1000 Subject: [PATCH 1/5] More improvements to nod01 --- OpenRA.Mods.Cnc/Missions/Nod01Script.cs | 64 +++++++++++++------------ mods/cnc/maps/nod01/map.yaml | 10 ++-- 2 files changed, 38 insertions(+), 36 deletions(-) diff --git a/OpenRA.Mods.Cnc/Missions/Nod01Script.cs b/OpenRA.Mods.Cnc/Missions/Nod01Script.cs index de88d228f9..27b754bc1d 100644 --- a/OpenRA.Mods.Cnc/Missions/Nod01Script.cs +++ b/OpenRA.Mods.Cnc/Missions/Nod01Script.cs @@ -41,7 +41,6 @@ namespace OpenRA.Mods.Cnc.Missions Player gdi; Player nod; - //actors and the likes go here Actor nikoomba; Actor vil01; Actor vil02; @@ -64,17 +63,14 @@ namespace OpenRA.Mods.Cnc.Missions Actor civ06; Actor civ07; - //waypoints Actor nr1; Actor nr2; - Actor gr1; + Actor nr3; World world; - //in the allies01 script stuff was here not needed for me so far - const string NRName = "E1"; - const string GRName = "E2"; - const string GRName2 = "JEEP"; + const string ReInfE1 = "E1"; + const string ReInfE3 = "E3"; void MissionFailed(string text) { @@ -90,7 +86,6 @@ namespace OpenRA.Mods.Cnc.Missions { if (nod.WinState != WinState.Undefined) return; - //spawns nod reinf if (world.FrameNumber == 700) { NODReinforceNthA(); @@ -101,7 +96,7 @@ namespace OpenRA.Mods.Cnc.Missions NODReinforceNthB(); Sound.Play("reinfor1.aud"); } - // objectives + if (killnikoomba.Status == ObjectiveStatus.InProgress) { if (nikoomba.Destroyed) @@ -109,8 +104,8 @@ namespace OpenRA.Mods.Cnc.Missions killnikoomba.Status = ObjectiveStatus.Completed; levelvillage.Status = ObjectiveStatus.InProgress; OnObjectivesUpdated(true); - //DisplayObjective(); - //GDIReinforceNth(); + NODReinforceNWstA(); + Sound.Play("reinfor1.aud"); } } if (levelvillage.Status == ObjectiveStatus.InProgress) @@ -122,41 +117,47 @@ namespace OpenRA.Mods.Cnc.Missions { levelvillage.Status = ObjectiveStatus.Completed; OnObjectivesUpdated(true); + Sound.StopMusic(); MissionAccomplished("Nikoomba was killed and the village was destroyed."); + //does an fmv play at this point? } } - if (!world.Actors.Any(a => (a.Owner == nod) && a.IsInWorld && !a.IsDead())) + if (!world.Actors.Any(a => (a.Owner == nod))) { - MissionFailed("The Nod forces in the area have been wiped out."); + Action afterFMV = () => + { + Sound.StopMusic(); + MissionFailed("The Nod forces in the area have been wiped out."); + }; + Game.RunAfterDelay(0, () => Media.PlayFMVFullscreen(world, "gameover.vqa", afterFMV)); //this is the wrong fmv i believe } } - IEnumerable UnitsNearActor(Actor actor, int range) - { - return world.FindActorsInCircle(actor.CenterPosition, WRange.FromCells(range)) - .Where(a => a.IsInWorld && a != world.WorldActor && !a.Destroyed && a.HasTrait() && !a.Owner.NonCombatant); - } - void NODReinforceNthA() { - nr1 = world.CreateActor(true, NRName, new TypeDictionary { new OwnerInit(nod), new LocationInit(nr1.Location) }); - nr1 = world.CreateActor(true, NRName, new TypeDictionary { new OwnerInit(nod), new LocationInit(nr1.Location) }); + nr1 = world.CreateActor(true, ReInfE1, new TypeDictionary { new OwnerInit(nod), new LocationInit(nr1.Location) }); + nr1.QueueActivity(nr1.Trait().ScriptedMove(nr1.Location - new CVec(0, -2))); + nr1 = world.CreateActor(true, ReInfE1, new TypeDictionary { new OwnerInit(nod), new LocationInit(nr1.Location) }); + nr1.QueueActivity(nr1.Trait().ScriptedMove(nr1.Location - new CVec(0, -2))); } void NODReinforceNthB() { - nr2 = world.CreateActor(true, NRName, new TypeDictionary { new OwnerInit(nod), new LocationInit(nr2.Location) }); - nr2 = world.CreateActor(true, NRName, new TypeDictionary { new OwnerInit(nod), new LocationInit(nr2.Location) }); - //nr1.QueueActivity(new Move.Move(nr1.Location - new CVec(0, 2))); + nr2 = world.CreateActor(true, ReInfE1, new TypeDictionary { new OwnerInit(nod), new LocationInit(nr2.Location) }); + nr2.QueueActivity(nr2.Trait().ScriptedMove(nr2.Location - new CVec(0, -2))); + nr2 = world.CreateActor(true, ReInfE1, new TypeDictionary { new OwnerInit(nod), new LocationInit(nr2.Location) }); + nr2.QueueActivity(nr2.Trait().ScriptedMove(nr2.Location - new CVec(0, -2))); } - void GDIReinforceNth() + void NODReinforceNWstA() { - gr1 = world.CreateActor(true, GRName, new TypeDictionary { new OwnerInit(gdi), new LocationInit(gr1.Location) }); - gr1 = world.CreateActor(true, GRName, new TypeDictionary { new OwnerInit(gdi), new LocationInit(gr1.Location) }); - gr1 = world.CreateActor(true, GRName2, new TypeDictionary { new OwnerInit(gdi), new LocationInit(gr1.Location) }); - //gr1.QueueActivity(new Move.Move(nr1.Location - new CVec(0, 2))); + nr3 = world.CreateActor(true, ReInfE3, new TypeDictionary { new OwnerInit(nod), new LocationInit(nr3.Location) }); + nr3.QueueActivity(nr3.Trait().ScriptedMove(nr3.Location - new CVec(0, -5))); + nr3 = world.CreateActor(true, ReInfE3, new TypeDictionary { new OwnerInit(nod), new LocationInit(nr3.Location) }); + nr3.QueueActivity(nr3.Trait().ScriptedMove(nr3.Location - new CVec(0, -5))); + nr3 = world.CreateActor(true, ReInfE3, new TypeDictionary { new OwnerInit(nod), new LocationInit(nr3.Location) }); + nr3.QueueActivity(nr3.Trait().ScriptedMove(nr3.Location - new CVec(0, -5))); } public void WorldLoaded(World w) @@ -164,6 +165,7 @@ namespace OpenRA.Mods.Cnc.Missions world = w; gdi = w.Players.Single(p => p.InternalName == "GDI"); nod = w.Players.Single(p => p.InternalName == "NOD"); + nod.PlayerActor.Trait().Cash = 0; var actors = w.WorldActor.Trait().Actors; nikoomba = actors["Nikoomba"]; vil01 = actors["Vil01"]; @@ -188,11 +190,11 @@ namespace OpenRA.Mods.Cnc.Missions civ07 = actors["Civ07"]; nr1 = actors["NODReinforceNthA"]; nr2 = actors["NODReinforceNthB"]; - gr1 = actors["GDIReinforceNth"]; + nr3 = actors["NODReinforceNWstA"]; Game.MoveViewport(nr1.Location.ToFloat2()); Action afterFMV = () => { - Sound.PlayMusic(Rules.Music["aoi"]); + MissionUtils.PlayMissionMusic(); }; Game.RunAfterDelay(0, () => Media.PlayFMVFullscreen(w, "nod1pre.vqa", () => Media.PlayFMVFullscreen(w, "nod1.vqa", afterFMV))); diff --git a/mods/cnc/maps/nod01/map.yaml b/mods/cnc/maps/nod01/map.yaml index ec171cb53b..9c0e8c69ac 100644 --- a/mods/cnc/maps/nod01/map.yaml +++ b/mods/cnc/maps/nod01/map.yaml @@ -266,13 +266,13 @@ Actors: Location: 54,16 Owner: NOD NODReinforceNthA: waypoint - Location: 52,18 + Location: 52,14 + Owner: NOD + NODReinforceNWstA: waypoint + Location: 24,14 Owner: NOD - GDIReinforceNth: waypoint - Location: 24,15 - Owner: GDI NODReinforceNthB: waypoint - Location: 55,18 + Location: 56,14 Owner: NOD Actor27: jeep Location: 31,28 From d59a1af2727b434e688b8c44943f52c7463b0415 Mon Sep 17 00:00:00 2001 From: Dan9550 <56kflyingtoaster@gmail.com> Date: Wed, 24 Jul 2013 23:46:16 +1000 Subject: [PATCH 2/5] tweaks and such, nod01 --- OpenRA.Mods.Cnc/Missions/Nod01Script.cs | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/OpenRA.Mods.Cnc/Missions/Nod01Script.cs b/OpenRA.Mods.Cnc/Missions/Nod01Script.cs index 27b754bc1d..86f3e7b6e7 100644 --- a/OpenRA.Mods.Cnc/Missions/Nod01Script.cs +++ b/OpenRA.Mods.Cnc/Missions/Nod01Script.cs @@ -38,7 +38,6 @@ namespace OpenRA.Mods.Cnc.Missions const string KillNikoombaText = "Find Nikoomba. Once found he must be assasinated."; const string LevelVillageText = "Nikoomba has met his demise, now level the village."; - Player gdi; Player nod; Actor nikoomba; @@ -121,9 +120,9 @@ namespace OpenRA.Mods.Cnc.Missions MissionAccomplished("Nikoomba was killed and the village was destroyed."); //does an fmv play at this point? } - } - - if (!world.Actors.Any(a => (a.Owner == nod))) + } + + if (!world.Actors.Any(a => (a.Owner == nod) && a.IsInWorld && !a.IsDead())) { Action afterFMV = () => { @@ -163,7 +162,6 @@ namespace OpenRA.Mods.Cnc.Missions public void WorldLoaded(World w) { world = w; - gdi = w.Players.Single(p => p.InternalName == "GDI"); nod = w.Players.Single(p => p.InternalName == "NOD"); nod.PlayerActor.Trait().Cash = 0; var actors = w.WorldActor.Trait().Actors; From ea5f4d9029ec525f5521324be9e9bc3ea6bf0ba1 Mon Sep 17 00:00:00 2001 From: Dan9550 <56kflyingtoaster@gmail.com> Date: Thu, 25 Jul 2013 05:08:09 +1000 Subject: [PATCH 3/5] corrected lose fmv nod01 --- OpenRA.Mods.Cnc/Missions/Nod01Script.cs | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/OpenRA.Mods.Cnc/Missions/Nod01Script.cs b/OpenRA.Mods.Cnc/Missions/Nod01Script.cs index 86f3e7b6e7..9fa925cd9a 100644 --- a/OpenRA.Mods.Cnc/Missions/Nod01Script.cs +++ b/OpenRA.Mods.Cnc/Missions/Nod01Script.cs @@ -118,10 +118,9 @@ namespace OpenRA.Mods.Cnc.Missions OnObjectivesUpdated(true); Sound.StopMusic(); MissionAccomplished("Nikoomba was killed and the village was destroyed."); - //does an fmv play at this point? } - } - + } + if (!world.Actors.Any(a => (a.Owner == nod) && a.IsInWorld && !a.IsDead())) { Action afterFMV = () => @@ -129,7 +128,7 @@ namespace OpenRA.Mods.Cnc.Missions Sound.StopMusic(); MissionFailed("The Nod forces in the area have been wiped out."); }; - Game.RunAfterDelay(0, () => Media.PlayFMVFullscreen(world, "gameover.vqa", afterFMV)); //this is the wrong fmv i believe + Game.RunAfterDelay(0, () => Media.PlayFMVFullscreen(world, "nodlose.vqa", afterFMV)); } } From b75ad65493f601518a6fd9ced90dc21f0880dfea Mon Sep 17 00:00:00 2001 From: Dan9550 <56kflyingtoaster@gmail.com> Date: Thu, 25 Jul 2013 06:57:09 +1000 Subject: [PATCH 4/5] fixed strange indentation nod01 --- OpenRA.Mods.Cnc/Missions/Nod01Script.cs | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/OpenRA.Mods.Cnc/Missions/Nod01Script.cs b/OpenRA.Mods.Cnc/Missions/Nod01Script.cs index 9fa925cd9a..15518925e9 100644 --- a/OpenRA.Mods.Cnc/Missions/Nod01Script.cs +++ b/OpenRA.Mods.Cnc/Missions/Nod01Script.cs @@ -122,13 +122,13 @@ namespace OpenRA.Mods.Cnc.Missions } if (!world.Actors.Any(a => (a.Owner == nod) && a.IsInWorld && !a.IsDead())) - { - Action afterFMV = () => - { - Sound.StopMusic(); - MissionFailed("The Nod forces in the area have been wiped out."); - }; - Game.RunAfterDelay(0, () => Media.PlayFMVFullscreen(world, "nodlose.vqa", afterFMV)); + { + Action afterFMV = () => + { + Sound.StopMusic(); + MissionFailed("The Nod forces in the area have been wiped out."); + }; + Game.RunAfterDelay(0, () => Media.PlayFMVFullscreen(world, "nodlose.vqa", afterFMV)); } } From 0657abd51b0804171aa7a150ea87e7ffec6d6499 Mon Sep 17 00:00:00 2001 From: Dan9550 <56kflyingtoaster@gmail.com> Date: Fri, 26 Jul 2013 06:25:35 +1000 Subject: [PATCH 5/5] Fixed nod01, not being able to lose mission --- OpenRA.Mods.Cnc/Missions/Nod01Script.cs | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/OpenRA.Mods.Cnc/Missions/Nod01Script.cs b/OpenRA.Mods.Cnc/Missions/Nod01Script.cs index 15518925e9..0fa3cfaa12 100644 --- a/OpenRA.Mods.Cnc/Missions/Nod01Script.cs +++ b/OpenRA.Mods.Cnc/Missions/Nod01Script.cs @@ -121,13 +121,15 @@ namespace OpenRA.Mods.Cnc.Missions } } - if (!world.Actors.Any(a => (a.Owner == nod) && a.IsInWorld && !a.IsDead())) - { - Action afterFMV = () => - { - Sound.StopMusic(); - MissionFailed("The Nod forces in the area have been wiped out."); - }; + var unitsAndBuildings = world.Actors.Where(a => !a.IsDead() && a.IsInWorld && (a.HasTrait() || (a.HasTrait() && !a.HasTrait()))); + + if (!unitsAndBuildings.Any(a => a.Owner == nod)) + { + Action afterFMV = () => + { + Sound.StopMusic(); + MissionFailed("The Nod forces in the area have been wiped out."); + }; Game.RunAfterDelay(0, () => Media.PlayFMVFullscreen(world, "nodlose.vqa", afterFMV)); } }