Skip to content

Commit

Permalink
Merge pull request #4 from abcdefg30/04apolish
Browse files Browse the repository at this point in the history
Polish nod04a a bit
  • Loading branch information
42foobar42 committed Apr 26, 2015
2 parents 81dd5e4 + b760e48 commit 9fd6cd5
Show file tree
Hide file tree
Showing 2 changed files with 71 additions and 77 deletions.
50 changes: 25 additions & 25 deletions mods/cnc/maps/nod04a/map.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -160,41 +160,41 @@ Actors:
Owner: Neutral
Actor32: v35
Location: 48,38
Owner: Neutral
Owner: NodSupporter
Actor33: v34
Location: 46,33
Owner: Neutral
Owner: NodSupporter
Actor35: v32
Location: 54,35
Owner: Neutral
Owner: NodSupporter
Actor36: v30
Location: 48,32
Owner: Neutral
Owner: NodSupporter
Actor37: v30
Location: 52,34
Owner: Neutral
Owner: NodSupporter
Actor38: v31
Location: 52,35
Owner: Neutral
Owner: NodSupporter
Actor39: v32
Location: 46,37
Owner: Neutral
Owner: NodSupporter
Health: 0.7265625
Actor41: v34
Location: 49,38
Owner: Neutral
Owner: NodSupporter
Actor42: v35
Location: 46,32
Owner: Neutral
Owner: NodSupporter
Actor43: v36
Location: 48,37
Owner: Neutral
Owner: NodSupporter
Actor44: v32
Location: 49,33
Owner: Neutral
Owner: NodSupporter
Actor45: v34
Location: 50,34
Owner: Neutral
Owner: NodSupporter
Actor46: v20
Location: 15,10
Owner: GDI
Expand Down Expand Up @@ -267,11 +267,6 @@ Actors:
Health: 0.8789063
Facing: 32
SubCell: 3
Actor87: e1
Location: 18,10
Owner: GDI
Facing: 160
SubCell: 2
Actor99: e1
Location: 45,15
Owner: GDI
Expand Down Expand Up @@ -354,11 +349,6 @@ Actors:
Health: 0.3789063
Facing: 64
SubCell: 0
Actor130: e1
Location: 38,9
Owner: GDI
Facing: 128
SubCell: 0
Actor131: e1
Location: 21,12
Owner: GDI
Expand Down Expand Up @@ -550,8 +540,18 @@ Actors:
Location: 47,34
Owner: NodSupporter
Facing: 192
SubCell: 2

SubCell: 2
Gciv1: e1
Location: 38,9
Owner: GDI
Facing: 128
SubCell: 0
Gciv2: e1
Location: 18,10
Owner: GDI
Facing: 160
SubCell: 2

