From 9ff69b794664df64a58b7605ab5e102154a731d3 Mon Sep 17 00:00:00 2001 From: ScottNZ Date: Thu, 21 Jun 2012 22:53:20 +1200 Subject: [PATCH] Add EVA voices Use new WaitFor when waiting for Einstein Have a small delay before the Soviets counterattack Have the Soviets Attack-Move towards Einstein during the counterattack, this makes them much more damaging Spawn the signal flare only after Einstein has been spawned, also add EVA voice for this --- OpenRA.Mods.RA/Missions/Allies01Script.cs | 443 +++++++++++----------- mods/ra/maps/allies-01.oramap | Bin 2713 -> 2705 bytes 2 files changed, 222 insertions(+), 221 deletions(-) diff --git a/OpenRA.Mods.RA/Missions/Allies01Script.cs b/OpenRA.Mods.RA/Missions/Allies01Script.cs index 9712484eb0..6918919566 100644 --- a/OpenRA.Mods.RA/Missions/Allies01Script.cs +++ b/OpenRA.Mods.RA/Missions/Allies01Script.cs @@ -19,253 +19,254 @@ using OpenRA.Traits; namespace OpenRA.Mods.RA.Missions { - public class Allies01ScriptInfo : TraitInfo, Requires { } + public class Allies01ScriptInfo : TraitInfo, Requires { } - public class Allies01Script : IWorldLoaded, ITick - { - private string[] objectives = + public class Allies01Script : IWorldLoaded, ITick + { + private static readonly string[] objectives = { "Find Einstein.", "Wait for the helicopter and extract Einstein." }; - private int currentObjective; + private int currentObjective; - private Player allies; - private Player soviets; + private Player allies; + private Player soviets; - private ISound music; + private ISound music; - private Actor insertionLZ; - private Actor extractionLZ; - private Actor lab; - private Actor insertionLZEntryPoint; - private Actor extractionLZEntryPoint; - private Actor chinookExitPoint; - private Actor shipSpawnPoint; - private Actor shipMovePoint; - private Actor einstein; - private Actor einsteinChinook; - private Actor tanya; - private Actor attackEntryPoint1; - private Actor attackEntryPoint2; + private Actor insertionLZ; + private Actor extractionLZ; + private Actor lab; + private Actor insertionLZEntryPoint; + private Actor extractionLZEntryPoint; + private Actor chinookExitPoint; + private Actor shipSpawnPoint; + private Actor shipMovePoint; + private Actor einstein; + private Actor einsteinChinook; + private Actor tanya; + private Actor attackEntryPoint1; + private Actor attackEntryPoint2; - private static readonly string[] taunts = { "laugh1.aud", "lefty1.aud", "cmon1.aud", "gotit1.aud" }; + private static readonly string[] taunts = { "laugh1.aud", "lefty1.aud", "cmon1.aud", "gotit1.aud" }; - private static readonly string[] ships = { "ca", "ca", "ca", "ca" }; + private static readonly string[] ships = { "ca", "ca", "ca", "ca" }; - private static readonly string[] attackWave = { "e1", "e1", "e1", "e1", "e2", "e2", "e2", "e2", "dog" }; - private int currentAttackWaveFrameNumber = -600; - private int currentAttackWave; - private const int einsteinChinookArrivesAtAttackWave = 5; + private static readonly string[] attackWave = { "e1", "e1", "e1", "e1", "e2", "e2", "e2", "e2", "dog" }; + private int currentAttackWaveFrameNumber; + private int currentAttackWave; + private const int einsteinChinookArrivesAtAttackWave = 5; - private const int labRange = 5; - private const string einsteinName = "c1"; - private const string tanyaName = "e7"; - private const string chinookName = "tran"; + private const int labRange = 5; + private const string einsteinName = "c1"; + private const string tanyaName = "e7"; + private const string chinookName = "tran"; + private const string signalFlareName = "flare"; - private void NextObjective() - { - currentObjective++; - } + private void NextObjective() + { + currentObjective++; + } - private void DisplayObjective() - { - Game.AddChatLine(Color.LimeGreen, "Objective", objectives[currentObjective]); - } + private void DisplayObjective() + { + Game.AddChatLine(Color.LimeGreen, "Objective", objectives[currentObjective]); + } - private void MissionFailed(Actor self, string text) - { - if (allies.WinState != WinState.Undefined) - { - return; - } - allies.WinState = WinState.Lost; - Game.AddChatLine(Color.Red, "Mission failed", text); - foreach (var actor in self.World.Actors.Where(a => a.Owner == allies)) - { - actor.Kill(actor); - } - self.World.LocalShroud.Disabled = true; - } + private void MissionFailed(Actor self, string text) + { + if (allies.WinState != WinState.Undefined) + { + return; + } + allies.WinState = WinState.Lost; + Game.AddChatLine(Color.Red, "Mission failed", text); + foreach (var actor in self.World.Actors.Where(a => a.Owner == allies)) + { + actor.Kill(actor); + } + self.World.LocalShroud.Disabled = true; + Sound.Play("misnlst1.aud", 5); + } - private void MissionAccomplished(Actor self, string text) - { - if (allies.WinState != WinState.Undefined) - { - return; - } - allies.WinState = WinState.Won; - Game.AddChatLine(Color.Blue, "Mission accomplished", text); - self.World.LocalShroud.Disabled = true; - } + private void MissionAccomplished(Actor self, string text) + { + if (allies.WinState != WinState.Undefined) + { + return; + } + allies.WinState = WinState.Won; + Game.AddChatLine(Color.Blue, "Mission accomplished", text); + self.World.LocalShroud.Disabled = true; + Sound.Play("misnwon1.aud", 5); + } - public void Tick(Actor self) - { - if (allies.WinState != WinState.Undefined) - { - return; - } - // display current objective every so often - if (self.World.FrameNumber % 1500 == 1) - { - DisplayObjective(); - } - // taunt every so often - if (self.World.FrameNumber % 1000 == 0) - { - Sound.Play(taunts[self.World.SharedRandom.Next(taunts.Length)]); - } - // take Tanya to the LZ - if (self.World.FrameNumber == 1) - { - FlyTanyaToInsertionLZ(self); - } - // objectives - if (currentObjective == 0) - { - if (AlliesControlLab(self)) - { - SpawnEinsteinAtLab(self); // spawn Einstein once the area is clear - Sound.Play("einok1.aud"); // "Incredible!" - Einstein - SendShips(self); - NextObjective(); - DisplayObjective(); - } - if (lab.Destroyed) - { - MissionFailed(self, "Einstein was killed."); - } - } - else if (currentObjective == 1) - { - if (self.World.FrameNumber >= currentAttackWaveFrameNumber + 600) - { - SendAttackWave(self, attackWave); - currentAttackWave++; - currentAttackWaveFrameNumber = self.World.FrameNumber; - if (currentAttackWave == einsteinChinookArrivesAtAttackWave) - { - FlyToExtractionLZ(self); - } - } - if (einsteinChinook != null) - { - if (einsteinChinook.Trait().Passengers.Contains(einstein)) - { - FlyEinsteinFromExtractionLZ(); - } - if (!self.World.Map.IsInMap(einsteinChinook.Location) && !einstein.IsInWorld) - { - MissionAccomplished(self, "Einstein was rescued."); - } - } - if (einstein.Destroyed) - { - MissionFailed(self, "Einstein was killed."); - } - } - if (tanya.Destroyed) - { - MissionFailed(self, "Tanya was killed."); - } - } + public void Tick(Actor self) + { + if (allies.WinState != WinState.Undefined) + { + return; + } + // display current objective every so often + if (self.World.FrameNumber % 1500 == 1) + { + DisplayObjective(); + } + // taunt every so often + if (self.World.FrameNumber % 1000 == 0) + { + Sound.Play(taunts[self.World.SharedRandom.Next(taunts.Length)]); + } + // take Tanya to the LZ + if (self.World.FrameNumber == 1) + { + FlyTanyaToInsertionLZ(self); + } + // objectives + if (currentObjective == 0) + { + if (AlliesControlLab(self)) + { + SpawnSignalFlare(self); + Sound.Play("flaren1.aud", 5); + SpawnEinsteinAtLab(self); // spawn Einstein once the area is clear + Sound.Play("einok1.aud"); // "Incredible!" - Einstein + SendShips(self); + NextObjective(); + DisplayObjective(); + currentAttackWaveFrameNumber = self.World.FrameNumber; + } + if (lab.Destroyed) + { + MissionFailed(self, "Einstein was killed."); + } + } + else if (currentObjective == 1) + { + if (self.World.FrameNumber >= currentAttackWaveFrameNumber + 600) + { + Sound.Play("enmyapp1.aud", 5); + SendAttackWave(self, attackWave); + currentAttackWave++; + currentAttackWaveFrameNumber = self.World.FrameNumber; + if (currentAttackWave == einsteinChinookArrivesAtAttackWave) + { + FlyEinsteinFromExtractionLZ(self); + } + } + if (einsteinChinook != null && !self.World.Map.IsInMap(einsteinChinook.Location) && !einstein.IsInWorld) + { + MissionAccomplished(self, "Einstein was rescued."); + } + if (einstein.Destroyed) + { + MissionFailed(self, "Einstein was killed."); + } + } + if (tanya.Destroyed) + { + MissionFailed(self, "Tanya was killed."); + } + } - private void SendAttackWave(Actor self, IEnumerable wave) - { - foreach (var unit in wave) - { - var spawnActor = self.World.SharedRandom.Next(2) == 0 ? attackEntryPoint1 : attackEntryPoint2; - var targetActor = self.World.SharedRandom.Next(2) == 0 ? einstein : tanya; - var actor = self.World.CreateActor(unit, new TypeDictionary { new OwnerInit(soviets), new LocationInit(spawnActor.Location) }); - actor.QueueActivity(new Attack(Target.FromActor(targetActor), 2)); - } - } + private void SpawnSignalFlare(Actor self) + { + self.World.CreateActor(signalFlareName, new TypeDictionary { new OwnerInit(allies), new LocationInit(extractionLZ.Location) }); + } - private IEnumerable UnitsNearActor(Actor self, Actor actor, int range) - { - return self.World.FindUnitsInCircle(actor.CenterLocation, Game.CellSize * range) - .Where(a => a.IsInWorld && a != self.World.WorldActor && !a.Destroyed && a.HasTrait() && !a.Owner.NonCombatant); - } + private void SendAttackWave(Actor self, IEnumerable wave) + { + foreach (var unit in wave) + { + var spawnActor = self.World.SharedRandom.Next(2) == 0 ? attackEntryPoint1 : attackEntryPoint2; + var actor = self.World.CreateActor(unit, new TypeDictionary { new OwnerInit(soviets), new LocationInit(spawnActor.Location) }); + actor.QueueActivity(new AttackMove.AttackMoveActivity(actor, new Attack(Target.FromActor(einstein), 3))); // better way of doing this? + } + } - private bool AlliesControlLab(Actor self) - { - var units = UnitsNearActor(self, lab, labRange); - return units.Count() >= 1 && units.All(a => a.Owner == allies); - } + private IEnumerable UnitsNearActor(Actor self, Actor actor, int range) + { + return self.World.FindUnitsInCircle(actor.CenterLocation, Game.CellSize * range) + .Where(a => a.IsInWorld && a != self.World.WorldActor && !a.Destroyed && a.HasTrait() && !a.Owner.NonCombatant); + } - private void SpawnEinsteinAtLab(Actor self) - { - einstein = self.World.CreateActor(einsteinName, new TypeDictionary { new OwnerInit(allies), new LocationInit(lab.Location) }); - } + private bool AlliesControlLab(Actor self) + { + var units = UnitsNearActor(self, lab, labRange); + return units.Any() && units.All(a => a.Owner == allies); + } - private void SendShips(Actor self) - { - for (int i = 0; i < ships.Length; i++) - { - var actor = self.World.CreateActor(ships[i], - new TypeDictionary { new OwnerInit(allies), new LocationInit(shipSpawnPoint.Location + new int2(i * 2, 0)) }); - actor.QueueActivity(new Move.Move(shipMovePoint.Location + new int2(i * 4, 0))); - } - } + private void SpawnEinsteinAtLab(Actor self) + { + einstein = self.World.CreateActor(einsteinName, new TypeDictionary { new OwnerInit(allies), new LocationInit(lab.Location) }); + } - private void FlyEinsteinFromExtractionLZ() - { - einsteinChinook.QueueActivity(new Wait(150)); - einsteinChinook.QueueActivity(new HeliFly(chinookExitPoint.CenterLocation)); - einsteinChinook.QueueActivity(new RemoveSelf()); - } + private void SendShips(Actor self) + { + for (int i = 0; i < ships.Length; i++) + { + var actor = self.World.CreateActor(ships[i], + new TypeDictionary { new OwnerInit(allies), new LocationInit(shipSpawnPoint.Location + new int2(i * 2, 0)) }); + actor.QueueActivity(new Move.Move(shipMovePoint.Location + new int2(i * 4, 0))); + } + } - private void FlyToExtractionLZ(Actor self) - { - einsteinChinook = self.World.CreateActor(chinookName, new TypeDictionary { new OwnerInit(allies), new LocationInit(extractionLZEntryPoint.Location) }); - einsteinChinook.QueueActivity(new HeliFly(extractionLZ.CenterLocation)); - einsteinChinook.QueueActivity(new Turn(0)); - einsteinChinook.QueueActivity(new HeliLand(true)); - } + private void FlyEinsteinFromExtractionLZ(Actor self) + { + einsteinChinook = self.World.CreateActor(chinookName, new TypeDictionary { new OwnerInit(allies), new LocationInit(extractionLZEntryPoint.Location) }); + einsteinChinook.QueueActivity(new HeliFly(extractionLZ.CenterLocation)); + einsteinChinook.QueueActivity(new Turn(0)); + einsteinChinook.QueueActivity(new HeliLand(true)); + einsteinChinook.QueueActivity(new WaitFor(() => einsteinChinook.Trait().Passengers.Contains(einstein))); + einsteinChinook.QueueActivity(new Wait(150)); + einsteinChinook.QueueActivity(new HeliFly(chinookExitPoint.CenterLocation)); + einsteinChinook.QueueActivity(new RemoveSelf()); + } - private void FlyTanyaToInsertionLZ(Actor self) - { - tanya = self.World.CreateActor(false, tanyaName, new TypeDictionary { new OwnerInit(allies) }); - var chinook = self.World.CreateActor(chinookName, new TypeDictionary { new OwnerInit(allies), new LocationInit(insertionLZEntryPoint.Location) }); - chinook.Trait().Load(chinook, tanya); - // use CenterLocation for HeliFly, Location for Move - chinook.QueueActivity(new HeliFly(insertionLZ.CenterLocation)); - chinook.QueueActivity(new Turn(0)); - chinook.QueueActivity(new HeliLand(true)); - chinook.QueueActivity(new UnloadCargo()); - chinook.QueueActivity(new CallFunc(() => Sound.Play("laugh1.aud"))); - chinook.QueueActivity(new Wait(150)); - chinook.QueueActivity(new HeliFly(chinookExitPoint.CenterLocation)); - chinook.QueueActivity(new RemoveSelf()); - } + private void FlyTanyaToInsertionLZ(Actor self) + { + tanya = self.World.CreateActor(false, tanyaName, new TypeDictionary { new OwnerInit(allies) }); + var chinook = self.World.CreateActor(chinookName, new TypeDictionary { new OwnerInit(allies), new LocationInit(insertionLZEntryPoint.Location) }); + chinook.Trait().Load(chinook, tanya); + // use CenterLocation for HeliFly, Location for Move + chinook.QueueActivity(new HeliFly(insertionLZ.CenterLocation)); + chinook.QueueActivity(new Turn(0)); + chinook.QueueActivity(new HeliLand(true)); + chinook.QueueActivity(new UnloadCargo()); + chinook.QueueActivity(new CallFunc(() => Sound.Play("laugh1.aud"))); + chinook.QueueActivity(new Wait(150)); + chinook.QueueActivity(new HeliFly(chinookExitPoint.CenterLocation)); + chinook.QueueActivity(new RemoveSelf()); + } - public void WorldLoaded(World w) - { - allies = w.Players.Single(p => p.InternalName == "Allies"); - soviets = w.Players.Single(p => p.InternalName == "Soviets"); - var actors = w.WorldActor.Trait().Actors; - insertionLZ = actors["InsertionLZ"]; - extractionLZ = actors["ExtractionLZ"]; - lab = actors["Lab"]; - insertionLZEntryPoint = actors["InsertionLZEntryPoint"]; - chinookExitPoint = actors["ChinookExitPoint"]; - extractionLZEntryPoint = actors["ExtractionLZEntryPoint"]; - shipSpawnPoint = actors["ShipSpawnPoint"]; - shipMovePoint = actors["ShipMovePoint"]; - attackEntryPoint1 = actors["SovietAttackEntryPoint1"]; - attackEntryPoint2 = actors["SovietAttackEntryPoint2"]; - music = Sound.Play("hell226m.aud"); // Hell March - Game.ConnectionStateChanged += StopMusic; - } + public void WorldLoaded(World w) + { + allies = w.Players.Single(p => p.InternalName == "Allies"); + soviets = w.Players.Single(p => p.InternalName == "Soviets"); + var actors = w.WorldActor.Trait().Actors; + insertionLZ = actors["InsertionLZ"]; + extractionLZ = actors["ExtractionLZ"]; + lab = actors["Lab"]; + insertionLZEntryPoint = actors["InsertionLZEntryPoint"]; + chinookExitPoint = actors["ChinookExitPoint"]; + extractionLZEntryPoint = actors["ExtractionLZEntryPoint"]; + shipSpawnPoint = actors["ShipSpawnPoint"]; + shipMovePoint = actors["ShipMovePoint"]; + attackEntryPoint1 = actors["SovietAttackEntryPoint1"]; + attackEntryPoint2 = actors["SovietAttackEntryPoint2"]; + music = Sound.Play("hell226m.aud"); // Hell March + Game.ConnectionStateChanged += StopMusic; + } - private void StopMusic(OrderManager orderManager) - { - if (!orderManager.GameStarted) - { - Sound.StopSound(music); - Game.ConnectionStateChanged -= StopMusic; - } - } - } + private void StopMusic(OrderManager orderManager) + { + if (!orderManager.GameStarted) + { + Sound.StopSound(music); + Game.ConnectionStateChanged -= StopMusic; + } + } + } } diff --git a/mods/ra/maps/allies-01.oramap b/mods/ra/maps/allies-01.oramap index 8e23ab172baf468f62b48bc6f7235ce0eb3fe0de..53ce7e9bacc0dfe65c8cc086c62c92bf9592473a 100644 GIT binary patch delta 1658 zcmV-=28H>V6_FJUP)h>@6aWAK2mq$0)v*n{0}a5Y)j)f{cvj;D001D9)&oC(ldaW$ z`_Qgd(#}}L3Q6xPHX6*umIc9tHt)IEP&pbTK`<|+ni^MC$=X4Lg5Vu%3sE+*tGoE4t1eoDZZ@6r`1yQ7HUOX!CR$cq~x4h!w$e>44x`9=HMJWk!l7tB7 zA&U0gvxYv^9rvCxXLNHU?5#a{d{wiJrp)+{l1Yn$`-zi>dxG2iRx|v~{OF&JKib-P z5$>G`#)afMkMs{34P+6aP5|vv9g%R@B@YwFY&!5qqX93g`*T1Rq9fwy@*Y7z10n`L zacM{te|pA`6SqOJV$TeJ@sW!^9}VtB)w5?9V&t+v0{|730f<}xY}Mddq12)QM;<_? zqSgxKp8>a|HU+k5ip{Pm8i%jRvrj5AdN4jxUAd$Ob2W7sDaW3>l^moykp3 z{HN`PiIYD8eqzYSml>CuV0!~4 z@!Kv;#G4_x4Uu{>J=NEr#HgE@Ycr+Ts={Mbx=*Q|4&Rv+SsnMeu@83-;n9)8QWeNJ z!_ou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