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
This commit is contained in:
ScottNZ
2012-06-21 22:53:20 +12:00
parent 0b98a8ce5e
commit 9ff69b7946
2 changed files with 222 additions and 221 deletions

View File

@@ -23,7 +23,7 @@ namespace OpenRA.Mods.RA.Missions
public class Allies01Script : IWorldLoaded, ITick public class Allies01Script : IWorldLoaded, ITick
{ {
private string[] objectives = private static readonly string[] objectives =
{ {
"Find Einstein.", "Find Einstein.",
"Wait for the helicopter and extract Einstein." "Wait for the helicopter and extract Einstein."
@@ -55,7 +55,7 @@ namespace OpenRA.Mods.RA.Missions
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 static readonly string[] attackWave = { "e1", "e1", "e1", "e1", "e2", "e2", "e2", "e2", "dog" };
private int currentAttackWaveFrameNumber = -600; private int currentAttackWaveFrameNumber;
private int currentAttackWave; private int currentAttackWave;
private const int einsteinChinookArrivesAtAttackWave = 5; private const int einsteinChinookArrivesAtAttackWave = 5;
@@ -63,6 +63,7 @@ namespace OpenRA.Mods.RA.Missions
private const string einsteinName = "c1"; private const string einsteinName = "c1";
private const string tanyaName = "e7"; private const string tanyaName = "e7";
private const string chinookName = "tran"; private const string chinookName = "tran";
private const string signalFlareName = "flare";
private void NextObjective() private void NextObjective()
{ {
@@ -87,6 +88,7 @@ namespace OpenRA.Mods.RA.Missions
actor.Kill(actor); actor.Kill(actor);
} }
self.World.LocalShroud.Disabled = true; self.World.LocalShroud.Disabled = true;
Sound.Play("misnlst1.aud", 5);
} }
private void MissionAccomplished(Actor self, string text) private void MissionAccomplished(Actor self, string text)
@@ -98,6 +100,7 @@ namespace OpenRA.Mods.RA.Missions
allies.WinState = WinState.Won; allies.WinState = WinState.Won;
Game.AddChatLine(Color.Blue, "Mission accomplished", text); Game.AddChatLine(Color.Blue, "Mission accomplished", text);
self.World.LocalShroud.Disabled = true; self.World.LocalShroud.Disabled = true;
Sound.Play("misnwon1.aud", 5);
} }
public void Tick(Actor self) public void Tick(Actor self)
@@ -126,11 +129,14 @@ namespace OpenRA.Mods.RA.Missions
{ {
if (AlliesControlLab(self)) if (AlliesControlLab(self))
{ {
SpawnSignalFlare(self);
Sound.Play("flaren1.aud", 5);
SpawnEinsteinAtLab(self); // spawn Einstein once the area is clear SpawnEinsteinAtLab(self); // spawn Einstein once the area is clear
Sound.Play("einok1.aud"); // "Incredible!" - Einstein Sound.Play("einok1.aud"); // "Incredible!" - Einstein
SendShips(self); SendShips(self);
NextObjective(); NextObjective();
DisplayObjective(); DisplayObjective();
currentAttackWaveFrameNumber = self.World.FrameNumber;
} }
if (lab.Destroyed) if (lab.Destroyed)
{ {
@@ -141,25 +147,19 @@ namespace OpenRA.Mods.RA.Missions
{ {
if (self.World.FrameNumber >= currentAttackWaveFrameNumber + 600) if (self.World.FrameNumber >= currentAttackWaveFrameNumber + 600)
{ {
Sound.Play("enmyapp1.aud", 5);
SendAttackWave(self, attackWave); SendAttackWave(self, attackWave);
currentAttackWave++; currentAttackWave++;
currentAttackWaveFrameNumber = self.World.FrameNumber; currentAttackWaveFrameNumber = self.World.FrameNumber;
if (currentAttackWave == einsteinChinookArrivesAtAttackWave) if (currentAttackWave == einsteinChinookArrivesAtAttackWave)
{ {
FlyToExtractionLZ(self); FlyEinsteinFromExtractionLZ(self);
} }
} }
if (einsteinChinook != null) if (einsteinChinook != null && !self.World.Map.IsInMap(einsteinChinook.Location) && !einstein.IsInWorld)
{
if (einsteinChinook.Trait<Cargo>().Passengers.Contains(einstein))
{
FlyEinsteinFromExtractionLZ();
}
if (!self.World.Map.IsInMap(einsteinChinook.Location) && !einstein.IsInWorld)
{ {
MissionAccomplished(self, "Einstein was rescued."); MissionAccomplished(self, "Einstein was rescued.");
} }
}
if (einstein.Destroyed) if (einstein.Destroyed)
{ {
MissionFailed(self, "Einstein was killed."); MissionFailed(self, "Einstein was killed.");
@@ -171,14 +171,18 @@ namespace OpenRA.Mods.RA.Missions
} }
} }
private void SpawnSignalFlare(Actor self)
{
self.World.CreateActor(signalFlareName, new TypeDictionary { new OwnerInit(allies), new LocationInit(extractionLZ.Location) });
}
private void SendAttackWave(Actor self, IEnumerable<string> wave) private void SendAttackWave(Actor self, IEnumerable<string> wave)
{ {
foreach (var unit in wave) foreach (var unit in wave)
{ {
var spawnActor = self.World.SharedRandom.Next(2) == 0 ? attackEntryPoint1 : attackEntryPoint2; 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) }); var actor = self.World.CreateActor(unit, new TypeDictionary { new OwnerInit(soviets), new LocationInit(spawnActor.Location) });
actor.QueueActivity(new Attack(Target.FromActor(targetActor), 2)); actor.QueueActivity(new AttackMove.AttackMoveActivity(actor, new Attack(Target.FromActor(einstein), 3))); // better way of doing this?
} }
} }
@@ -191,7 +195,7 @@ namespace OpenRA.Mods.RA.Missions
private bool AlliesControlLab(Actor self) private bool AlliesControlLab(Actor self)
{ {
var units = UnitsNearActor(self, lab, labRange); var units = UnitsNearActor(self, lab, labRange);
return units.Count() >= 1 && units.All(a => a.Owner == allies); return units.Any() && units.All(a => a.Owner == allies);
} }
private void SpawnEinsteinAtLab(Actor self) private void SpawnEinsteinAtLab(Actor self)
@@ -209,19 +213,16 @@ namespace OpenRA.Mods.RA.Missions
} }
} }
private void FlyEinsteinFromExtractionLZ() private void FlyEinsteinFromExtractionLZ(Actor self)
{
einsteinChinook.QueueActivity(new Wait(150));
einsteinChinook.QueueActivity(new HeliFly(chinookExitPoint.CenterLocation));
einsteinChinook.QueueActivity(new RemoveSelf());
}
private void FlyToExtractionLZ(Actor self)
{ {
einsteinChinook = self.World.CreateActor(chinookName, new TypeDictionary { new OwnerInit(allies), new LocationInit(extractionLZEntryPoint.Location) }); einsteinChinook = self.World.CreateActor(chinookName, new TypeDictionary { new OwnerInit(allies), new LocationInit(extractionLZEntryPoint.Location) });
einsteinChinook.QueueActivity(new HeliFly(extractionLZ.CenterLocation)); einsteinChinook.QueueActivity(new HeliFly(extractionLZ.CenterLocation));
einsteinChinook.QueueActivity(new Turn(0)); einsteinChinook.QueueActivity(new Turn(0));
einsteinChinook.QueueActivity(new HeliLand(true)); einsteinChinook.QueueActivity(new HeliLand(true));
einsteinChinook.QueueActivity(new WaitFor(() => einsteinChinook.Trait<Cargo>().Passengers.Contains(einstein)));
einsteinChinook.QueueActivity(new Wait(150));
einsteinChinook.QueueActivity(new HeliFly(chinookExitPoint.CenterLocation));
einsteinChinook.QueueActivity(new RemoveSelf());
} }
private void FlyTanyaToInsertionLZ(Actor self) private void FlyTanyaToInsertionLZ(Actor self)

Binary file not shown.