started work on NOD_01

This commit is contained in:
Dan9550
2013-01-11 17:18:57 +11:00
committed by Matthias Mailänder
parent 6e9ac71168
commit 20737415fa
4 changed files with 543 additions and 0 deletions

View File

@@ -0,0 +1,239 @@
#region Copyright & License Information
/*
* Copyright 2007-2012 The OpenRA Developers (see AUTHORS)
* 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
* as published by the Free Software Foundation. For more information,
* see COPYING.
*/
#endregion
using System.Collections.Generic;
using System.Drawing;
using System.Linq;
using OpenRA.FileFormats;
using OpenRA.Mods.Cnc;
using OpenRA.Mods.RA;
using OpenRA.Mods.RA.Move;
using OpenRA.Mods.RA.Activities;
//using OpenRA.Mods.RA.Air;
using OpenRA.Network;
using OpenRA.Scripting;
using OpenRA.Traits;
namespace OpenRA.Mods.Cnc.Missions
{
class Nod01ScriptInfo : TraitInfo<Nod01Script>, Requires<SpawnMapActorsInfo> { }
class Nod01Script : IWorldLoaded, ITick
{
static readonly string[] Objectives =
{
"Assasinate Nikoomba.",
"Level the village."
};
int currentObjective;
Player gdi;
Player nod;
//actors and the likes go here
Actor nikoomba;
Actor vil01;
Actor vil02;
Actor vil03;
Actor vil04;
Actor vil05;
Actor vil06;
Actor vil07;
Actor vil08;
Actor vil09;
Actor vil10;
Actor vil11;
Actor vil12;
Actor vil13;
Actor civ01;
Actor civ02;
Actor civ03;
Actor civ04;
Actor civ05;
Actor civ06;
Actor civ07;
//waypoints
Actor nr1;
Actor nr2;
Actor gr1;
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";
void DisplayObjective()
{
Game.AddChatLine(Color.LimeGreen, "Objective", Objectives[currentObjective]);
}
void MissionFailed(string text)
{
if (nod.WinState != WinState.Undefined)
{
return;
}
nod.WinState = WinState.Lost;
foreach (var actor in world.Actors.Where(a => a.IsInWorld && a.Owner == nod && !a.IsDead()))
{
actor.Kill(actor);
}
Game.AddChatLine(Color.Red, "Mission failed", text);
Sound.Play("fail1.aud");
}
void MissionAccomplished(string text)
{
if (nod.WinState != WinState.Undefined)
{
return;
}
nod.WinState = WinState.Won;
Game.AddChatLine(Color.Green, "Mission accomplished", text);
Sound.Play("accom1.aud");
}
public void Tick(Actor self)
{
if (nod.WinState != WinState.Undefined)
{
return;
}
// display current objective every so often
if (world.FrameNumber % 1500 == 1)
{
DisplayObjective();
}
//spawns nod reinf
if (world.FrameNumber == 700)
{
NODReinforceNthA();
Sound.Play("reinfor1.aud");
}
if (world.FrameNumber == 1400)
{
NODReinforceNthB();
Sound.Play("reinfor1.aud");
}
// objectives
if (currentObjective == 0)
{
if (nikoomba.Destroyed)
{
currentObjective++;
DisplayObjective();
GDIReinforceNth();
}
}
else if (currentObjective == 1)
{
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 &&
civ06.Destroyed && civ07.Destroyed)
{
MissionAccomplished("Nikoomba was killed and the Village was Destroyed.");
}
}
}
IEnumerable<Actor> UnitsNearActor(Actor actor, int range)
{
return world.FindUnitsInCircle(actor.CenterLocation, Game.CellSize * range)
.Where(a => a.IsInWorld && a != world.WorldActor && !a.Destroyed && a.HasTrait<IMove>() && !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.QueueActivity(new Move.Move(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)));
}
void GDIReinforceNth()
{
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) });
//nr1.QueueActivity(new Move.Move(nr1.Location - new CVec(0, 2)));
}
public void WorldLoaded(World w)
{
world = w;
gdi = w.Players.Single(p => p.InternalName == "GDI");
nod = w.Players.Single(p => p.InternalName == "NOD");
var actors = w.WorldActor.Trait<SpawnMapActors>().Actors;
nikoomba = actors["Nikoomba"];
vil01 = actors["Vil01"];
vil02 = actors["Vil02"];
vil03 = actors["Vil03"];
vil04 = actors["Vil04"];
vil05 = actors["Vil05"];
vil06 = actors["Vil06"];
vil07 = actors["Vil07"];
vil08 = actors["Vil08"];
vil09 = actors["Vil09"];
vil10 = actors["Vil10"];
vil11 = actors["Vil11"];
vil12 = actors["Vil12"];
vil13 = actors["Vil13"];
civ01 = actors["Civ01"];
civ02 = actors["Civ02"];
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());
//Game.ConnectionStateChanged += StopMusic;
//causes an exception atm
//Media.PlayFMVFullscreen(w, "nod1.vqa", () =>
//{
// Media.PlayFMVFullscreen(w, "landing.vqa", () =>
// {
// PlayMusic();
// });
//});
}
void PlayMusic()
{
if (!Rules.InstalledMusic.Any())
{
return;
}
//somehow get this to play aoi, did it in the map.yaml
var track = Rules.InstalledMusic.Random(Game.CosmeticRandom);
Sound.PlayMusicThen(track.Value, PlayMusic);
}
void StopMusic(OrderManager orderManager)
{
if (!orderManager.GameStarted)
{
Sound.StopMusic();
Game.ConnectionStateChanged -= StopMusic;
}
}
}
}

