Scripted gdi1 mission intro

This commit is contained in:
Paul Chote
2010-08-16 18:11:20 +12:00
parent 4e86f5b252
commit 50d5936846
10 changed files with 556 additions and 9 deletions

View File

@@ -0,0 +1,119 @@
#region Copyright & License Information
/*
* Copyright 2007-2010 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 LICENSE.
*/
#endregion
using System.Collections.Generic;
using System.Linq;
using OpenRA.Traits;
using OpenRA.Widgets;
using OpenRA.Traits.Activities;
using OpenRA.FileFormats;
using OpenRA.Mods.RA.Activities;
namespace OpenRA.Mods.RA
{
class Gdi01ScriptInfo : TraitInfo<Gdi01Script> { }
class Gdi01Script: ILoadWorldHook, ITick
{
Dictionary<string, Actor> Actors;
Dictionary<string, Player> Players;
public void WorldLoaded(World w)
{
Players = w.WorldActor.Trait<CreateMapPlayers>().Players;
Actors = w.WorldActor.Trait<SpawnMapActors>().Actors;
Game.MoveViewport((.5f * (w.Map.TopLeft + w.Map.BottomRight).ToFloat2()).ToInt2());
var playerRoot = Widget.RootWidget.OpenWindow("FMVPLAYER");
var player = playerRoot.GetWidget<VqaPlayerWidget>("PLAYER");
w.DisableTick = true;
player.Load("gdi1.vqa");
player.PlayThen(() =>
{
player.Load("landing.vqa");
player.PlayThen(() =>
{
Widget.RootWidget.CloseWindow();
w.DisableTick = false;
Sound.PlayMusic(Rules.Music["aoi"].Filename);
started = true;
});
});
}
int ticks = 0;
bool started = false;
public void Tick(Actor self)
{
if (!started)
return;
if (ticks == 0)
{
Actors["gunboat"].QueueActivity(new Move(new int2(50,59),1));
}
ticks++;
if (ticks == 25*5)
{
Sound.PlayToPlayer(self.World.LocalPlayer,"reinfor1.aud");
// Pathfinder does stupid crap, so hardcode the path we want
var path = new List<int2>()
{
new int2(53,61),
new int2(53,60),
new int2(53,59),
new int2(53,58),
new int2(53,57),
};
DoReinforcements(self.World, new int2(54,61),new int2(54,57), new int2(53,53), new string[] {"e1","e1","e1"});
}
}
void DoReinforcements(World world, int2 startPos, int2 endPos, int2 unload, string[] items)
{
world.AddFrameEndTask(w =>
{
var a = w.CreateActor("lst", new TypeDictionary
{
new LocationInit( startPos ),
new OwnerInit( Players["GoodGuy"] ),
new FacingInit( 0 ),
});
var cargo = a.Trait<Cargo>();
foreach (var i in items)
cargo.Load(a, world.CreateActor(false, i.ToLowerInvariant(), new TypeDictionary { new OwnerInit( Players["GoodGuy"] ) }));
a.CancelActivity();
a.QueueActivity(new Move(endPos, 0));
a.QueueActivity(new CallFunc(() =>
{
while (!cargo.IsEmpty(a))
{
var b = cargo.Unload(a);
world.AddFrameEndTask(w2 =>
{
w2.Add(b);
b.TraitsImplementing<IMove>().FirstOrDefault().SetPosition(b, a.Location);
b.QueueActivity(new Move(unload, 2));
});
}
}));
a.QueueActivity(new Wait(25));
a.QueueActivity(new Move(startPos,0));
a.QueueActivity(new RemoveSelf());
});
}
}
}

View File

@@ -59,6 +59,7 @@
<Compile Include="Properties\AssemblyInfo.cs" /> <Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="TiberiumRefineryDockAction.cs" /> <Compile Include="TiberiumRefineryDockAction.cs" />
<Compile Include="DeadBuildingState.cs" /> <Compile Include="DeadBuildingState.cs" />
<Compile Include="Missions\Gdi01Script.cs" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ProjectReference Include="..\OpenRA.FileFormats\OpenRA.FileFormats.csproj"> <ProjectReference Include="..\OpenRA.FileFormats\OpenRA.FileFormats.csproj">
@@ -91,4 +92,7 @@ copy "$(TargetPath)" "$(SolutionDir)mods/cnc/"
cd "$(SolutionDir)" cd "$(SolutionDir)"
ralint cnc</PostBuildEvent> ralint cnc</PostBuildEvent>
</PropertyGroup> </PropertyGroup>
<ItemGroup>
<Folder Include="Missions\" />
</ItemGroup>
</Project> </Project>