Smudges:
sc6 37,24 0:
sc6 36,18 0:
Expand All @@ -561,7 +561,7 @@ Rules:
-ConquestVictoryConditions:
MissionObjectives:
EarlyGameOver: true
EnemyWatcher:
EnemyWatcher:
World:
-CrateSpawner:
-SpawnMPUnits:
Expand Down
98 changes: 46 additions & 52 deletions mods/cnc/maps/nod04a/nod04a.lua
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,14 @@ Atk6WaypointsPart2 = { waypoint7.Location, waypoint8.Location, waypoint7.Locatio
Atk5Waypoints = { waypoint0.Location, waypoint9.Location}
Atk3Waypoints = { waypoint0 }
Atk2Waypoints = { waypoint6 }
GcivWaypoints = { waypoint0, waypoint1, waypoint2, waypoint3, waypoint4, waypoint7, waypoint8 }
GcivWaypoints = { waypoint0, waypoint1, waypoint2, waypoint3, waypoint4 }
Atk1Waypoints = { waypoint0, waypoint1, waypoint2, waypoint3, waypoint4, waypoint5, waypoint6 }
Atk4Waypoints = { waypoint0, waypoint9 }

Atk6ActorTriggerActivator = { Civilian1, Civilian2 }
Atk5ActorTriggerActivator = { Soldier1, Soldier2, Soldier3, Actor105 }
WinActorTriggerActivator = { GDICiv1, GDICiv2, GDICiv3, GDICiv4, GDICiv5, GDICiv6, GDICiv7, GDICiv8, GDICiv9, GDICiv11, GDICiv12, GDICiv13 }
GcivActors = { Gcvi1, Gciv2, GDICiv2, GDICiv9, GDICiv10, GDICiv11 }

Atk2CellTriggerActivator = { CPos.New(41,22), CPos.New(40,22), CPos.New(39,22), CPos.New(41,21), CPos.New(40,21), CPos.New(39,21) }
Atk3CellTriggerActivator = { CPos.New(18,18), CPos.New(17,18), CPos.New(16,18), CPos.New(15,18), CPos.New(14,18), CPos.New(13,18), CPos.New(12,18), CPos.New(11,18), CPos.New(24,17), CPos.New(23,17), CPos.New(22,17), CPos.New(21,17), CPos.New(20,17), CPos.New(19,17), CPos.New(17,17), CPos.New(16,17), CPos.New(15,17), CPos.New(14,17), CPos.New(13,17), CPos.New(12,17), CPos.New(11,17) }
Expand All @@ -42,12 +43,12 @@ ZzzzTriggerFunctionTime = DateTime.Minutes(2) + DateTime.Seconds(30)
NodCiviliansActors = { NodCiv1, NodCiv2, NodCiv3, NodCiv4, NodCiv5, NodCiv6, NodCiv7, NodCiv8, NodCiv9 }

Atk6TriggerFunction = function()
Reinforcements.ReinforceWithTransport(GDI, 'apc', Atk6Units, Atk6WaypointsPart1, Atk6WaypointsPart2,
Reinforcements.ReinforceWithTransport(GDI, 'apc', Atk6Units, Atk6WaypointsPart1, Atk6WaypointsPart2,
function(transport, cargo)
Utils.Do(cargo, function(actor)
IdleHunt(actor)
end)
end,
end,
function(unit)
IdleHunt(unit)
end)
Expand All @@ -56,7 +57,7 @@ end
Atk5TriggerFunction = function ()
if not Atk5TriggerSwitch then
Atk5TriggerSwitch = true
Reinforcements.ReinforceWithTransport(GDI, 'apc', Atk5Units, Atk5Waypoints, nil,
Reinforcements.ReinforceWithTransport(GDI, 'apc', Atk5Units, Atk5Waypoints, nil,
function(transport, cargo)
transport.UnloadPassengers()
Utils.Do(cargo, function(actor)
Expand All @@ -70,34 +71,34 @@ Atk5TriggerFunction = function ()
end

Atk1TriggerFunction = function()
Reinforcements.Reinforce(GDI, Atk1Units, Spawnpoint, 15,
function(actor)
Reinforcements.Reinforce(GDI, Atk1Units, Spawnpoint, 15,
function(actor)
Atk1Movement(actor)
end)
end

XxxxTriggerFunction = function()
if not XxxxTriggerSwitch then
Reinforcements.Reinforce(GDI, XxxxUnits, Spawnpoint, 15,
function(actor)
Reinforcements.Reinforce(GDI, XxxxUnits, Spawnpoint, 15,
function(actor)
Atk2Movement(actor)
end)
end
end

YyyyTriggerFunction = function()
if not YyyyTriggerSwitch then
Reinforcements.Reinforce(GDI, YyyyUnits, Spawnpoint, 15,
function(actor)
Reinforcements.Reinforce(GDI, YyyyUnits, Spawnpoint, 15,
function(actor)
Atk4Movement(actor)
end)
end
end

ZzzzTriggerFunction = function()
if not ZzzzTriggerSwitch then
Reinforcements.ReinforceWithTransport(GDI, 'apc', ZzzzUnits, Atk5Waypoints, nil,
function(transport, cargo)
Reinforcements.ReinforceWithTransport(GDI, 'apc', ZzzzUnits, Atk5Waypoints, nil,
function(transport, cargo)
transport.UnloadPassengers()
Utils.Do(cargo, function(actor)
IdleHunt(actor)
Expand Down Expand Up @@ -134,7 +135,6 @@ GcivMovement = function(unit)
Utils.Do(GcivWaypoints, function(waypoint)
unit.AttackMove(waypoint.Location)
end)
IdleHunt(unit)
end

Atk4Movement = function(unit)
Expand All @@ -145,7 +145,7 @@ Atk4Movement = function(unit)
end

InsertNodUnits = function()
Reinforcements.Reinforce(Nod, NodUnitsBuggy, { UnitsEntryBuggy.Location, UnitsRallyBuggy.Location }, 15)
Reinforcements.Reinforce(Nod, NodUnitsBuggy, { UnitsEntryBuggy.Location, UnitsRallyBuggy.Location }, 11)
Reinforcements.Reinforce(Nod, NodUnitsBikes, { UnitsEntryBikes.Location, UnitsRallyBikes.Location }, 15)
Reinforcements.Reinforce(Nod, NodUnitsGunner, { UnitsEntryGunner.Location, UnitsRallyGunner.Location }, 15)
Reinforcements.Reinforce(Nod, NodUnitsRocket, { UnitsEntryRocket.Location, UnitsRallyRocket.Location }, 15)
Expand All @@ -155,10 +155,17 @@ CreateCivilians = function(actor, discoverer)
Utils.Do(NodCiviliansActors, function(actor)
actor.Owner = Nod
end)

NodObjective2 = Nod.AddPrimaryObjective("Protect the civilians that support Nod.")
Trigger.OnAllKilled(NodCiviliansActors, function()
Nod.MarkFailedObjective(NodObjective2)
end)

Utils.Do(GcivActors, function(actor)
actor.AttackMove(waypoint7.Location)
actor.AttackMove(waypoint8.Location)
IdleHunt(actor)
end)
end

WorldLoaded = function()
Expand All @@ -179,22 +186,25 @@ WorldLoaded = function()
Trigger.OnPlayerWon(Nod, function()
Media.PlaySpeechNotification(Nod, "Win")
end)

Trigger.OnPlayerLost(Nod, function()
Media.PlaySpeechNotification(Nod, "Lose")
end)

Trigger.OnAnyKilled(Atk6ActorTriggerActivator, Atk6TriggerFunction)

OnAnyDamaged(Atk5ActorTriggerActivator, Atk5TriggerFunction)

Trigger.OnEnteredFootprint(Atk3CellTriggerActivator, function(a, id)
if a.Owner == Nod then
for type, count in pairs({ ['e1'] = 3, ['e2'] = 2, ['mtnk'] = 1 }) do
local myActors = Utils.Take(count, GDI.GetActorsByType(type))
Utils.Do(myActors, function(actor)
Atk3Movement(actor)
end)
end

Atk3TriggerCounter = Atk3TriggerCounter - 1
MyActors = getActors(GDI, { ['e1'] = 3, ['e2'] = 2, ['mtnk'] = 1 })
Utils.Do(MyActors, function(actor)
Atk3Movement(actor)
end)
if Atk3TriggerCounter < 0 then
Trigger.RemoveFootprintTrigger(id)
end
Expand All @@ -203,7 +213,7 @@ WorldLoaded = function()

Trigger.OnEnteredFootprint(Atk2CellTriggerActivator, function(a, id)
if a.Owner == Nod then
MyActors = getActors(GDI, { ['jeep'] = 1 })
MyActors = Utils.Take(1, GDI.GetActorsByType('jeep'))
Utils.Do(MyActors, function(actor)
Atk2Movement(actor)
end)
Expand All @@ -213,8 +223,7 @@ WorldLoaded = function()

Trigger.OnEnteredFootprint(GcivCellTriggerActivator, function(a, id)
if a.Owner == Nod then
MyActors = getActors(GDI, { ['e1'] = 2,['c1'] = 1,['c2'] = 1,['c3'] = 1,['c4'] = 1 })
Utils.Do(MyActors, function(actor)
Utils.Do(GcivActors, function(actor)
GcivMovement(actor)
end)
Trigger.RemoveFootprintTrigger(id)
Expand All @@ -225,10 +234,12 @@ WorldLoaded = function()

Trigger.OnEnteredFootprint(Atk4CellTriggerActivator, function(a, id)
if a.Owner == Nod then
MyActors = getActors(GDI, { ['e1'] = 2,['e2'] = 1 })
Utils.Do(MyActors, function(actor)
Atk4Movement(actor)
end)
for type, count in pairs({ ['e1'] = 2,['e2'] = 1 }) do
local myActors = Utils.Take(count, GDI.GetActorsByType(type))
Utils.Do(myActors, function(actor)
Atk4Movement(actor)
end)
end
Trigger.RemoveFootprintTrigger(id)
end
end)
Expand Down Expand Up @@ -262,9 +273,11 @@ WorldLoaded = function()

Trigger.OnAllKilled(WinActorTriggerActivator, function()
Nod.MarkCompletedObjective(NodObjective1)
Nod.MarkCompletedObjective(NodObjective2)
if NodObjective2 then
Nod.MarkCompletedObjective(NodObjective2)
end
end)

GDIObjective = GDI.AddPrimaryObjective("Eliminate all Nod forces in the area.")
NodObjective1 = Nod.AddPrimaryObjective("Kill all civilian which support the GDI.")

Expand All @@ -285,27 +298,8 @@ OnAnyDamaged = function(actors, func)
end)
end

IdleHunt = function(unit)
if not unit.IsDead then
Trigger.OnIdle(unit, unit.Hunt)
end
end

getActors = function(owner, units)
local maxUnits = 0
local actors = { }
for type, count in pairs(units) do
local globalActors = Map.ActorsInBox(Map.TopLeft, Map.BottomRight, function(actor)
return actor.Owner == owner and actor.Type == type and not actor.IsDead
end)
if #globalActors < count then
maxUnits = #globalActors
else
maxUnits = count
end
for i = 1, maxUnits, 1 do
actors[#actors + 1] = globalActors[i]
end
IdleHunt = function(unit)
if not unit.IsDead then
Trigger.OnIdle(unit, unit.Hunt)
end
return actors
end
end

0 comments on commit 9fd6cd5

Please sign in to comment.