View File

@@ -81,6 +81,7 @@
<Compile Include="IonCannonPower.cs" /> <Compile Include="IonCannonPower.cs" />
<Compile Include="Missions\CncShellmapScript.cs" /> <Compile Include="Missions\CncShellmapScript.cs" />
<Compile Include="Missions\Gdi01Script.cs" /> <Compile Include="Missions\Gdi01Script.cs" />
<Compile Include="Missions\Nod01Script.cs" />
<Compile Include="PoisonedByTiberium.cs" /> <Compile Include="PoisonedByTiberium.cs" />
<Compile Include="ProductionAirdrop.cs" /> <Compile Include="ProductionAirdrop.cs" />
<Compile Include="ProductionQueueFromSelection.cs" /> <Compile Include="ProductionQueueFromSelection.cs" />

Binary file not shown.

View File

@@ -0,0 +1,303 @@
Selectable: True
MapFormat: 5
Title: NOD_01
Description: Recreation of first Nod mission from Cnc
Author: Dan9550
Tileset: DESERT
MapSize: 64,64
Bounds: 21,14,37,24
UseAsShellmap: False
Type: Mission
Players:
PlayerReference@Neutral:
Name: Neutral
OwnsWorld: True
NonCombatant: True
Race: gdi
PlayerReference@Creeps:
Name: Creeps
NonCombatant: True
Race: gdi
PlayerReference@GDI:
Name: GDI
Race: gdi
ColorRamp: 31,222,183,24
Allies: Creeps
Enemies: NOD
PlayerReference@NOD:
Name: NOD
Playable: True
AllowBots: False
LockRace: True
Race: nod
LockColor: True
ColorRamp: 3,255,127,28
LockSpawn: True
LockTeam: True
Enemies: GDI,Neutral
Actors:
Actor0: rock2
Location: 54,14
Owner: Neutral
Actor1: t08
Location: 47,15
Owner: Neutral
Actor2: t18
Location: 32,16
Owner: Neutral
Actor3: t08
Location: 47,16
Owner: Neutral
Actor4: t08
Location: 21,18
Owner: Neutral
Actor5: t18
Location: 32,21
Owner: Neutral
Actor6: t08
Location: 27,22
Owner: Neutral
Actor7: t08
Location: 23,24
Owner: Neutral
Actor8: rock1
Location: 21,25
Owner: Neutral
Actor9: t08
Location: 56,25
Owner: Neutral
Actor10: t08
Location: 23,26
Owner: Neutral
Actor11: t08
Location: 24,26
Owner: Neutral
Actor12: t08
Location: 28,30
Owner: Neutral
Actor13: t08
Location: 50,30
Owner: Neutral
Actor14: t08
Location: 39,31
Owner: Neutral
Actor15: rock1
Location: 31,34
Owner: Neutral
Actor16: t08
Location: 55,37
Owner: Neutral
Actor17: t08
Location: 30,51
Owner: Neutral
Actor18: t08
Location: 58,53
Owner: Neutral
Actor19: t08
Location: 43,56
Owner: Neutral
Actor20: rock1
Location: 24,58
Owner: Neutral
Actor21: t08
Location: 52,58
Owner: Neutral
Actor22: rock1
Location: 55,58
Owner: Neutral
Actor23: t08
Location: 29,59
Owner: Neutral
Actor24: rock2
Location: 31,61
Owner: Neutral
Vil01: v21
Location: 29,23
Owner: Neutral
Vil02: v24
Location: 22,24
Owner: Neutral
Vil03: v24
Location: 21,16
Owner: Neutral
Vil04: v32
Location: 21,20
Owner: Neutral
Vil05: v27
Location: 22,21
Owner: Neutral
Vil06: v20
Location: 21,21
Owner: Neutral
Vil07: v26
Location: 22,23
Owner: Neutral
Vil08: v20
Location: 27,23
Owner: Neutral
Vil09: v22
Location: 26,23
Owner: Neutral
Vil10: v23
Location: 26,22
Owner: Neutral
Vil11: v26
Location: 26,21
Owner: Neutral
Vil12: v25
Location: 29,21
Owner: Neutral
Vil13: v30
Location: 32,18
Owner: Neutral
Civ01: c9
Location: 28,20
Owner: Neutral
Civ02: c6
Location: 28,19
Owner: Neutral
Civ03: c8
Location: 27,19
Owner: Neutral
Civ04: c7
Location: 29,20
Owner: Neutral
Civ05: c4
Location: 31,19
Owner: Neutral
Civ06: c2
Location: 30,19
Owner: Neutral
Civ07: c5
Location: 29,19
Owner: Neutral
Nikoomba: c10
Location: 29,16
Owner: Neutral
Actor46: e1
Location: 28,28
Owner: GDI
Actor47: e1
Location: 29,28
Owner: GDI
Actor48: e1
Location: 29,30
Owner: GDI
Actor49: e1
Location: 33,35
Owner: GDI
Actor50: e1
Location: 34,36
Owner: GDI
Actor51: e1
Location: 41,19
Owner: GDI
Actor52: e1
Location: 40,19
Owner: GDI
Actor53: e1
Location: 40,18
Owner: GDI
Actor54: e1
Location: 40,31
Owner: GDI
Actor55: e1
Location: 43,34
Owner: GDI
Actor56: e1
Location: 46,22
Owner: GDI
Actor57: e1
Location: 51,25
Owner: GDI
Actor58: e1
Location: 51,30
Owner: GDI
Actor59: e1
Location: 55,33
Owner: GDI
Actor60: e1
Location: 56,32
Owner: GDI
Actor61: e1
Location: 52,17
Owner: NOD
Actor62: e1
Location: 51,17
Owner: NOD
Actor63: e1
Location: 51,16
Owner: NOD
Actor64: e1
Location: 52,16
Owner: NOD
Actor65: e1
Location: 55,17
Owner: NOD
Actor66: e1
Location: 56,17
Owner: NOD
Actor67: e1
Location: 56,16
Owner: NOD
Actor68: e1
Location: 55,16
Owner: NOD
Actor69: bggy
Location: 53,16
Owner: NOD
Actor70: bggy
Location: 54,16
Owner: NOD
NODReinforceNthA: waypoint
Location: 52,18
Owner: NOD
GDIReinforceNth: waypoint
Location: 24,15
Owner: GDI
NODReinforceNthB: waypoint
Location: 55,18
Owner: NOD
Actor27: jeep
Location: 31,28
Owner: GDI
Actor28: jeep
Location: 28,29
Owner: GDI
Smudges:
Rules:
Player:
-ConquestVictoryConditions:
World:
-CrateSpawner:
-SpawnMPUnits:
-MPStartLocations:
PlayMusicOnMapLoad:
Music: aoi2
Nod01Script:
MissionObjectivesPanel:
ObjectivesPanel: MISSION_OBJECTIVES
C10:
Tooltip:
Name: Nikoomba
Sequences:
Weapons:
Voices:
Notifications: