Updated code, removed NOD_01, Spaces -> Tabs
NOD01Script Spaces -> Tabs started work on NOD_01 Conflicts: OpenRA.Mods.cnc_sw/OpenRA.Mods.Cnc_sw.csproj removing uneeded files Spaces -> Tabs NOD01Script.cs started work on NOD_01 Conflicts: OpenRA.Mods.cnc_sw/OpenRA.Mods.Cnc_sw.csproj removing uneeded files Did some messing around still broken Spaces -> Tabs #2 Updated the code a little, is somewhat more playable now removed NOD_01
This commit is contained in:
@@ -1,216 +1,201 @@
|
|||||||
#region Copyright & License Information
|
#region Copyright & License Information
|
||||||
/*
|
/*
|
||||||
* Copyright 2007-2012 The OpenRA Developers (see AUTHORS)
|
* Copyright 2007-2012 The OpenRA Developers (see AUTHORS)
|
||||||
* This file is part of OpenRA, which is free software. It is made
|
* This file is part of OpenRA, which is free software. It is made
|
||||||
* available to you under the terms of the GNU General Public License
|
* available to you under the terms of the GNU General Public License
|
||||||
* as published by the Free Software Foundation. For more information,
|
* as published by the Free Software Foundation. For more information,
|
||||||
* see COPYING.
|
* see COPYING.
|
||||||
*/
|
*/
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Drawing;
|
using System.Linq;
|
||||||
using System.Linq;
|
using OpenRA.Mods.Cnc;
|
||||||
using OpenRA.FileFormats;
|
using OpenRA.Mods.RA;
|
||||||
using OpenRA.Mods.Cnc;
|
using OpenRA.Mods.RA.Air;
|
||||||
using OpenRA.Mods.RA;
|
using OpenRA.Mods.RA.Move;
|
||||||
using OpenRA.Mods.RA.Move;
|
using OpenRA.Mods.RA.Activities;
|
||||||
using OpenRA.Mods.RA.Activities;
|
using OpenRA.Mods.RA.Missions;
|
||||||
using OpenRA.Network;
|
using OpenRA.Mods.RA.Buildings;
|
||||||
using OpenRA.Scripting;
|
using OpenRA.Scripting;
|
||||||
using OpenRA.Traits;
|
using OpenRA.Traits;
|
||||||
|
using OpenRA.FileFormats;
|
||||||
namespace OpenRA.Mods.Cnc.Missions
|
|
||||||
{
|
namespace OpenRA.Mods.Cnc.Missions
|
||||||
class Nod01ScriptInfo : TraitInfo<Nod01Script>, Requires<SpawnMapActorsInfo> { }
|
{
|
||||||
|
class Nod01ScriptInfo : TraitInfo<Nod01Script>, Requires<SpawnMapActorsInfo> { }
|
||||||
class Nod01Script : IWorldLoaded, ITick
|
|
||||||
{
|
class Nod01Script : IHasObjectives, IWorldLoaded, ITick
|
||||||
static readonly string[] Objectives =
|
{
|
||||||
{
|
public event Action<bool> OnObjectivesUpdated = notify => { };
|
||||||
"Assasinate Nikoomba.",
|
|
||||||
"Level the village."
|
public IEnumerable<Objective> Objectives { get { return new[] { killnikoomba, levelvillage }; } }
|
||||||
};
|
|
||||||
|
Objective killnikoomba = new Objective(ObjectiveType.Primary, KillNikoombaText, ObjectiveStatus.InProgress);
|
||||||
int currentObjective;
|
Objective levelvillage = new Objective(ObjectiveType.Primary, LevelVillageText, ObjectiveStatus.Inactive);
|
||||||
|
|
||||||
Player gdi;
|
const string KillNikoombaText = "Find Nikoomba. Once found he must be assasinated.";
|
||||||
Player nod;
|
const string LevelVillageText = "Nikoomba has met his demise, now level the village.";
|
||||||
//actors and the likes go here
|
|
||||||
Actor nikoomba;
|
Player gdi;
|
||||||
Actor vil01;
|
Player nod;
|
||||||
Actor vil02;
|
|
||||||
Actor vil03;
|
//actors and the likes go here
|
||||||
Actor vil04;
|
Actor nikoomba;
|
||||||
Actor vil05;
|
Actor vil01;
|
||||||
Actor vil06;
|
Actor vil02;
|
||||||
Actor vil07;
|
Actor vil03;
|
||||||
Actor vil08;
|
Actor vil04;
|
||||||
Actor vil09;
|
Actor vil05;
|
||||||
Actor vil10;
|
Actor vil06;
|
||||||
Actor vil11;
|
Actor vil07;
|
||||||
Actor vil12;
|
Actor vil08;
|
||||||
Actor vil13;
|
Actor vil09;
|
||||||
Actor civ01;
|
Actor vil10;
|
||||||
Actor civ02;
|
Actor vil11;
|
||||||
Actor civ03;
|
Actor vil12;
|
||||||
Actor civ04;
|
Actor vil13;
|
||||||
Actor civ05;
|
Actor civ01;
|
||||||
Actor civ06;
|
Actor civ02;
|
||||||
Actor civ07;
|
Actor civ03;
|
||||||
//waypoints
|
Actor civ04;
|
||||||
Actor nr1;
|
Actor civ05;
|
||||||
Actor nr2;
|
Actor civ06;
|
||||||
Actor gr1;
|
Actor civ07;
|
||||||
|
|
||||||
World world;
|
//waypoints
|
||||||
|
Actor nr1;
|
||||||
//in the allies01 script stuff was here not needed for me so far
|
Actor nr2;
|
||||||
const string NRName = "E1";
|
Actor gr1;
|
||||||
const string GRName = "E2";
|
|
||||||
const string GRName2 = "JEEP";
|
World world;
|
||||||
|
|
||||||
void DisplayObjective()
|
//in the allies01 script stuff was here not needed for me so far
|
||||||
{
|
const string NRName = "E1";
|
||||||
Game.AddChatLine(Color.LimeGreen, "Objective", Objectives[currentObjective]);
|
const string GRName = "E2";
|
||||||
}
|
const string GRName2 = "JEEP";
|
||||||
|
|
||||||
void MissionFailed(string text)
|
void MissionFailed(string text)
|
||||||
{
|
{
|
||||||
if (nod.WinState != WinState.Undefined)
|
MissionUtils.CoopMissionFailed(world, text, nod);
|
||||||
{
|
}
|
||||||
return;
|
|
||||||
}
|
void MissionAccomplished(string text)
|
||||||
nod.WinState = WinState.Lost;
|
{
|
||||||
foreach (var actor in world.Actors.Where(a => a.IsInWorld && a.Owner == nod && !a.IsDead()))
|
MissionUtils.CoopMissionAccomplished(world, text, nod);
|
||||||
{
|
}
|
||||||
actor.Kill(actor);
|
|
||||||
}
|
public void Tick(Actor self)
|
||||||
Game.AddChatLine(Color.Red, "Mission failed", text);
|
{
|
||||||
Sound.Play("fail1.aud");
|
if (nod.WinState != WinState.Undefined) return;
|
||||||
}
|
|
||||||
|
//spawns nod reinf
|
||||||
void MissionAccomplished(string text)
|
if (world.FrameNumber == 700)
|
||||||
{
|
{
|
||||||
if (nod.WinState != WinState.Undefined)
|
NODReinforceNthA();
|
||||||
{
|
Sound.Play("reinfor1.aud");
|
||||||
return;
|
}
|
||||||
}
|
if (world.FrameNumber == 1400)
|
||||||
nod.WinState = WinState.Won;
|
{
|
||||||
Game.AddChatLine(Color.Green, "Mission accomplished", text);
|
NODReinforceNthB();
|
||||||
Sound.Play("accom1.aud");
|
Sound.Play("reinfor1.aud");
|
||||||
}
|
}
|
||||||
|
// objectives
|
||||||
public void Tick(Actor self)
|
if (killnikoomba.Status == ObjectiveStatus.InProgress)
|
||||||
{
|
{
|
||||||
if (nod.WinState != WinState.Undefined)
|
if (nikoomba.Destroyed)
|
||||||
{
|
{
|
||||||
return;
|
killnikoomba.Status = ObjectiveStatus.Completed;
|
||||||
}
|
levelvillage.Status = ObjectiveStatus.InProgress;
|
||||||
// display current objective every so often
|
OnObjectivesUpdated(true);
|
||||||
if (world.FrameNumber % 1500 == 1)
|
//DisplayObjective();
|
||||||
{
|
//GDIReinforceNth();
|
||||||
DisplayObjective();
|
}
|
||||||
}
|
}
|
||||||
//spawns nod reinf
|
if (levelvillage.Status == ObjectiveStatus.InProgress)
|
||||||
if (world.FrameNumber == 700)
|
{
|
||||||
{
|
if (vil01.Destroyed && vil02.Destroyed && vil03.Destroyed && vil04.Destroyed && vil05.Destroyed && vil06.Destroyed &&
|
||||||
NODReinforceNthA();
|
vil07.Destroyed && vil08.Destroyed && vil09.Destroyed && vil10.Destroyed && vil11.Destroyed && vil12.Destroyed &&
|
||||||
Sound.Play("reinfor1.aud");
|
vil13.Destroyed && civ01.Destroyed && civ02.Destroyed && civ03.Destroyed && civ04.Destroyed && civ05.Destroyed &&
|
||||||
}
|
civ06.Destroyed && civ07.Destroyed)
|
||||||
if (world.FrameNumber == 1400)
|
{
|
||||||
{
|
levelvillage.Status = ObjectiveStatus.Completed;
|
||||||
NODReinforceNthB();
|
OnObjectivesUpdated(true);
|
||||||
Sound.Play("reinfor1.aud");
|
MissionAccomplished("Nikoomba was killed and the village was destroyed.");
|
||||||
}
|
}
|
||||||
// objectives
|
}
|
||||||
if (currentObjective == 0)
|
|
||||||
{
|
if (!world.Actors.Any(a => (a.Owner == nod) && a.IsInWorld && !a.IsDead()))
|
||||||
if (nikoomba.Destroyed)
|
{
|
||||||
{
|
MissionFailed("The Nod forces in the area have been wiped out.");
|
||||||
currentObjective++;
|
}
|
||||||
DisplayObjective();
|
}
|
||||||
GDIReinforceNth();
|
|
||||||
}
|
IEnumerable<Actor> UnitsNearActor(Actor actor, int range)
|
||||||
}
|
{
|
||||||
else if (currentObjective == 1)
|
return world.FindActorsInCircle(actor.CenterPosition, WRange.FromCells(range))
|
||||||
{
|
.Where(a => a.IsInWorld && a != world.WorldActor && !a.Destroyed && a.HasTrait<IMove>() && !a.Owner.NonCombatant);
|
||||||
if (vil01.Destroyed && vil02.Destroyed && vil03.Destroyed && vil04.Destroyed && vil05.Destroyed && vil06.Destroyed &&
|
}
|
||||||
vil07.Destroyed && vil08.Destroyed && vil09.Destroyed && vil10.Destroyed && vil11.Destroyed && vil12.Destroyed &&
|
|
||||||
vil13.Destroyed && civ01.Destroyed && civ02.Destroyed && civ03.Destroyed && civ04.Destroyed && civ05.Destroyed &&
|
void NODReinforceNthA()
|
||||||
civ06.Destroyed && civ07.Destroyed)
|
{
|
||||||
{
|
nr1 = world.CreateActor(true, NRName, new TypeDictionary { new OwnerInit(nod), new LocationInit(nr1.Location) });
|
||||||
MissionAccomplished("Nikoomba was killed and the Village was Destroyed.");
|
nr1 = world.CreateActor(true, NRName, new TypeDictionary { new OwnerInit(nod), new LocationInit(nr1.Location) });
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
void NODReinforceNthB()
|
||||||
|
{
|
||||||
IEnumerable<Actor> UnitsNearActor(Actor actor, int range)
|
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) });
|
||||||
return world.FindActorsInCircle(actor.CenterPosition, WRange.FromCells(range))
|
//nr1.QueueActivity(new Move.Move(nr1.Location - new CVec(0, 2)));
|
||||||
.Where(a => a.IsInWorld && a != world.WorldActor && !a.Destroyed && a.HasTrait<IMove>() && !a.Owner.NonCombatant);
|
}
|
||||||
}
|
|
||||||
|
void GDIReinforceNth()
|
||||||
void NODReinforceNthA()
|
{
|
||||||
{
|
gr1 = world.CreateActor(true, GRName, new TypeDictionary { new OwnerInit(gdi), new LocationInit(gr1.Location) });
|
||||||
nr1 = world.CreateActor(true, NRName, new TypeDictionary { new OwnerInit(nod), new LocationInit(nr1.Location) });
|
gr1 = world.CreateActor(true, GRName, new TypeDictionary { new OwnerInit(gdi), new LocationInit(gr1.Location) });
|
||||||
nr1 = world.CreateActor(true, NRName, new TypeDictionary { new OwnerInit(nod), new LocationInit(nr1.Location) });
|
gr1 = world.CreateActor(true, GRName2, new TypeDictionary { new OwnerInit(gdi), new LocationInit(gr1.Location) });
|
||||||
//nr1.QueueActivity(new Move.Move(nr1.Location - new CVec(0, 2)));
|
//gr1.QueueActivity(new Move.Move(nr1.Location - new CVec(0, 2)));
|
||||||
}
|
}
|
||||||
|
|
||||||
void NODReinforceNthB()
|
public void WorldLoaded(World w)
|
||||||
{
|
{
|
||||||
nr2 = world.CreateActor(true, NRName, new TypeDictionary { new OwnerInit(nod), new LocationInit(nr2.Location) });
|
world = w;
|
||||||
nr2 = world.CreateActor(true, NRName, new TypeDictionary { new OwnerInit(nod), new LocationInit(nr2.Location) });
|
gdi = w.Players.Single(p => p.InternalName == "GDI");
|
||||||
//nr1.QueueActivity(new Move.Move(nr1.Location - new CVec(0, 2)));
|
nod = w.Players.Single(p => p.InternalName == "NOD");
|
||||||
}
|
var actors = w.WorldActor.Trait<SpawnMapActors>().Actors;
|
||||||
|
nikoomba = actors["Nikoomba"];
|
||||||
void GDIReinforceNth()
|
vil01 = actors["Vil01"];
|
||||||
{
|
vil02 = actors["Vil02"];
|
||||||
gr1 = world.CreateActor(true, GRName, new TypeDictionary { new OwnerInit(gdi), new LocationInit(gr1.Location) });
|
vil03 = actors["Vil03"];
|
||||||
gr1 = world.CreateActor(true, GRName, new TypeDictionary { new OwnerInit(gdi), new LocationInit(gr1.Location) });
|
vil04 = actors["Vil04"];
|
||||||
gr1 = world.CreateActor(true, GRName2, new TypeDictionary { new OwnerInit(gdi), new LocationInit(gr1.Location) });
|
vil05 = actors["Vil05"];
|
||||||
//nr1.QueueActivity(new Move.Move(nr1.Location - new CVec(0, 2)));
|
vil06 = actors["Vil06"];
|
||||||
}
|
vil07 = actors["Vil07"];
|
||||||
|
vil08 = actors["Vil08"];
|
||||||
public void WorldLoaded(World w)
|
vil09 = actors["Vil09"];
|
||||||
{
|
vil10 = actors["Vil10"];
|
||||||
world = w;
|
vil11 = actors["Vil11"];
|
||||||
gdi = w.Players.Single(p => p.InternalName == "GDI");
|
vil12 = actors["Vil12"];
|
||||||
nod = w.Players.Single(p => p.InternalName == "NOD");
|
vil13 = actors["Vil13"];
|
||||||
var actors = w.WorldActor.Trait<SpawnMapActors>().Actors;
|
civ01 = actors["Civ01"];
|
||||||
nikoomba = actors["Nikoomba"];
|
civ02 = actors["Civ02"];
|
||||||
vil01 = actors["Vil01"];
|
civ03 = actors["Civ03"];
|
||||||
vil02 = actors["Vil02"];
|
civ04 = actors["Civ04"];
|
||||||
vil03 = actors["Vil03"];
|
civ05 = actors["Civ05"];
|
||||||
vil04 = actors["Vil04"];
|
civ06 = actors["Civ06"];
|
||||||
vil05 = actors["Vil05"];
|
civ07 = actors["Civ07"];
|
||||||
vil06 = actors["Vil06"];
|
nr1 = actors["NODReinforceNthA"];
|
||||||
vil07 = actors["Vil07"];
|
nr2 = actors["NODReinforceNthB"];
|
||||||
vil08 = actors["Vil08"];
|
gr1 = actors["GDIReinforceNth"];
|
||||||
vil09 = actors["Vil09"];
|
Game.MoveViewport(nr1.Location.ToFloat2());
|
||||||
vil10 = actors["Vil10"];
|
Action afterFMV = () =>
|
||||||
vil11 = actors["Vil11"];
|
{
|
||||||
vil12 = actors["Vil12"];
|
Sound.PlayMusic(Rules.Music["aoi"]);
|
||||||
vil13 = actors["Vil13"];
|
};
|
||||||
civ01 = actors["Civ01"];
|
Game.RunAfterDelay(0, () => Media.PlayFMVFullscreen(w, "nod1pre.vqa", () =>
|
||||||
civ02 = actors["Civ02"];
|
Media.PlayFMVFullscreen(w, "nod1.vqa", afterFMV)));
|
||||||
civ03 = actors["Civ03"];
|
}
|
||||||
civ04 = actors["Civ04"];
|
}
|
||||||
civ05 = actors["Civ05"];
|
}
|
||||||
civ06 = actors["Civ06"];
|
|
||||||
civ07 = actors["Civ07"];
|
|
||||||
nr1 = actors["NODReinforceNthA"];
|
|
||||||
nr2 = actors["NODReinforceNthB"];
|
|
||||||
gr1 = actors["GDIReinforceNth"];
|
|
||||||
Game.MoveViewport(nr1.Location.ToFloat2());
|
|
||||||
Action afterFMV = () =>
|
|
||||||
{
|
|
||||||
Sound.PlayMusic(Rules.Music["aoi"]);
|
|
||||||
};
|
|
||||||
Game.RunAfterDelay(0, () => Media.PlayFMVFullscreen(w, "nod1pre.vqa", () =>
|
|
||||||
Media.PlayFMVFullscreen(w, "nod1.vqa", afterFMV)));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|||||||
Reference in New Issue
Block a user