Merge pull request #3595 from dan9550/td_nod_campaign

More improvements to nod01
This commit is contained in:
Matthias Mailänder
2013-07-25 13:34:37 -07:00
2 changed files with 40 additions and 39 deletions

View File

@@ -38,10 +38,8 @@ namespace OpenRA.Mods.Cnc.Missions
const string KillNikoombaText = "Find Nikoomba. Once found he must be assasinated."; const string KillNikoombaText = "Find Nikoomba. Once found he must be assasinated.";
const string LevelVillageText = "Nikoomba has met his demise, now level the village."; const string LevelVillageText = "Nikoomba has met his demise, now level the village.";
Player gdi;
Player nod; Player nod;
//actors and the likes go here
Actor nikoomba; Actor nikoomba;
Actor vil01; Actor vil01;
Actor vil02; Actor vil02;
@@ -64,17 +62,14 @@ namespace OpenRA.Mods.Cnc.Missions
Actor civ06; Actor civ06;
Actor civ07; Actor civ07;
//waypoints
Actor nr1; Actor nr1;
Actor nr2; Actor nr2;
Actor gr1; Actor nr3;
World world; World world;
//in the allies01 script stuff was here not needed for me so far const string ReInfE1 = "E1";
const string NRName = "E1"; const string ReInfE3 = "E3";
const string GRName = "E2";
const string GRName2 = "JEEP";
void MissionFailed(string text) void MissionFailed(string text)
{ {
@@ -90,7 +85,6 @@ namespace OpenRA.Mods.Cnc.Missions
{ {
if (nod.WinState != WinState.Undefined) return; if (nod.WinState != WinState.Undefined) return;
//spawns nod reinf
if (world.FrameNumber == 700) if (world.FrameNumber == 700)
{ {
NODReinforceNthA(); NODReinforceNthA();
@@ -101,7 +95,7 @@ namespace OpenRA.Mods.Cnc.Missions
NODReinforceNthB(); NODReinforceNthB();
Sound.Play("reinfor1.aud"); Sound.Play("reinfor1.aud");
} }
// objectives
if (killnikoomba.Status == ObjectiveStatus.InProgress) if (killnikoomba.Status == ObjectiveStatus.InProgress)
{ {
if (nikoomba.Destroyed) if (nikoomba.Destroyed)
@@ -109,8 +103,8 @@ namespace OpenRA.Mods.Cnc.Missions
killnikoomba.Status = ObjectiveStatus.Completed; killnikoomba.Status = ObjectiveStatus.Completed;
levelvillage.Status = ObjectiveStatus.InProgress; levelvillage.Status = ObjectiveStatus.InProgress;
OnObjectivesUpdated(true); OnObjectivesUpdated(true);
//DisplayObjective(); NODReinforceNWstA();
//GDIReinforceNth(); Sound.Play("reinfor1.aud");
} }
} }
if (levelvillage.Status == ObjectiveStatus.InProgress) if (levelvillage.Status == ObjectiveStatus.InProgress)
@@ -122,48 +116,55 @@ namespace OpenRA.Mods.Cnc.Missions
{ {
levelvillage.Status = ObjectiveStatus.Completed; levelvillage.Status = ObjectiveStatus.Completed;
OnObjectivesUpdated(true); OnObjectivesUpdated(true);
Sound.StopMusic();
MissionAccomplished("Nikoomba was killed and the village was destroyed."); MissionAccomplished("Nikoomba was killed and the village was destroyed.");
} }
} }
if (!world.Actors.Any(a => (a.Owner == nod) && a.IsInWorld && !a.IsDead())) var unitsAndBuildings = world.Actors.Where(a => !a.IsDead() && a.IsInWorld && (a.HasTrait<Mobile>() || (a.HasTrait<Building>() && !a.HasTrait<Wall>())));
{
MissionFailed("The Nod forces in the area have been wiped out.");
}
}
IEnumerable<Actor> UnitsNearActor(Actor actor, int range) if (!unitsAndBuildings.Any(a => a.Owner == nod))
{ {
return world.FindActorsInCircle(actor.CenterPosition, WRange.FromCells(range)) Action afterFMV = () =>
.Where(a => a.IsInWorld && a != world.WorldActor && !a.Destroyed && a.HasTrait<IPositionable>() && !a.Owner.NonCombatant); {
Sound.StopMusic();
MissionFailed("The Nod forces in the area have been wiped out.");
};
Game.RunAfterDelay(0, () => Media.PlayFMVFullscreen(world, "nodlose.vqa", afterFMV));
}
} }
void NODReinforceNthA() void NODReinforceNthA()
{ {
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 = world.CreateActor(true, NRName, new TypeDictionary { new OwnerInit(nod), new LocationInit(nr1.Location) }); nr1.QueueActivity(nr1.Trait<Mobile>().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<Mobile>().ScriptedMove(nr1.Location - new CVec(0, -2)));
} }
void NODReinforceNthB() void NODReinforceNthB()
{ {
nr2 = world.CreateActor(true, NRName, new TypeDictionary { new OwnerInit(nod), new LocationInit(nr2.Location) }); nr2 = world.CreateActor(true, ReInfE1, new TypeDictionary { new OwnerInit(nod), new LocationInit(nr2.Location) });
nr2 = world.CreateActor(true, NRName, new TypeDictionary { new OwnerInit(nod), new LocationInit(nr2.Location) }); nr2.QueueActivity(nr2.Trait<Mobile>().ScriptedMove(nr2.Location - new CVec(0, -2)));
//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<Mobile>().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) }); nr3 = world.CreateActor(true, ReInfE3, new TypeDictionary { new OwnerInit(nod), new LocationInit(nr3.Location) });
gr1 = world.CreateActor(true, GRName, new TypeDictionary { new OwnerInit(gdi), new LocationInit(gr1.Location) }); nr3.QueueActivity(nr3.Trait<Mobile>().ScriptedMove(nr3.Location - new CVec(0, -5)));
gr1 = world.CreateActor(true, GRName2, new TypeDictionary { new OwnerInit(gdi), new LocationInit(gr1.Location) }); nr3 = world.CreateActor(true, ReInfE3, new TypeDictionary { new OwnerInit(nod), new LocationInit(nr3.Location) });
//gr1.QueueActivity(new Move.Move(nr1.Location - new CVec(0, 2))); nr3.QueueActivity(nr3.Trait<Mobile>().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<Mobile>().ScriptedMove(nr3.Location - new CVec(0, -5)));
} }
public void WorldLoaded(World w) public void WorldLoaded(World w)
{ {
world = w; world = w;
gdi = w.Players.Single(p => p.InternalName == "GDI");
nod = w.Players.Single(p => p.InternalName == "NOD"); nod = w.Players.Single(p => p.InternalName == "NOD");
nod.PlayerActor.Trait<PlayerResources>().Cash = 0;
var actors = w.WorldActor.Trait<SpawnMapActors>().Actors; var actors = w.WorldActor.Trait<SpawnMapActors>().Actors;
nikoomba = actors["Nikoomba"]; nikoomba = actors["Nikoomba"];
vil01 = actors["Vil01"]; vil01 = actors["Vil01"];
@@ -188,11 +189,11 @@ namespace OpenRA.Mods.Cnc.Missions
civ07 = actors["Civ07"]; civ07 = actors["Civ07"];
nr1 = actors["NODReinforceNthA"]; nr1 = actors["NODReinforceNthA"];
nr2 = actors["NODReinforceNthB"]; nr2 = actors["NODReinforceNthB"];
gr1 = actors["GDIReinforceNth"]; nr3 = actors["NODReinforceNWstA"];
Game.MoveViewport(nr1.Location.ToFloat2()); Game.MoveViewport(nr1.Location.ToFloat2());
Action afterFMV = () => Action afterFMV = () =>
{ {
Sound.PlayMusic(Rules.Music["aoi"]); MissionUtils.PlayMissionMusic();
}; };
Game.RunAfterDelay(0, () => Media.PlayFMVFullscreen(w, "nod1pre.vqa", () => Game.RunAfterDelay(0, () => Media.PlayFMVFullscreen(w, "nod1pre.vqa", () =>
Media.PlayFMVFullscreen(w, "nod1.vqa", afterFMV))); Media.PlayFMVFullscreen(w, "nod1.vqa", afterFMV)));

View File

@@ -266,13 +266,13 @@ Actors:
Location: 54,16 Location: 54,16
Owner: NOD Owner: NOD
NODReinforceNthA: waypoint NODReinforceNthA: waypoint
Location: 52,18 Location: 52,14
Owner: NOD
NODReinforceNWstA: waypoint
Location: 24,14
Owner: NOD Owner: NOD
GDIReinforceNth: waypoint
Location: 24,15
Owner: GDI
NODReinforceNthB: waypoint NODReinforceNthB: waypoint
Location: 55,18 Location: 56,14
Owner: NOD Owner: NOD
Actor27: jeep Actor27: jeep
Location: 31,28 Location: 31,28