View File

@@ -136,8 +136,6 @@
Crushes: crate Crushes: crate
TerrainTypes: Clear, Rough, Road, Tree, Water, Rock, Wall, Ore, Beach, River TerrainTypes: Clear, Rough, Road, Tree, Water, Rock, Wall, Ore, Beach, River
TerrainSpeeds: 0%, 0%, 0%, 0%, 100%, 0%, 0%, 0%, 0%, 0% TerrainSpeeds: 0%, 0%, 0%, 0%, 100%, 0%, 0%, 0%, 0%, 0%
Selectable:
Voice: GenericVoice
Targetable: Targetable:
TargetTypes: Ground, Water TargetTypes: Ground, Water
HiddenUnderFog: HiddenUnderFog:

BIN
mods/cnc/maps/gdi01/map.bin Normal file

Binary file not shown.

View File

@@ -0,0 +1 @@
4d5ce7b02abcdb688e9e517bd827ab11b8205278

View File

@@ -0,0 +1,415 @@
Selectable: True
MapFormat: 3
Title: GDI 01
Description: Describe your map here
Author: Westwood Studios
PlayerCount: 4
Tileset: TEMPERAT
MapSize: 64,64
TopLeft: 35,39
BottomRight: 62,62
Players:
PlayerReference@BadGuy:
Name: BadGuy
Palette:
Race: nod
OwnsWorld: False
NonCombatant: False
Color: 255,255,20,0
Color2: 255,56,0,0
InitialCash: 0
Allies: BadGuy
Enemies: GoodGuy
PlayerReference@GoodGuy:
Name: GoodGuy
Palette:
Race: gdi
OwnsWorld: False
NonCombatant: False
Color: 255,246,214,121
Color2: 255,40,32,8
InitialCash: 20
Allies: GoodGuy
Enemies: BadGuy
PlayerReference@Neutral:
Name: Neutral
Palette:
Race: gdi
OwnsWorld: True
NonCombatant: True
Color: 255,238,238,238
Color2: 255,44,28,24
InitialCash: 0
Allies:
Enemies:
Actors:
Actor0: sbag
Location: 48,55
Owner: Neutral
Actor1: sbag
Location: 47,55
Owner: Neutral
Actor2: sbag
Location: 49,54
Owner: Neutral
Actor3: sbag
Location: 48,54
Owner: Neutral
Actor4: sbag
Location: 60,37
Owner: Neutral
Actor5: sbag
Location: 59,37
Owner: Neutral
Actor6: sbag
Location: 58,37
Owner: Neutral
Actor7: sbag
Location: 57,37
Owner: Neutral
Actor8: sbag
Location: 53,37
Owner: Neutral
Actor9: sbag
Location: 52,37
Owner: Neutral
Actor10: sbag
Location: 51,37
Owner: Neutral
Actor11: sbag
Location: 50,37
Owner: Neutral
Actor12: sbag
Location: 49,37
Owner: Neutral
Actor13: sbag
Location: 48,37
Owner: Neutral
Actor14: sbag
Location: 47,37
Owner: Neutral
Actor15: sbag
Location: 45,37
Owner: Neutral
Actor16: sbag
Location: 44,37
Owner: Neutral
Actor17: sbag
Location: 43,37
Owner: Neutral
Actor18: sbag
Location: 42,37
Owner: Neutral
Actor19: sbag
Location: 60,36
Owner: Neutral
Actor20: sbag
Location: 47,36
Owner: Neutral
Actor21: sbag
Location: 42,36
Owner: Neutral
Actor22: sbag
Location: 60,35
Owner: Neutral
Actor23: sbag
Location: 60,34
Owner: Neutral
Actor24: sbag
Location: 47,34
Owner: Neutral
Actor25: sbag
Location: 60,33
Owner: Neutral
Actor26: sbag
Location: 47,33
Owner: Neutral
Actor27: sbag
Location: 60,32
Owner: Neutral
Actor28: sbag
Location: 47,32
Owner: Neutral
Actor29: sbag
Location: 60,31
Owner: Neutral
Actor30: sbag
Location: 59,31
Owner: Neutral
Actor31: sbag
Location: 58,31
Owner: Neutral
Actor32: sbag
Location: 57,31
Owner: Neutral
Actor33: sbag
Location: 56,31
Owner: Neutral
Actor34: sbag
Location: 55,31
Owner: Neutral
Actor35: sbag
Location: 54,31
Owner: Neutral
Actor36: sbag
Location: 52,31
Owner: Neutral
Actor37: sbag
Location: 51,31
Owner: Neutral
Actor38: sbag
Location: 50,31
Owner: Neutral
Actor39: sbag
Location: 49,31
Owner: Neutral
Actor40: sbag
Location: 48,31
Owner: Neutral
Actor41: sbag
Location: 47,31
Owner: Neutral
Actor42: tc01
Location: 59,39
Owner: Neutral
Actor43: tc05
Location: 31,47
Owner: Neutral
Actor44: tc02
Location: 31,44
Owner: Neutral
Actor45: tc02
Location: 33,31
Owner: Neutral
Actor46: t01
Location: 32,31
Owner: Neutral
Actor47: tc02
Location: 55,44
Owner: Neutral
Actor48: tc02
Location: 31,37
Owner: Neutral
Actor49: tc04
Location: 37,34
Owner: Neutral
Actor50: tc05
Location: 31,34
Owner: Neutral
Actor51: t05
Location: 46,31
Owner: Neutral
Actor52: t06
Location: 43,35
Owner: Neutral
Actor53: t06
Location: 40,37
Owner: Neutral
Actor54: t07
Location: 41,36
Owner: Neutral
Actor55: t07
Location: 59,35
Owner: Neutral
Actor56: t07
Location: 48,31
Owner: Neutral
Actor57: t16
Location: 49,32
Owner: Neutral
Actor58: t17
Location: 49,31
Owner: Neutral
Actor59: tc01
Location: 58,31
Owner: Neutral
Actor60: tc01
Location: 60,37
Owner: Neutral
Actor61: tc02
Location: 48,39
Owner: Neutral
Actor62: t01
Location: 48,37
Owner: Neutral
Actor63: t06
Location: 41,52
Owner: Neutral
Actor64: t06
Location: 40,54
Owner: Neutral
Actor65: tc01
Location: 46,50
Owner: Neutral
Actor66: tc01
Location: 42,41
Owner: Neutral
Actor67: tc05
Location: 45,40
Owner: Neutral
Actor68: tc04
Location: 42,43
Owner: Neutral
Actor69: tc02
Location: 44,47
Owner: Neutral
Actor70: t02
Location: 45,44
Owner: Neutral
Actor71: t01
Location: 44,46
Owner: Neutral
Actor72: t07
Location: 44,44
Owner: Neutral
Actor73: t01
Location: 47,46
Owner: Neutral
Actor74: t16
Location: 45,50
Owner: Neutral
Actor75: tc02
Location: 48,47
Owner: Neutral
Actor76: t01
Location: 49,48
Owner: Neutral
Actor77: t01
Location: 56,45
Owner: Neutral
Actor78: tc05
Location: 56,41
Owner: Neutral
Actor79: tc04
Location: 58,45
Owner: Neutral
Actor80: t16
Location: 57,45
Owner: Neutral
Actor81: t01
Location: 39,51
Owner: Neutral
Actor82: t02
Location: 39,48
Owner: Neutral
Actor83: gun
Location: 46,55
Owner: BadGuy
Health: 0.5
Facing: 160
Actor84: gun
Location: 41,55
Owner: BadGuy
Health: 0.5
Facing: 160
Actor85: gun
Location: 49,55
Owner: BadGuy
Health: 0.1875
Facing: 160
Actor86: mcv
Location: 56,52
Owner: GoodGuy
Health: 1
Facing: 0
gunboat: boat
Location: 53,59
Owner: GoodGuy
Health: 1
Facing: 64
Actor88: e1
Location: 56,55
Owner: GoodGuy
Health: 1
Facing: 0
Actor89: e1
Location: 56,55
Owner: GoodGuy
Health: 1
Facing: 0
Actor90: e1
Location: 56,55
Owner: GoodGuy
Health: 1
Facing: 0
Actor91: e1
Location: 56,55
Owner: GoodGuy
Health: 1
Facing: 0
Actor92: e1
Location: 57,45
Owner: BadGuy
Health: 1
Facing: 160
Actor93: e1
Location: 56,41
Owner: BadGuy
Health: 1
Facing: 192
Actor94: e1
Location: 48,41
Owner: BadGuy
Health: 1
Facing: 96
Actor95: e1
Location: 59,45
Owner: BadGuy
Health: 1
Facing: 160
Actor96: e1
Location: 46,50
Owner: BadGuy
Health: 1
Facing: 96
Actor97: e1
Location: 48,47
Owner: BadGuy
Health: 1
Facing: 96
Actor98: e1
Location: 38,43
Owner: BadGuy
Health: 1
Facing: 128
Actor99: e1
Location: 38,43
Owner: BadGuy
Health: 1
Facing: 128
Actor100: e1
Location: 48,41
Owner: BadGuy
Health: 1
Facing: 96
Actor101: e1
Location: 41,39
Owner: BadGuy
Health: 1
Facing: 96
Waypoints:
spawn3: 58,53
spawn2: 52,55
spawn1: 38,55
spawn0: 37,46
Smudges:
Rules:
World:
LocalPlayerFromMap:
-CreateMPPlayers:
-SpawnMPUnits:
Gdi01Script:

View File

@@ -17,6 +17,7 @@ Packages:
mods/cnc/packages/desert.mix mods/cnc/packages/desert.mix
~mods/cnc/packages/movies-gdi.mix ~mods/cnc/packages/movies-gdi.mix
~mods/cnc/packages/movies-nod.mix ~mods/cnc/packages/movies-nod.mix
~mods/cnc/packages/scores.mix
Rules: Rules:
mods/cnc/defaults.yaml: Basic stuff mods/cnc/defaults.yaml: Basic stuff
@@ -59,6 +60,9 @@ Movies:
Voices: Voices:
mods/cnc/voices.yaml: mods/cnc/voices.yaml:
Music:
mods/cnc/music.yaml
TileSets: TileSets:
mods/cnc/tileset-des.yaml: Desert mods/cnc/tileset-des.yaml: Desert
mods/cnc/tileset-win.yaml: Winter mods/cnc/tileset-win.yaml: Winter

3
mods/cnc/music.yaml Normal file
View File

@@ -0,0 +1,3 @@
aoi:
Title: Act on Instinct
Length: 0

View File

@@ -105,7 +105,7 @@
</unit> </unit>
<!-- Hovercraft --> <!-- Hovercraft -->
<unit name="lst"> <unit name="lst">
<sequence name="idle" start="0" facings="4" /> <sequence name="idle" start="0" facings="1" />
</unit> </unit>
<!-- Gunboat --> <!-- Gunboat -->
<unit name="boat"> <unit name="boat">

View File

@@ -525,8 +525,8 @@ BOAT:
Armor: heavy Armor: heavy
Mobile: Mobile:
InitialFacing:64 InitialFacing:64
ROT: 0 ROT: 4
Speed: 8 Speed: 2
RevealsShroud: RevealsShroud:
Range: 7 Range: 7
Turreted: Turreted:
@@ -541,13 +541,16 @@ LST:
Valued: Valued:
Cost: 300 Cost: 300
Description: Landing Craft Description: Landing Craft
Mobile:
Crushes: crate
TerrainTypes: Clear, Rough, Road, Tree, Water, Rock, Wall, Ore, Beach, River
TerrainSpeeds: 100%, 100%, 100%, 100%, 100%, 100%, 100%, 100%, 100%, 100%
InitialFacing:0
ROT: 4
Speed: 30
Health: Health:
HP: 400 HP: 400
Armor: light Armor: light
Mobile:
InitialFacing:0
ROT: 0
Speed: 30
RevealsShroud: RevealsShroud:
Range: 7 Range: 7
RenderUnit: RenderUnit: