replace GDI/Nod player reference variables with player/enemy

fixes unit production in nod02a and nod02b (killed infantry wouldn't get rebuilt)
This commit is contained in:
clemty
2015-09-27 21:18:10 +02:00
parent 8495c1e2a4
commit 6e315a815c
15 changed files with 463 additions and 463 deletions

View File

@@ -4,7 +4,7 @@ BikeReinforcments = { "bike" }
ReinforceWithLandingCraft = function(units, transportStart, transportUnload, rallypoint) ReinforceWithLandingCraft = function(units, transportStart, transportUnload, rallypoint)
local transport = Actor.Create("oldlst", true, { Owner = nod, Facing = 0, Location = transportStart }) local transport = Actor.Create("oldlst", true, { Owner = player, Facing = 0, Location = transportStart })
local subcell = 0 local subcell = 0
Utils.Do(units, function(a) Utils.Do(units, function(a)
transport.LoadPassenger(Actor.Create(a, false, { Owner = transport.Owner, Facing = transport.Facing, Location = transportUnload, SubCell = subcell })) transport.LoadPassenger(Actor.Create(a, false, { Owner = transport.Owner, Facing = transport.Facing, Location = transportUnload, SubCell = subcell }))
@@ -33,41 +33,41 @@ ReinforceWithLandingCraft = function(units, transportStart, transportUnload, ral
end end
WorldLoaded = function() WorldLoaded = function()
nod = Player.GetPlayer("Nod") player = Player.GetPlayer("Nod")
dinosaur = Player.GetPlayer("Dinosaur") dinosaur = Player.GetPlayer("Dinosaur")
civilian = Player.GetPlayer("Civilian") civilian = Player.GetPlayer("Civilian")
InvestigateObj = nod.AddPrimaryObjective("Investigate the nearby village for reports of \nstrange activity.") InvestigateObj = player.AddPrimaryObjective("Investigate the nearby village for reports of \nstrange activity.")
Trigger.OnObjectiveAdded(nod, function(p, id) Trigger.OnObjectiveAdded(player, function(p, id)
Media.DisplayMessage(p.GetObjectiveDescription(id), "New " .. string.lower(p.GetObjectiveType(id)) .. " objective") Media.DisplayMessage(p.GetObjectiveDescription(id), "New " .. string.lower(p.GetObjectiveType(id)) .. " objective")
end) end)
Trigger.OnObjectiveCompleted(nod, function(p, id) Trigger.OnObjectiveCompleted(player, function(p, id)
Media.DisplayMessage(p.GetObjectiveDescription(id), "Objective completed") Media.DisplayMessage(p.GetObjectiveDescription(id), "Objective completed")
end) end)
Trigger.OnObjectiveFailed(nod, function(p, id) Trigger.OnObjectiveFailed(player, function(p, id)
Media.DisplayMessage(p.GetObjectiveDescription(id), "Objective failed") Media.DisplayMessage(p.GetObjectiveDescription(id), "Objective failed")
end) end)
Trigger.OnPlayerWon(nod, function() Trigger.OnPlayerWon(player, function()
Media.PlaySpeechNotification(nod, "Win") Media.PlaySpeechNotification(player, "Win")
end) end)
Trigger.OnPlayerLost(nod, function() Trigger.OnPlayerLost(player, function()
Media.PlaySpeechNotification(nod, "Lose") Media.PlaySpeechNotification(player, "Lose")
end) end)
ReachVillageObj = nod.AddPrimaryObjective("Reach the village.") ReachVillageObj = player.AddPrimaryObjective("Reach the village.")
Trigger.OnPlayerDiscovered(civilian, function(_, discoverer) Trigger.OnPlayerDiscovered(civilian, function(_, discoverer)
if discoverer == nod and not nod.IsObjectiveCompleted(ReachVillageObj) then if discoverer == player and not player.IsObjectiveCompleted(ReachVillageObj) then
if not dinosaur.HasNoRequiredUnits() then if not dinosaur.HasNoRequiredUnits() then
KillDinos = nod.AddPrimaryObjective("Kill all creatures in the area.") KillDinos = player.AddPrimaryObjective("Kill all creatures in the area.")
end end
nod.MarkCompletedObjective(ReachVillageObj) player.MarkCompletedObjective(ReachVillageObj)
end end
end) end)
@@ -89,12 +89,12 @@ end
Tick = function() Tick = function()
if InitialUnitsArrived then if InitialUnitsArrived then
if nod.HasNoRequiredUnits() then if player.HasNoRequiredUnits() then
nod.MarkFailedObjective(InvestigateObj) player.MarkFailedObjective(InvestigateObj)
end end
if dinosaur.HasNoRequiredUnits() then if dinosaur.HasNoRequiredUnits() then
if KillDinos then nod.MarkCompletedObjective(KillDinos) end if KillDinos then player.MarkCompletedObjective(KillDinos) end
nod.MarkCompletedObjective(InvestigateObj) player.MarkCompletedObjective(InvestigateObj)
end end
end end
end end

View File

@@ -17,7 +17,7 @@ NodHelis = {
} }
SendHeli = function(heli) SendHeli = function(heli)
units = Reinforcements.ReinforceWithTransport(nod, "tran", heli[3], heli[2], { heli[2][1] }) units = Reinforcements.ReinforceWithTransport(enemy, "tran", heli[3], heli[2], { heli[2][1] })
Utils.Do(units[2], function(actor) Utils.Do(units[2], function(actor)
actor.Hunt() actor.Hunt()
Trigger.OnIdle(actor, actor.Hunt) Trigger.OnIdle(actor, actor.Hunt)
@@ -27,8 +27,8 @@ SendHeli = function(heli)
end end
SendGDIReinforcements = function() SendGDIReinforcements = function()
Media.PlaySpeechNotification(gdi, "Reinforce") Media.PlaySpeechNotification(player, "Reinforce")
Reinforcements.ReinforceWithTransport(gdi, "apc", GDIReinforcements, GDIReinforcementsWaypoints, nil, function(apc, team) Reinforcements.ReinforceWithTransport(player, "apc", GDIReinforcements, GDIReinforcementsWaypoints, nil, function(apc, team)
table.insert(team, apc) table.insert(team, apc)
Trigger.OnAllKilled(team, function() Trigger.AfterDelay(DateTime.Seconds(5), SendGDIReinforcements) end) Trigger.OnAllKilled(team, function() Trigger.AfterDelay(DateTime.Seconds(5), SendGDIReinforcements) end)
Utils.Do(team, function(unit) unit.Stance = "Defend" end) Utils.Do(team, function(unit) unit.Stance = "Defend" end)
@@ -75,62 +75,62 @@ KillCounter = function() kills = kills + 1 end
ReinforcementsSent = false ReinforcementsSent = false
Tick = function() Tick = function()
nod.Cash = 1000 enemy.Cash = 1000
if not ReinforcementsSent and kills >= KillsUntilReinforcements then if not ReinforcementsSent and kills >= KillsUntilReinforcements then
ReinforcementsSent = true ReinforcementsSent = true
gdi.MarkCompletedObjective(reinforcementsObjective) player.MarkCompletedObjective(reinforcementsObjective)
SendGDIReinforcements() SendGDIReinforcements()
end end
if gdi.HasNoRequiredUnits() then if player.HasNoRequiredUnits() then
Trigger.AfterDelay(DateTime.Seconds(1), function() gdi.MarkFailedObjective(gdiObjective) end) Trigger.AfterDelay(DateTime.Seconds(1), function() player.MarkFailedObjective(gdiObjective) end)
end end
end end
SetupWorld = function() SetupWorld = function()
Utils.Do(nod.GetGroundAttackers(nod), function(unit) Utils.Do(enemy.GetGroundAttackers(enemy), function(unit)
Trigger.OnKilled(unit, KillCounter) Trigger.OnKilled(unit, KillCounter)
end) end)
Utils.Do(gdi.GetGroundAttackers(), function(unit) Utils.Do(player.GetGroundAttackers(), function(unit)
unit.Stance = "Defend" unit.Stance = "Defend"
end) end)
Hunter1.Hunt() Hunter1.Hunt()
Hunter2.Hunt() Hunter2.Hunt()
Trigger.OnRemovedFromWorld(crate, function() gdi.MarkCompletedObjective(gdiObjective) end) Trigger.OnRemovedFromWorld(crate, function() player.MarkCompletedObjective(gdiObjective) end)
end end
WorldLoaded = function() WorldLoaded = function()
gdi = Player.GetPlayer("GDI") player = Player.GetPlayer("GDI")
nod = Player.GetPlayer("Nod") enemy = Player.GetPlayer("Nod")
SetupWorld() SetupWorld()
Trigger.OnObjectiveAdded(gdi, function(p, id) Trigger.OnObjectiveAdded(player, function(p, id)
Media.DisplayMessage(p.GetObjectiveDescription(id), "New " .. string.lower(p.GetObjectiveType(id)) .. " objective") Media.DisplayMessage(p.GetObjectiveDescription(id), "New " .. string.lower(p.GetObjectiveType(id)) .. " objective")
end) end)
Trigger.OnObjectiveCompleted(gdi, function(p, id) Trigger.OnObjectiveCompleted(player, function(p, id)
Media.DisplayMessage(p.GetObjectiveDescription(id), "Objective completed") Media.DisplayMessage(p.GetObjectiveDescription(id), "Objective completed")
end) end)
Trigger.OnObjectiveFailed(gdi, function(p, id) Trigger.OnObjectiveFailed(player, function(p, id)
Media.DisplayMessage(p.GetObjectiveDescription(id), "Objective failed") Media.DisplayMessage(p.GetObjectiveDescription(id), "Objective failed")
end) end)
Trigger.OnPlayerWon(gdi, function() Trigger.OnPlayerWon(player, function()
Media.PlaySpeechNotification(gdi, "Win") Media.PlaySpeechNotification(player, "Win")
end) end)
Trigger.OnPlayerLost(gdi, function() Trigger.OnPlayerLost(player, function()
Media.PlaySpeechNotification(gdi, "Lose") Media.PlaySpeechNotification(player, "Lose")
end) end)
gdiObjective = gdi.AddPrimaryObjective("Retrieve the crate with the stolen rods.") gdiObjective = player.AddPrimaryObjective("Retrieve the crate with the stolen rods.")
reinforcementsObjective = gdi.AddSecondaryObjective("Eliminate " .. KillsUntilReinforcements .. " Nod units for reinforcements.") reinforcementsObjective = player.AddSecondaryObjective("Eliminate " .. KillsUntilReinforcements .. " Nod units for reinforcements.")
nod.AddPrimaryObjective("Defend against the GDI forces.") enemy.AddPrimaryObjective("Defend against the GDI forces.")
BuildNod1() BuildNod1()
Utils.Do(NodHelis, function(heli) Utils.Do(NodHelis, function(heli)
@@ -139,7 +139,7 @@ WorldLoaded = function()
autoTrigger = false autoTrigger = false
Trigger.OnEnteredFootprint(AutoTrigger, function(a, id) Trigger.OnEnteredFootprint(AutoTrigger, function(a, id)
if not autoTrigger and a.Owner == gdi then if not autoTrigger and a.Owner == player then
autoTrigger = true autoTrigger = true
Trigger.RemoveFootprintTrigger(id) Trigger.RemoveFootprintTrigger(id)
BuildAuto1() BuildAuto1()
@@ -148,10 +148,10 @@ WorldLoaded = function()
gdiHeliTrigger = false gdiHeliTrigger = false
Trigger.OnEnteredFootprint(GDIHeliTrigger, function(a, id) Trigger.OnEnteredFootprint(GDIHeliTrigger, function(a, id)
if not gdiHeliTrigger and a.Owner == gdi then if not gdiHeliTrigger and a.Owner == player then
gdiHeliTrigger = true gdiHeliTrigger = true
Trigger.RemoveFootprintTrigger(id) Trigger.RemoveFootprintTrigger(id)
Reinforcements.ReinforceWithTransport(gdi, "tran", nil, { GDIHeliEntry.Location, GDIHeliLZ.Location }) Reinforcements.ReinforceWithTransport(player, "tran", nil, { GDIHeliEntry.Location, GDIHeliLZ.Location })
end end
end) end)

View File

@@ -16,7 +16,7 @@ GDIReinforcementsWaypoints = { GDIReinforcementsEntry.Location, GDIReinforcement
NodHeli = { { HeliEntry.Location, NodHeliLZ.Location }, { "e1", "e1", "e3", "e3" } } NodHeli = { { HeliEntry.Location, NodHeliLZ.Location }, { "e1", "e1", "e3", "e3" } }
SendHeli = function(heli) SendHeli = function(heli)
units = Reinforcements.ReinforceWithTransport(nod, "tran", heli[2], heli[1], { heli[1][1] }) units = Reinforcements.ReinforceWithTransport(enemy, "tran", heli[2], heli[1], { heli[1][1] })
Utils.Do(units[2], function(actor) Utils.Do(units[2], function(actor)
actor.Hunt() actor.Hunt()
Trigger.OnIdle(actor, actor.Hunt) Trigger.OnIdle(actor, actor.Hunt)
@@ -25,8 +25,8 @@ SendHeli = function(heli)
end end
SendGDIReinforcements = function() SendGDIReinforcements = function()
Media.PlaySpeechNotification(gdi, "Reinforce") Media.PlaySpeechNotification(player, "Reinforce")
Reinforcements.ReinforceWithTransport(gdi, "apc", GDIReinforcements, GDIReinforcementsWaypoints, nil, function(apc, team) Reinforcements.ReinforceWithTransport(player, "apc", GDIReinforcements, GDIReinforcementsWaypoints, nil, function(apc, team)
table.insert(team, apc) table.insert(team, apc)
Trigger.OnAllKilled(team, function() Trigger.AfterDelay(DateTime.Seconds(5), SendGDIReinforcements) end) Trigger.OnAllKilled(team, function() Trigger.AfterDelay(DateTime.Seconds(5), SendGDIReinforcements) end)
Utils.Do(team, function(unit) unit.Stance = "Defend" end) Utils.Do(team, function(unit) unit.Stance = "Defend" end)
@@ -81,66 +81,66 @@ ReinforcementsSent = false
kills = 0 kills = 0
KillCounter = function() kills = kills + 1 end KillCounter = function() kills = kills + 1 end
Tick = function() Tick = function()
nod.Cash = 1000 enemy.Cash = 1000
if not ReinforcementsSent and kills >= KillsUntilReinforcements then if not ReinforcementsSent and kills >= KillsUntilReinforcements then
ReinforcementsSent = true ReinforcementsSent = true
gdi.MarkCompletedObjective(reinforcementsObjective) player.MarkCompletedObjective(reinforcementsObjective)
SendGDIReinforcements() SendGDIReinforcements()
end end
if gdi.HasNoRequiredUnits() then if player.HasNoRequiredUnits() then
Trigger.AfterDelay(DateTime.Seconds(1), function() Trigger.AfterDelay(DateTime.Seconds(1), function()
gdi.MarkFailedObjective(gdiObjective) player.MarkFailedObjective(gdiObjective)
end) end)
end end
end end
SetupWorld = function() SetupWorld = function()
Utils.Do(nod.GetGroundAttackers(), function(unit) Utils.Do(enemy.GetGroundAttackers(), function(unit)
Trigger.OnKilled(unit, KillCounter) Trigger.OnKilled(unit, KillCounter)
end) end)
Utils.Do(gdi.GetGroundAttackers(), function(unit) Utils.Do(player.GetGroundAttackers(), function(unit)
unit.Stance = "Defend" unit.Stance = "Defend"
end) end)
Utils.Do(Hunters, function(actor) actor.Hunt() end) Utils.Do(Hunters, function(actor) actor.Hunt() end)
Trigger.OnRemovedFromWorld(crate, function() gdi.MarkCompletedObjective(gdiObjective) end) Trigger.OnRemovedFromWorld(crate, function() player.MarkCompletedObjective(gdiObjective) end)
end end
WorldLoaded = function() WorldLoaded = function()
gdi = Player.GetPlayer("GDI") player = Player.GetPlayer("GDI")
nod = Player.GetPlayer("Nod") enemy = Player.GetPlayer("Nod")
Trigger.OnObjectiveAdded(gdi, function(p, id) Trigger.OnObjectiveAdded(player, function(p, id)
Media.DisplayMessage(p.GetObjectiveDescription(id), "New " .. string.lower(p.GetObjectiveType(id)) .. " objective") Media.DisplayMessage(p.GetObjectiveDescription(id), "New " .. string.lower(p.GetObjectiveType(id)) .. " objective")
end) end)
Trigger.OnObjectiveCompleted(gdi, function(p, id) Trigger.OnObjectiveCompleted(player, function(p, id)
Media.DisplayMessage(p.GetObjectiveDescription(id), "Objective completed") Media.DisplayMessage(p.GetObjectiveDescription(id), "Objective completed")
end) end)
Trigger.OnObjectiveFailed(gdi, function(p, id) Trigger.OnObjectiveFailed(player, function(p, id)
Media.DisplayMessage(p.GetObjectiveDescription(id), "Objective failed") Media.DisplayMessage(p.GetObjectiveDescription(id), "Objective failed")
end) end)
Trigger.OnPlayerWon(gdi, function() Trigger.OnPlayerWon(player, function()
Media.PlaySpeechNotification(gdi, "Win") Media.PlaySpeechNotification(player, "Win")
end) end)
Trigger.OnPlayerLost(gdi, function() Trigger.OnPlayerLost(player, function()
Media.PlaySpeechNotification(gdi, "Lose") Media.PlaySpeechNotification(player, "Lose")
end) end)
gdiObjective = gdi.AddPrimaryObjective("Retrieve the crate with the stolen rods.") gdiObjective = player.AddPrimaryObjective("Retrieve the crate with the stolen rods.")
reinforcementsObjective = gdi.AddSecondaryObjective("Eliminate " .. KillsUntilReinforcements .. " Nod units for reinforcements.") reinforcementsObjective = player.AddSecondaryObjective("Eliminate " .. KillsUntilReinforcements .. " Nod units for reinforcements.")
nod.AddPrimaryObjective("Defend against the GDI forces.") enemy.AddPrimaryObjective("Defend against the GDI forces.")
SetupWorld() SetupWorld()
bhndTrigger = false bhndTrigger = false
Trigger.OnExitedFootprint(BhndTrigger, function(a, id) Trigger.OnExitedFootprint(BhndTrigger, function(a, id)
if not bhndTrigger and a.Owner == gdi then if not bhndTrigger and a.Owner == player then
bhndTrigger = true bhndTrigger = true
Trigger.RemoveFootprintTrigger(id) Trigger.RemoveFootprintTrigger(id)
SendHeli(NodHeli) SendHeli(NodHeli)
@@ -149,7 +149,7 @@ WorldLoaded = function()
atk1Trigger = false atk1Trigger = false
Trigger.OnExitedFootprint(Atk1Trigger, function(a, id) Trigger.OnExitedFootprint(Atk1Trigger, function(a, id)
if not atk1Trigger and a.Owner == gdi then if not atk1Trigger and a.Owner == player then
atk1Trigger = true atk1Trigger = true
Trigger.RemoveFootprintTrigger(id) Trigger.RemoveFootprintTrigger(id)
BuildNod1() BuildNod1()
@@ -158,7 +158,7 @@ WorldLoaded = function()
atk2Trigger = false atk2Trigger = false
Trigger.OnEnteredFootprint(Atk2Trigger, function(a, id) Trigger.OnEnteredFootprint(Atk2Trigger, function(a, id)
if not atk2Trigger and a.Owner == gdi then if not atk2Trigger and a.Owner == player then
atk2Trigger = true atk2Trigger = true
Trigger.RemoveFootprintTrigger(id) Trigger.RemoveFootprintTrigger(id)
BuildNod2() BuildNod2()
@@ -167,7 +167,7 @@ WorldLoaded = function()
autoTrigger = false autoTrigger = false
Trigger.OnEnteredFootprint(AutoTrigger, function(a, id) Trigger.OnEnteredFootprint(AutoTrigger, function(a, id)
if not autoTrigger and a.Owner == gdi then if not autoTrigger and a.Owner == player then
autoTrigger = true autoTrigger = true
Trigger.RemoveFootprintTrigger(id) Trigger.RemoveFootprintTrigger(id)
BuildAuto() BuildAuto()
@@ -179,10 +179,10 @@ WorldLoaded = function()
gdiHeliTrigger = false gdiHeliTrigger = false
Trigger.OnEnteredFootprint(GDIHeliTrigger, function(a, id) Trigger.OnEnteredFootprint(GDIHeliTrigger, function(a, id)
if not gdiHeliTrigger and a.Owner == gdi then if not gdiHeliTrigger and a.Owner == player then
gdiHeliTrigger = true gdiHeliTrigger = true
Trigger.RemoveFootprintTrigger(id) Trigger.RemoveFootprintTrigger(id)
Reinforcements.ReinforceWithTransport(gdi, "tran", nil, { HeliEntry.Location, GDIHeliLZ.Location }) Reinforcements.ReinforceWithTransport(player, "tran", nil, { HeliEntry.Location, GDIHeliLZ.Location })
end end
end) end)

View File

@@ -36,12 +36,12 @@ TownAttackAction = function(actor)
end end
AttackTown = function() AttackTown = function()
Reinforcements.Reinforce(nod, TownAttackWave1, { NodReinfEntry.Location, NodReinfRally.Location }, DateTime.Seconds(0.25), TownAttackAction) Reinforcements.Reinforce(enemy, TownAttackWave1, { NodReinfEntry.Location, NodReinfRally.Location }, DateTime.Seconds(0.25), TownAttackAction)
Trigger.AfterDelay(DateTime.Seconds(2), function() Trigger.AfterDelay(DateTime.Seconds(2), function()
Reinforcements.Reinforce(nod, TownAttackWave2, { NodReinfEntry.Location, NodReinfRally.Location }, DateTime.Seconds(1), TownAttackAction) Reinforcements.Reinforce(enemy, TownAttackWave2, { NodReinfEntry.Location, NodReinfRally.Location }, DateTime.Seconds(1), TownAttackAction)
end) end)
Trigger.AfterDelay(DateTime.Seconds(4), function() Trigger.AfterDelay(DateTime.Seconds(4), function()
Reinforcements.Reinforce(nod, TownAttackWave3, { NodReinfEntry.Location, NodReinfRally.Location }, DateTime.Seconds(1), TownAttackAction) Reinforcements.Reinforce(enemy, TownAttackWave3, { NodReinfEntry.Location, NodReinfRally.Location }, DateTime.Seconds(1), TownAttackAction)
end) end)
end end
@@ -63,7 +63,7 @@ end
WorldLoaded = function() WorldLoaded = function()
player = Player.GetPlayer("GDI") player = Player.GetPlayer("GDI")
nod = Player.GetPlayer("Nod") enemy = Player.GetPlayer("Nod")
Trigger.OnObjectiveAdded(player, function(p, id) Trigger.OnObjectiveAdded(player, function(p, id)
Media.DisplayMessage(p.GetObjectiveDescription(id), "New " .. string.lower(p.GetObjectiveType(id)) .. " objective") Media.DisplayMessage(p.GetObjectiveDescription(id), "New " .. string.lower(p.GetObjectiveType(id)) .. " objective")
@@ -87,7 +87,7 @@ WorldLoaded = function()
Media.PlaySpeechNotification(player, "Lose") Media.PlaySpeechNotification(player, "Lose")
end) end)
nodObjective = nod.AddPrimaryObjective("Destroy all GDI troops.") nodObjective = enemy.AddPrimaryObjective("Destroy all GDI troops.")
gdiObjective1 = player.AddPrimaryObjective("Defend the town of Białystok.") gdiObjective1 = player.AddPrimaryObjective("Defend the town of Białystok.")
gdiObjective2 = player.AddPrimaryObjective("Eliminate all Nod forces in the area.") gdiObjective2 = player.AddPrimaryObjective("Eliminate all Nod forces in the area.")
@@ -123,9 +123,9 @@ end
Tick = function() Tick = function()
if player.HasNoRequiredUnits() then if player.HasNoRequiredUnits() then
nod.MarkCompletedObjective(nodObjective) enemy.MarkCompletedObjective(nodObjective)
end end
if nod.HasNoRequiredUnits() then if enemy.HasNoRequiredUnits() then
player.MarkCompletedObjective(gdiObjective1) player.MarkCompletedObjective(gdiObjective1)
player.MarkCompletedObjective(gdiObjective2) player.MarkCompletedObjective(gdiObjective2)
end end

View File

@@ -56,7 +56,7 @@ AttackPaths =
} }
Build = function(factory, units, action) Build = function(factory, units, action)
if factory.IsDead or factory.Owner ~= nod then if factory.IsDead or factory.Owner ~= enemy then
return return
end end
@@ -72,7 +72,7 @@ Attack = function()
local path = Utils.Random(AttackPaths) local path = Utils.Random(AttackPaths)
Build(types[1], types[2], function(units) Build(types[1], types[2], function(units)
Utils.Do(units, function(unit) Utils.Do(units, function(unit)
if unit.Owner ~= nod then return end if unit.Owner ~= enemy then return end
unit.Patrol(path, false) unit.Patrol(path, false)
Trigger.OnIdle(unit, unit.Hunt) Trigger.OnIdle(unit, unit.Hunt)
end) end)
@@ -84,7 +84,7 @@ end
Grd1Action = function() Grd1Action = function()
Build(Airfield, Grd1UnitTypes, function(units) Build(Airfield, Grd1UnitTypes, function(units)
Utils.Do(units, function(unit) Utils.Do(units, function(unit)
if unit.Owner ~= nod then return end if unit.Owner ~= enemy then return end
Trigger.OnKilled(unit, function() Trigger.OnKilled(unit, function()
Trigger.AfterDelay(Grd1Delay[Map.Difficulty], Grd1Action) Trigger.AfterDelay(Grd1Delay[Map.Difficulty], Grd1Action)
end) end)
@@ -96,7 +96,7 @@ end
Grd2Action = function() Grd2Action = function()
Build(Airfield, Grd2UnitTypes, function(units) Build(Airfield, Grd2UnitTypes, function(units)
Utils.Do(units, function(unit) Utils.Do(units, function(unit)
if unit.Owner ~= nod then return end if unit.Owner ~= enemy then return end
unit.Patrol(Grd2Path, true, DateTime.Seconds(5)) unit.Patrol(Grd2Path, true, DateTime.Seconds(5))
end) end)
end) end)
@@ -121,19 +121,19 @@ Grd3Action = function()
end end
DiscoverGdiBase = function(actor, discoverer) DiscoverGdiBase = function(actor, discoverer)
if baseDiscovered or not discoverer == gdi then if baseDiscovered or not discoverer == player then
return return
end end
Utils.Do(GdiBase, function(actor) Utils.Do(GdiBase, function(actor)
actor.Owner = gdi actor.Owner = player
end) end)
GdiHarv.FindResources() GdiHarv.FindResources()
baseDiscovered = true baseDiscovered = true
gdiObjective3 = gdi.AddPrimaryObjective("Eliminate all Nod forces in the area.") gdiObjective3 = player.AddPrimaryObjective("Eliminate all Nod forces in the area.")
gdi.MarkCompletedObjective(gdiObjective1) player.MarkCompletedObjective(gdiObjective1)
Attack() Attack()
end end
@@ -143,17 +143,17 @@ SetupWorld = function()
unit.Destroy() unit.Destroy()
end) end)
Media.PlaySpeechNotification(gdi, "Reinforce") Media.PlaySpeechNotification(player, "Reinforce")
Reinforcements.Reinforce(gdi, GdiTanks, { GdiTankEntry.Location, GdiTankRallyPoint.Location }, DateTime.Seconds(1), function(actor) actor.Stance = "Defend" end) Reinforcements.Reinforce(player, GdiTanks, { GdiTankEntry.Location, GdiTankRallyPoint.Location }, DateTime.Seconds(1), function(actor) actor.Stance = "Defend" end)
Reinforcements.Reinforce(gdi, GdiApc, { GdiApcEntry.Location, GdiApcRallyPoint.Location }, DateTime.Seconds(1), function(actor) actor.Stance = "Defend" end) Reinforcements.Reinforce(player, GdiApc, { GdiApcEntry.Location, GdiApcRallyPoint.Location }, DateTime.Seconds(1), function(actor) actor.Stance = "Defend" end)
Reinforcements.Reinforce(gdi, GdiInfantry, { GdiInfantryEntry.Location, GdiInfantryRallyPoint.Location }, 15, function(actor) actor.Stance = "Defend" end) Reinforcements.Reinforce(player, GdiInfantry, { GdiInfantryEntry.Location, GdiInfantryRallyPoint.Location }, 15, function(actor) actor.Stance = "Defend" end)
Trigger.OnPlayerDiscovered(gdiBase, DiscoverGdiBase) Trigger.OnPlayerDiscovered(gdiBase, DiscoverGdiBase)
Utils.Do(Map.NamedActors, function(actor) Utils.Do(Map.NamedActors, function(actor)
if actor.Owner == nod and actor.HasProperty("StartBuildingRepairs") then if actor.Owner == enemy and actor.HasProperty("StartBuildingRepairs") then
Trigger.OnDamaged(actor, function(building) Trigger.OnDamaged(actor, function(building)
if building.Owner == nod and building.Health < RepairThreshold[Map.Difficulty] * building.MaxHealth then if building.Owner == enemy and building.Health < RepairThreshold[Map.Difficulty] * building.MaxHealth then
building.StartBuildingRepairs() building.StartBuildingRepairs()
end end
end) end)
@@ -161,15 +161,15 @@ SetupWorld = function()
end) end)
Trigger.OnAllKilled(NodSams, function() Trigger.OnAllKilled(NodSams, function()
gdi.MarkCompletedObjective(gdiObjective2) player.MarkCompletedObjective(gdiObjective2)
Actor.Create("airstrike.proxy", true, { Owner = gdi }) Actor.Create("airstrike.proxy", true, { Owner = player })
end) end)
GdiHarv.Stop() GdiHarv.Stop()
NodHarv.FindResources() NodHarv.FindResources()
if Map.Difficulty ~= "Easy" then if Map.Difficulty ~= "Easy" then
Trigger.OnDamaged(NodHarv, function() Trigger.OnDamaged(NodHarv, function()
Utils.Do(nod.GetGroundAttackers(), function(unit) Utils.Do(enemy.GetGroundAttackers(), function(unit)
unit.AttackMove(NodHarv.Location) unit.AttackMove(NodHarv.Location)
if Map.Difficulty == "Hard" then if Map.Difficulty == "Hard" then
unit.Hunt() unit.Hunt()
@@ -185,30 +185,30 @@ end
WorldLoaded = function() WorldLoaded = function()
gdiBase = Player.GetPlayer("AbandonedBase") gdiBase = Player.GetPlayer("AbandonedBase")
gdi = Player.GetPlayer("GDI") player = Player.GetPlayer("GDI")
nod = Player.GetPlayer("Nod") enemy = Player.GetPlayer("Nod")
Trigger.OnObjectiveAdded(gdi, function(p, id) Trigger.OnObjectiveAdded(player, function(p, id)
Media.DisplayMessage(p.GetObjectiveDescription(id), "New " .. string.lower(p.GetObjectiveType(id)) .. " objective") Media.DisplayMessage(p.GetObjectiveDescription(id), "New " .. string.lower(p.GetObjectiveType(id)) .. " objective")
end) end)
Trigger.OnObjectiveCompleted(gdi, function(p, id) Trigger.OnObjectiveCompleted(player, function(p, id)
Media.DisplayMessage(p.GetObjectiveDescription(id), "Objective completed") Media.DisplayMessage(p.GetObjectiveDescription(id), "Objective completed")
end) end)
Trigger.OnObjectiveFailed(gdi, function(p, id) Trigger.OnObjectiveFailed(player, function(p, id)
Media.DisplayMessage(p.GetObjectiveDescription(id), "Objective failed") Media.DisplayMessage(p.GetObjectiveDescription(id), "Objective failed")
end) end)
Trigger.OnPlayerLost(gdi, function() Trigger.OnPlayerLost(player, function()
Media.PlaySpeechNotification(player, "Lose") Media.PlaySpeechNotification(player, "Lose")
end) end)
Trigger.OnPlayerWon(gdi, function() Trigger.OnPlayerWon(player, function()
Media.PlaySpeechNotification(player, "Win") Media.PlaySpeechNotification(player, "Win")
end) end)
nodObjective = nod.AddPrimaryObjective("Destroy all GDI troops.") nodObjective = enemy.AddPrimaryObjective("Destroy all GDI troops.")
gdiObjective1 = gdi.AddPrimaryObjective("Find the GDI base.") gdiObjective1 = player.AddPrimaryObjective("Find the GDI base.")
gdiObjective2 = gdi.AddSecondaryObjective("Destroy all SAM sites to receive air support.") gdiObjective2 = player.AddSecondaryObjective("Destroy all SAM sites to receive air support.")
SetupWorld() SetupWorld()
@@ -216,12 +216,12 @@ WorldLoaded = function()
end end
Tick = function() Tick = function()
if gdi.HasNoRequiredUnits() then if player.HasNoRequiredUnits() then
if DateTime.GameTime > 2 then if DateTime.GameTime > 2 then
nod.MarkCompletedObjective(nodObjective) enemy.MarkCompletedObjective(nodObjective)
end end
end end
if baseDiscovered and nod.HasNoRequiredUnits() then if baseDiscovered and enemy.HasNoRequiredUnits() then
gdi.MarkCompletedObjective(gdiObjective3) player.MarkCompletedObjective(gdiObjective3)
end end
end end

View File

@@ -40,7 +40,7 @@ GdiUnits = { "e2", "e2", "e2", "e2", "e1", "e1", "e1", "e1", "mtnk", "mtnk", "je
NodSams = { Sam1, Sam2, Sam3, Sam4 } NodSams = { Sam1, Sam2, Sam3, Sam4 }
AllToHunt = function() AllToHunt = function()
local list = nod.GetGroundAttackers() local list = enemy.GetGroundAttackers()
Utils.Do(list, function(unit) Utils.Do(list, function(unit)
unit.Hunt() unit.Hunt()
end) end)
@@ -56,60 +56,60 @@ end
AutoCreateTeam = function() AutoCreateTeam = function()
local team = Utils.Random(AutoCreateTeams) local team = Utils.Random(AutoCreateTeams)
for type, count in pairs(team[1]) do for type, count in pairs(team[1]) do
MoveThenHunt(Utils.Take(count, nod.GetActorsByType(type)), team[2]) MoveThenHunt(Utils.Take(count, enemy.GetActorsByType(type)), team[2])
end end
Trigger.AfterDelay(Utils.RandomInteger(AutoAtkMinDelay, AutoAtkMaxDelay), AutoCreateTeam) Trigger.AfterDelay(Utils.RandomInteger(AutoAtkMinDelay, AutoAtkMaxDelay), AutoCreateTeam)
end end
DiscoverGdiBase = function(actor, discoverer) DiscoverGdiBase = function(actor, discoverer)
if baseDiscovered or not discoverer == gdi then if baseDiscovered or not discoverer == player then
return return
end end
Utils.Do(GdiBase, function(actor) Utils.Do(GdiBase, function(actor)
actor.Owner = gdi actor.Owner = player
end) end)
GdiHarv.FindResources() GdiHarv.FindResources()
baseDiscovered = true baseDiscovered = true
gdiObjective3 = gdi.AddPrimaryObjective("Eliminate all Nod forces in the area.") gdiObjective3 = player.AddPrimaryObjective("Eliminate all Nod forces in the area.")
gdi.MarkCompletedObjective(gdiObjective1) player.MarkCompletedObjective(gdiObjective1)
end end
Atk1TriggerFunction = function() Atk1TriggerFunction = function()
MoveThenHunt(Utils.Take(2, nod.GetActorsByType('e1')), AtkRoute1) MoveThenHunt(Utils.Take(2, enemy.GetActorsByType('e1')), AtkRoute1)
MoveThenHunt(Utils.Take(3, nod.GetActorsByType('e3')), AtkRoute1) MoveThenHunt(Utils.Take(3, enemy.GetActorsByType('e3')), AtkRoute1)
end end
Atk2TriggerFunction = function() Atk2TriggerFunction = function()
MoveThenHunt(Utils.Take(3, nod.GetActorsByType('e1')), AtkRoute2) MoveThenHunt(Utils.Take(3, enemy.GetActorsByType('e1')), AtkRoute2)
MoveThenHunt(Utils.Take(3, nod.GetActorsByType('e3')), AtkRoute2) MoveThenHunt(Utils.Take(3, enemy.GetActorsByType('e3')), AtkRoute2)
end end
Atk3TriggerFunction = function() Atk3TriggerFunction = function()
MoveThenHunt(Utils.Take(1, nod.GetActorsByType('bggy')), AtkRoute1) MoveThenHunt(Utils.Take(1, enemy.GetActorsByType('bggy')), AtkRoute1)
end end
Atk4TriggerFunction = function() Atk4TriggerFunction = function()
MoveThenHunt(Utils.Take(1, nod.GetActorsByType('bggy')), AtkRoute2) MoveThenHunt(Utils.Take(1, enemy.GetActorsByType('bggy')), AtkRoute2)
end end
Atk5TriggerFunction = function() Atk5TriggerFunction = function()
MoveThenHunt(Utils.Take(1, nod.GetActorsByType('ltnk')), AtkRoute2) MoveThenHunt(Utils.Take(1, enemy.GetActorsByType('ltnk')), AtkRoute2)
end end
StartProduction = function(type) StartProduction = function(type)
if Hand1.IsInWorld and Hand1.Owner == nod then if Hand1.IsInWorld and Hand1.Owner == enemy then
Hand1.Build(type) Hand1.Build(type)
Trigger.AfterDelay(DateTime.Seconds(30), function() StartProduction(type) end) Trigger.AfterDelay(DateTime.Seconds(30), function() StartProduction(type) end)
end end
end end
InsertGdiUnits = function() InsertGdiUnits = function()
Media.PlaySpeechNotification(gdi, "Reinforce") Media.PlaySpeechNotification(player, "Reinforce")
Reinforcements.Reinforce(gdi, GdiUnits, { UnitsEntry.Location, UnitsRally.Location }, 15) Reinforcements.Reinforce(player, GdiUnits, { UnitsEntry.Location, UnitsRally.Location }, 15)
end end
IdleHunt = function(unit) IdleHunt = function(unit)
@@ -119,48 +119,48 @@ IdleHunt = function(unit)
end end
WorldLoaded = function() WorldLoaded = function()
gdi = Player.GetPlayer("GDI") player = Player.GetPlayer("GDI")
gdiBase = Player.GetPlayer("AbandonedBase") gdiBase = Player.GetPlayer("AbandonedBase")
nod = Player.GetPlayer("Nod") enemy = Player.GetPlayer("Nod")
Trigger.OnObjectiveAdded(gdi, function(p, id) Trigger.OnObjectiveAdded(player, function(p, id)
Media.DisplayMessage(p.GetObjectiveDescription(id), "New " .. string.lower(p.GetObjectiveType(id)) .. " objective") Media.DisplayMessage(p.GetObjectiveDescription(id), "New " .. string.lower(p.GetObjectiveType(id)) .. " objective")
end) end)
Trigger.OnObjectiveCompleted(gdi, function(p, id) Trigger.OnObjectiveCompleted(player, function(p, id)
Media.DisplayMessage(p.GetObjectiveDescription(id), "Objective completed") Media.DisplayMessage(p.GetObjectiveDescription(id), "Objective completed")
end) end)
Trigger.OnObjectiveFailed(gdi, function(p, id) Trigger.OnObjectiveFailed(player, function(p, id)
Media.DisplayMessage(p.GetObjectiveDescription(id), "Objective failed") Media.DisplayMessage(p.GetObjectiveDescription(id), "Objective failed")
end) end)
Trigger.OnPlayerWon(gdi, function() Trigger.OnPlayerWon(player, function()
Media.PlaySpeechNotification(gdi, "Win") Media.PlaySpeechNotification(player, "Win")
end) end)
Trigger.OnPlayerLost(gdi, function() Trigger.OnPlayerLost(player, function()
Media.PlaySpeechNotification(gdi, "Lose") Media.PlaySpeechNotification(player, "Lose")
end) end)
Utils.Do(Map.NamedActors, function(actor) Utils.Do(Map.NamedActors, function(actor)
if actor.Owner == nod and actor.HasProperty("StartBuildingRepairs") then if actor.Owner == enemy and actor.HasProperty("StartBuildingRepairs") then
Trigger.OnDamaged(actor, function(building) Trigger.OnDamaged(actor, function(building)
if building.Owner == nod and building.Health < RepairThreshold * building.MaxHealth then if building.Owner == enemy and building.Health < RepairThreshold * building.MaxHealth then
building.StartBuildingRepairs() building.StartBuildingRepairs()
end end
end) end)
end end
end) end)
gdiObjective1 = gdi.AddPrimaryObjective("Find the GDI base.") gdiObjective1 = player.AddPrimaryObjective("Find the GDI base.")
gdiObjective2 = gdi.AddSecondaryObjective("Destroy all SAM sites to receive air support.") gdiObjective2 = player.AddSecondaryObjective("Destroy all SAM sites to receive air support.")
nodObjective = nod.AddPrimaryObjective("Destroy all GDI troops.") nodObjective = enemy.AddPrimaryObjective("Destroy all GDI troops.")
Trigger.AfterDelay(Atk1Delay, Atk1TriggerFunction) Trigger.AfterDelay(Atk1Delay, Atk1TriggerFunction)
Trigger.AfterDelay(Atk2Delay, Atk2TriggerFunction) Trigger.AfterDelay(Atk2Delay, Atk2TriggerFunction)
Trigger.AfterDelay(Atk3Delay, Atk3TriggerFunction) Trigger.AfterDelay(Atk3Delay, Atk3TriggerFunction)
Trigger.AfterDelay(Atk4Delay, Atk4TriggerFunction) Trigger.AfterDelay(Atk4Delay, Atk4TriggerFunction)
Trigger.OnEnteredFootprint(Atk5CellTriggers, function(a, id) Trigger.OnEnteredFootprint(Atk5CellTriggers, function(a, id)
if a.Owner == gdi then if a.Owner == player then
Atk5TriggerFunction() Atk5TriggerFunction()
Trigger.RemoveFootprintTrigger(id) Trigger.RemoveFootprintTrigger(id)
end end
@@ -174,8 +174,8 @@ WorldLoaded = function()
Trigger.OnPlayerDiscovered(gdiBase, DiscoverGdiBase) Trigger.OnPlayerDiscovered(gdiBase, DiscoverGdiBase)
Trigger.OnAllKilled(NodSams, function() Trigger.OnAllKilled(NodSams, function()
gdi.MarkCompletedObjective(gdiObjective2) player.MarkCompletedObjective(gdiObjective2)
Actor.Create("airstrike.proxy", true, { Owner = gdi }) Actor.Create("airstrike.proxy", true, { Owner = player })
end) end)
Camera.Position = UnitsRally.CenterPosition Camera.Position = UnitsRally.CenterPosition
@@ -184,12 +184,12 @@ WorldLoaded = function()
end end
Tick = function() Tick = function()
if gdi.HasNoRequiredUnits() then if player.HasNoRequiredUnits() then
if DateTime.GameTime > 2 then if DateTime.GameTime > 2 then
nod.MarkCompletedObjective(nodObjective) enemy.MarkCompletedObjective(nodObjective)
end end
end end
if baseDiscovered and nod.HasNoRequiredUnits() then if baseDiscovered and enemy.HasNoRequiredUnits() then
gdi.MarkCompletedObjective(gdiObjective3) player.MarkCompletedObjective(gdiObjective3)
end end
end end

View File

@@ -5,26 +5,26 @@ RifleInfantryReinforcements = { "e1", "e1" }
RocketInfantryReinforcements = { "e3", "e3", "e3", "e3", "e3" } RocketInfantryReinforcements = { "e3", "e3", "e3", "e3", "e3" }
SendInitialForces = function() SendInitialForces = function()
Media.PlaySpeechNotification(nod, "Reinforce") Media.PlaySpeechNotification(player, "Reinforce")
Reinforcements.Reinforce(nod, InitialForcesA, { StartSpawnPointLeft.Location, StartRallyPoint.Location }, 5) Reinforcements.Reinforce(player, InitialForcesA, { StartSpawnPointLeft.Location, StartRallyPoint.Location }, 5)
Reinforcements.Reinforce(nod, InitialForcesB, { StartSpawnPointRight.Location, StartRallyPoint.Location }, 10) Reinforcements.Reinforce(player, InitialForcesB, { StartSpawnPointRight.Location, StartRallyPoint.Location }, 10)
end end
SendFirstInfantryReinforcements = function() SendFirstInfantryReinforcements = function()
Media.PlaySpeechNotification(nod, "Reinforce") Media.PlaySpeechNotification(player, "Reinforce")
Reinforcements.Reinforce(nod, RifleInfantryReinforcements, { StartSpawnPointRight.Location, StartRallyPoint.Location }, 15) Reinforcements.Reinforce(player, RifleInfantryReinforcements, { StartSpawnPointRight.Location, StartRallyPoint.Location }, 15)
end end
SendSecondInfantryReinforcements = function() SendSecondInfantryReinforcements = function()
Media.PlaySpeechNotification(nod, "Reinforce") Media.PlaySpeechNotification(player, "Reinforce")
Reinforcements.Reinforce(nod, RifleInfantryReinforcements, { StartSpawnPointLeft.Location, StartRallyPoint.Location }, 15) Reinforcements.Reinforce(player, RifleInfantryReinforcements, { StartSpawnPointLeft.Location, StartRallyPoint.Location }, 15)
end end
SendLastInfantryReinforcements = function() SendLastInfantryReinforcements = function()
Media.PlaySpeechNotification(nod, "Reinforce") Media.PlaySpeechNotification(player, "Reinforce")
-- Move the units properly into the map before they start attacking -- Move the units properly into the map before they start attacking
local forces = Reinforcements.Reinforce(nod, RocketInfantryReinforcements, { VillageSpawnPoint.Location, VillageRallyPoint.Location }, 8) local forces = Reinforcements.Reinforce(player, RocketInfantryReinforcements, { VillageSpawnPoint.Location, VillageRallyPoint.Location }, 8)
Utils.Do(forces, function(a) Utils.Do(forces, function(a)
a.Stance = "Defend" a.Stance = "Defend"
a.CallFunc(function() a.Stance = "AttackAnything" end) a.CallFunc(function() a.Stance = "AttackAnything" end)
@@ -32,35 +32,35 @@ SendLastInfantryReinforcements = function()
end end
WorldLoaded = function() WorldLoaded = function()
nod = Player.GetPlayer("Nod") player = Player.GetPlayer("Nod")
gdi = Player.GetPlayer("GDI") enemy = Player.GetPlayer("GDI")
villagers = Player.GetPlayer("Villagers") villagers = Player.GetPlayer("Villagers")
Trigger.OnObjectiveAdded(nod, function(p, id) Trigger.OnObjectiveAdded(player, function(p, id)
Media.DisplayMessage(p.GetObjectiveDescription(id), "New " .. string.lower(p.GetObjectiveType(id)) .. " objective") Media.DisplayMessage(p.GetObjectiveDescription(id), "New " .. string.lower(p.GetObjectiveType(id)) .. " objective")
end) end)
Trigger.OnObjectiveCompleted(nod, function(p, id) Trigger.OnObjectiveCompleted(player, function(p, id)
Media.DisplayMessage(p.GetObjectiveDescription(id), "Objective completed") Media.DisplayMessage(p.GetObjectiveDescription(id), "Objective completed")
end) end)
Trigger.OnObjectiveFailed(nod, function(p, id) Trigger.OnObjectiveFailed(player, function(p, id)
Media.DisplayMessage(p.GetObjectiveDescription(id), "Objective failed") Media.DisplayMessage(p.GetObjectiveDescription(id), "Objective failed")
end) end)
Trigger.OnPlayerWon(nod, function() Trigger.OnPlayerWon(player, function()
Media.PlaySpeechNotification(nod, "Win") Media.PlaySpeechNotification(player, "Win")
end) end)
Trigger.OnPlayerLost(nod, function() Trigger.OnPlayerLost(player, function()
Media.PlaySpeechNotification(nod, "Lose") Media.PlaySpeechNotification(player, "Lose")
end) end)
NodObjective1 = nod.AddPrimaryObjective("Kill Nikoomba.") NodObjective1 = player.AddPrimaryObjective("Kill Nikoomba.")
NodObjective2 = nod.AddPrimaryObjective("Destroy the village.") NodObjective2 = player.AddPrimaryObjective("Destroy the village.")
NodObjective3 = nod.AddSecondaryObjective("Destroy all GDI troops in the area.") NodObjective3 = player.AddSecondaryObjective("Destroy all GDI troops in the area.")
GDIObjective1 = gdi.AddPrimaryObjective("Eliminate all Nod forces.") GDIObjective1 = enemy.AddPrimaryObjective("Eliminate all Nod forces.")
Trigger.OnKilled(Nikoomba, function() Trigger.OnKilled(Nikoomba, function()
nod.MarkCompletedObjective(NodObjective1) player.MarkCompletedObjective(NodObjective1)
Trigger.AfterDelay(DateTime.Seconds(1), function() Trigger.AfterDelay(DateTime.Seconds(1), function()
SendLastInfantryReinforcements() SendLastInfantryReinforcements()
end) end)
@@ -75,14 +75,14 @@ end
Tick = function() Tick = function()
if DateTime.GameTime > 2 then if DateTime.GameTime > 2 then
if nod.HasNoRequiredUnits() then if player.HasNoRequiredUnits() then
gdi.MarkCompletedObjective(GDIObjective1) enemy.MarkCompletedObjective(GDIObjective1)
end end
if villagers.HasNoRequiredUnits() then if villagers.HasNoRequiredUnits() then
nod.MarkCompletedObjective(NodObjective2) player.MarkCompletedObjective(NodObjective2)
end end
if gdi.HasNoRequiredUnits() then if enemy.HasNoRequiredUnits() then
nod.MarkCompletedObjective(NodObjective3) player.MarkCompletedObjective(NodObjective3)
end end
end end
end end

View File

@@ -42,9 +42,9 @@ getActors = function(owner, units)
end end
InsertNodUnits = function() InsertNodUnits = function()
Media.PlaySpeechNotification(Nod, "Reinforce") Media.PlaySpeechNotification(player, "Reinforce")
Reinforcements.Reinforce(Nod, NodUnits, { UnitsEntry.Location, UnitsRally.Location }, 15) Reinforcements.Reinforce(player, NodUnits, { UnitsEntry.Location, UnitsRally.Location }, 15)
Reinforcements.Reinforce(Nod, { "mcv" }, { McvEntry.Location, McvRally.Location }) Reinforcements.Reinforce(player, { "mcv" }, { McvEntry.Location, McvRally.Location })
end end
OnAnyDamaged = function(actors, func) OnAnyDamaged = function(actors, func)
@@ -66,14 +66,14 @@ CheckForBase = function(player)
end end
DfndTriggerFunction = function() DfndTriggerFunction = function()
local list = GDI.GetGroundAttackers() local list = enemy.GetGroundAttackers()
Utils.Do(list, function(unit) Utils.Do(list, function(unit)
IdleHunt(unit) IdleHunt(unit)
end) end)
end end
Atk2TriggerFunction = function() Atk2TriggerFunction = function()
local MyActors = getActors(GDI, { ['e1'] = 3 }) local MyActors = getActors(enemy, { ['e1'] = 3 })
Utils.Do(MyActors, function(actor) Utils.Do(MyActors, function(actor)
Atk2Movement(actor) Atk2Movement(actor)
end) end)
@@ -82,7 +82,7 @@ end
Atk3TriggerFunction = function() Atk3TriggerFunction = function()
if not Atk3TriggerSwitch then if not Atk3TriggerSwitch then
Atk3TriggerSwitch = true Atk3TriggerSwitch = true
MyActors = getActors(GDI, { ['e1'] = 4 }) MyActors = getActors(enemy, { ['e1'] = 4 })
Utils.Do(MyActors, function(actor) Utils.Do(MyActors, function(actor)
Atk3Movement(actor) Atk3Movement(actor)
end) end)
@@ -90,28 +90,28 @@ Atk3TriggerFunction = function()
end end
Atk5TriggerFunction = function() Atk5TriggerFunction = function()
local MyActors = getActors(GDI, { ['e1'] = 3 }) local MyActors = getActors(enemy, { ['e1'] = 3 })
Utils.Do(MyActors, function(actor) Utils.Do(MyActors, function(actor)
Atk2Movement(actor) Atk2Movement(actor)
end) end)
end end
Atk6TriggerFunction = function() Atk6TriggerFunction = function()
local MyActors = getActors(GDI, { ['e1'] = 4 }) local MyActors = getActors(enemy, { ['e1'] = 4 })
Utils.Do(MyActors, function(actor) Utils.Do(MyActors, function(actor)
Atk3Movement(actor) Atk3Movement(actor)
end) end)
end end
Atk7TriggerFunction = function() Atk7TriggerFunction = function()
local MyActors = getActors(GDI, { ['e1'] = 3 }) local MyActors = getActors(enemy, { ['e1'] = 3 })
Utils.Do(MyActors, function(actor) Utils.Do(MyActors, function(actor)
Atk4Movement(actor) Atk4Movement(actor)
end) end)
end end
Pat1TriggerFunction = function() Pat1TriggerFunction = function()
local MyActors = getActors(GDI, { ['e1'] = 3 }) local MyActors = getActors(enemy, { ['e1'] = 3 })
Utils.Do(MyActors, function(actor) Utils.Do(MyActors, function(actor)
Pat1Movement(actor) Pat1Movement(actor)
end) end)
@@ -153,32 +153,32 @@ Pat1Movement = function(unit)
end end
WorldLoaded = function() WorldLoaded = function()
GDI = Player.GetPlayer("GDI") player = Player.GetPlayer("Nod")
Nod = Player.GetPlayer("Nod") enemy = Player.GetPlayer("GDI")
Trigger.OnObjectiveAdded(Nod, function(p, id) Trigger.OnObjectiveAdded(player, function(p, id)
Media.DisplayMessage(p.GetObjectiveDescription(id), "New " .. string.lower(p.GetObjectiveType(id)) .. " objective") Media.DisplayMessage(p.GetObjectiveDescription(id), "New " .. string.lower(p.GetObjectiveType(id)) .. " objective")
end) end)
Trigger.OnObjectiveCompleted(Nod, function(p, id) Trigger.OnObjectiveCompleted(player, function(p, id)
Media.DisplayMessage(p.GetObjectiveDescription(id), "Objective completed") Media.DisplayMessage(p.GetObjectiveDescription(id), "Objective completed")
end) end)
Trigger.OnObjectiveFailed(Nod, function(p, id) Trigger.OnObjectiveFailed(player, function(p, id)
Media.DisplayMessage(p.GetObjectiveDescription(id), "Objective failed") Media.DisplayMessage(p.GetObjectiveDescription(id), "Objective failed")
end) end)
Trigger.OnPlayerWon(Nod, function() Trigger.OnPlayerWon(player, function()
Media.PlaySpeechNotification(Nod, "Win") Media.PlaySpeechNotification(player, "Win")
end) end)
Trigger.OnPlayerLost(Nod, function() Trigger.OnPlayerLost(player, function()
Media.PlaySpeechNotification(Nod, "Lose") Media.PlaySpeechNotification(player, "Lose")
end) end)
NodObjective1 = Nod.AddPrimaryObjective("Build a base.") NodObjective1 = player.AddPrimaryObjective("Build a base.")
NodObjective2 = Nod.AddPrimaryObjective("Destroy the GDI base.") NodObjective2 = player.AddPrimaryObjective("Destroy the GDI base.")
GDIObjective = GDI.AddPrimaryObjective("Kill all enemies.") GDIObjective = enemy.AddPrimaryObjective("Kill all enemies.")
OnAnyDamaged(Atk3ActorTriggerActivator, Atk3TriggerFunction) OnAnyDamaged(Atk3ActorTriggerActivator, Atk3TriggerFunction)
Trigger.OnAllRemovedFromWorld(DfndActorTriggerActivator, DfndTriggerFunction) Trigger.OnAllRemovedFromWorld(DfndActorTriggerActivator, DfndTriggerFunction)
@@ -190,8 +190,8 @@ WorldLoaded = function()
Trigger.AfterDelay(Pat1TriggerFunctionTime, Pat1TriggerFunction) Trigger.AfterDelay(Pat1TriggerFunctionTime, Pat1TriggerFunction)
Trigger.OnEnteredFootprint(Atk1CellTriggerActivator, function(a, id) Trigger.OnEnteredFootprint(Atk1CellTriggerActivator, function(a, id)
if a.Owner == Nod then if a.Owner == player then
MyActors = getActors(GDI, { ['e1'] = 5 }) MyActors = getActors(enemy, { ['e1'] = 5 })
Utils.Do(MyActors, function(actor) Utils.Do(MyActors, function(actor)
Atk1Movement(actor) Atk1Movement(actor)
end) end)
@@ -200,8 +200,8 @@ WorldLoaded = function()
end) end)
Trigger.OnEnteredFootprint(Atk4CellTriggerActivator, function(a, id) Trigger.OnEnteredFootprint(Atk4CellTriggerActivator, function(a, id)
if a.Owner == Nod then if a.Owner == player then
MyActors = getActors(GDI, { ['e1'] = 3 } ) MyActors = getActors(enemy, { ['e1'] = 3 } )
Utils.Do(MyActors, function(actor) Utils.Do(MyActors, function(actor)
Atk2Movement(actor) Atk2Movement(actor)
end) end)
@@ -214,22 +214,22 @@ WorldLoaded = function()
end end
Tick = function() Tick = function()
if GDI.HasNoRequiredUnits() then if enemy.HasNoRequiredUnits() then
Nod.MarkCompletedObjective(NodObjective2) player.MarkCompletedObjective(NodObjective2)
end end
if Nod.HasNoRequiredUnits() then if player.HasNoRequiredUnits() then
if DateTime.GameTime > 2 then if DateTime.GameTime > 2 then
GDI.MarkCompletedObjective(GDIObjective) enemy.MarkCompletedObjective(GDIObjective)
end end
end end
if DateTime.GameTime % DateTime.Seconds(1) == 0 and not Nod.IsObjectiveCompleted(NodObjective1) and CheckForBase(Nod) then if DateTime.GameTime % DateTime.Seconds(1) == 0 and not player.IsObjectiveCompleted(NodObjective1) and CheckForBase(player) then
Nod.MarkCompletedObjective(NodObjective1) player.MarkCompletedObjective(NodObjective1)
end end
if DateTime.GameTime % DateTime.Seconds(3) == 0 and Barracks.IsInWorld and Barracks.Owner == gdi then if DateTime.GameTime % DateTime.Seconds(3) == 0 and Barracks.IsInWorld and Barracks.Owner == enemy then
checkProduction(GDI) checkProduction(enemy)
end end
end end
@@ -252,7 +252,7 @@ end
getStartUnits = function() getStartUnits = function()
local Units = Map.ActorsInBox(Map.TopLeft, Map.BottomRight, function(actor) local Units = Map.ActorsInBox(Map.TopLeft, Map.BottomRight, function(actor)
return actor.Owner == GDI return actor.Owner == enemy
end) end)
Utils.Do(Units, function(unit) Utils.Do(Units, function(unit)
if unit.Type == UnitToRebuild then if unit.Type == UnitToRebuild then

View File

@@ -19,7 +19,7 @@ GDIStartUnits = 0
Grd2TriggerFunction = function() Grd2TriggerFunction = function()
if not Grd2TriggerSwitch then if not Grd2TriggerSwitch then
Grd2TriggerSwitch = true Grd2TriggerSwitch = true
MyActors = getActors(GDI, { ['e1'] = 5 }) MyActors = getActors(enemy, { ['e1'] = 5 })
Utils.Do(MyActors, function(actor) Utils.Do(MyActors, function(actor)
Gdi5Movement(actor) Gdi5Movement(actor)
end) end)
@@ -27,35 +27,35 @@ Grd2TriggerFunction = function()
end end
Atk8TriggerFunction = function() Atk8TriggerFunction = function()
MyActors = getActors(GDI, { ['e1'] = 2 }) MyActors = getActors(enemy, { ['e1'] = 2 })
Utils.Do(MyActors, function(actor) Utils.Do(MyActors, function(actor)
Gdi1Movement(actor) Gdi1Movement(actor)
end) end)
end end
Atk7TriggerFunction = function() Atk7TriggerFunction = function()
MyActors = getActors(GDI, { ['e1'] = 3 }) MyActors = getActors(enemy, { ['e1'] = 3 })
Utils.Do(MyActors, function(actor) Utils.Do(MyActors, function(actor)
Gdi3Movement(actor) Gdi3Movement(actor)
end) end)
end end
Atk4TriggerFunction = function() Atk4TriggerFunction = function()
MyActors = getActors(GDI, { ['e1'] = 3 }) MyActors = getActors(enemy, { ['e1'] = 3 })
Utils.Do(MyActors, function(actor) Utils.Do(MyActors, function(actor)
Gdi3Movement(actor) Gdi3Movement(actor)
end) end)
end end
Atk3TriggerFunction = function() Atk3TriggerFunction = function()
MyActors = getActors(GDI, { ['e1'] = 2 }) MyActors = getActors(enemy, { ['e1'] = 2 })
Utils.Do(MyActors, function(actor) Utils.Do(MyActors, function(actor)
Gdi1Movement(actor) Gdi1Movement(actor)
end) end)
end end
Atk6TriggerFunction = function() Atk6TriggerFunction = function()
MyActors = getActors(GDI, { ['e1'] = 2 }) MyActors = getActors(enemy, { ['e1'] = 2 })
Utils.Do(MyActors, function(actor) Utils.Do(MyActors, function(actor)
Gdi1Movement(actor) Gdi1Movement(actor)
end) end)
@@ -64,7 +64,7 @@ end
Atk5TriggerFunction = function() Atk5TriggerFunction = function()
if not Atk5TriggerSwitch then if not Atk5TriggerSwitch then
Atk5TriggerSwitch = true Atk5TriggerSwitch = true
MyActors = getActors(GDI, { ['e1'] = 3 }) MyActors = getActors(enemy, { ['e1'] = 3 })
Utils.Do(MyActors, function(actor) Utils.Do(MyActors, function(actor)
Gdi3Movement(actor) Gdi3Movement(actor)
end) end)
@@ -72,7 +72,7 @@ Atk5TriggerFunction = function()
end end
HuntTriggerFunction = function() HuntTriggerFunction = function()
local list = GDI.GetGroundAttackers() local list = enemy.GetGroundAttackers()
Utils.Do(list, function(unit) Utils.Do(list, function(unit)
IdleHunt(unit) IdleHunt(unit)
end) end)
@@ -97,32 +97,32 @@ Gdi3Movement = function(unit)
end end
WorldLoaded = function() WorldLoaded = function()
GDI = Player.GetPlayer("GDI") player = Player.GetPlayer("Nod")
Nod = Player.GetPlayer("Nod") enemy = Player.GetPlayer("GDI")
Trigger.OnObjectiveAdded(Nod, function(p, id) Trigger.OnObjectiveAdded(player, function(p, id)
Media.DisplayMessage(p.GetObjectiveDescription(id), "New " .. string.lower(p.GetObjectiveType(id)) .. " objective") Media.DisplayMessage(p.GetObjectiveDescription(id), "New " .. string.lower(p.GetObjectiveType(id)) .. " objective")
end) end)
Trigger.OnObjectiveCompleted(Nod, function(p, id) Trigger.OnObjectiveCompleted(player, function(p, id)
Media.DisplayMessage(p.GetObjectiveDescription(id), "Objective completed") Media.DisplayMessage(p.GetObjectiveDescription(id), "Objective completed")
end) end)
Trigger.OnObjectiveFailed(Nod, function(p, id) Trigger.OnObjectiveFailed(player, function(p, id)
Media.DisplayMessage(p.GetObjectiveDescription(id), "Objective failed") Media.DisplayMessage(p.GetObjectiveDescription(id), "Objective failed")
end) end)
Trigger.OnPlayerWon(Nod, function() Trigger.OnPlayerWon(player, function()
Media.PlaySpeechNotification(Nod, "Win") Media.PlaySpeechNotification(player, "Win")
end) end)
Trigger.OnPlayerLost(Nod, function() Trigger.OnPlayerLost(player, function()
Media.PlaySpeechNotification(Nod, "Lose") Media.PlaySpeechNotification(player, "Lose")
end) end)
GDIObjective = GDI.AddPrimaryObjective("Kill all enemies.") GDIObjective = enemy.AddPrimaryObjective("Kill all enemies.")
NodObjective1 = Nod.AddPrimaryObjective("Build a base.") NodObjective1 = player.AddPrimaryObjective("Build a base.")
NodObjective2 = Nod.AddPrimaryObjective("Destroy all GDI units.") NodObjective2 = player.AddPrimaryObjective("Destroy all GDI units.")
OnAnyDamaged(Grd2ActorTriggerActivator, Grd2TriggerFunction) OnAnyDamaged(Grd2ActorTriggerActivator, Grd2TriggerFunction)
Trigger.AfterDelay(Atk8TriggerFunctionTime, Atk8TriggerFunction) Trigger.AfterDelay(Atk8TriggerFunctionTime, Atk8TriggerFunction)
@@ -139,22 +139,22 @@ WorldLoaded = function()
end end
Tick = function() Tick = function()
if Nod.HasNoRequiredUnits() then if player.HasNoRequiredUnits() then
if DateTime.GameTime > 2 then if DateTime.GameTime > 2 then
GDI.MarkCompletedObjective(GDIObjective) enemy.MarkCompletedObjective(GDIObjective)
end end
end end
if GDI.HasNoRequiredUnits() then if enemy.HasNoRequiredUnits() then
Nod.MarkCompletedObjective(NodObjective2) player.MarkCompletedObjective(NodObjective2)
end end
if DateTime.GameTime % DateTime.Seconds(1) == 0 and not Nod.IsObjectiveCompleted(NodObjective1) and CheckForBase(Nod) then if DateTime.GameTime % DateTime.Seconds(1) == 0 and not player.IsObjectiveCompleted(NodObjective1) and CheckForBase(player) then
Nod.MarkCompletedObjective(NodObjective1) player.MarkCompletedObjective(NodObjective1)
end end
if DateTime.GameTime % DateTime.Seconds(3) == 0 and Barracks.IsInWorld and Barracks.Owner == gdi then if DateTime.GameTime % DateTime.Seconds(3) == 0 and Barracks.IsInWorld and Barracks.Owner == enemy then
checkProduction(GDI) checkProduction(enemy)
end end
end end
@@ -214,7 +214,7 @@ end
getStartUnits = function() getStartUnits = function()
local Units = Map.ActorsInBox(Map.TopLeft, Map.BottomRight, function(actor) local Units = Map.ActorsInBox(Map.TopLeft, Map.BottomRight, function(actor)
return actor.Owner == GDI return actor.Owner == enemy
end) end)
Utils.Do(Units, function(unit) Utils.Do(Units, function(unit)
if unit.Type == UnitToRebuild then if unit.Type == UnitToRebuild then
@@ -224,9 +224,9 @@ getStartUnits = function()
end end
InsertNodUnits = function() InsertNodUnits = function()
Media.PlaySpeechNotification(Nod, "Reinforce") Media.PlaySpeechNotification(player, "Reinforce")
Reinforcements.Reinforce(Nod, NodUnits, { UnitsEntry.Location, UnitsRally.Location }, 15) Reinforcements.Reinforce(player, NodUnits, { UnitsEntry.Location, UnitsRally.Location }, 15)
Reinforcements.Reinforce(Nod, { "mcv" }, { McvEntry.Location, McvRally.Location }) Reinforcements.Reinforce(player, { "mcv" }, { McvEntry.Location, McvRally.Location })
end end
IdleHunt = function(unit) IdleHunt = function(unit)

View File

@@ -43,7 +43,7 @@ ZzzzTriggerFunctionTime = DateTime.Minutes(2) + DateTime.Seconds(30)
NodCiviliansActors = { NodCiv1, NodCiv2, NodCiv3, NodCiv4, NodCiv5, NodCiv6, NodCiv7, NodCiv8, NodCiv9 } NodCiviliansActors = { NodCiv1, NodCiv2, NodCiv3, NodCiv4, NodCiv5, NodCiv6, NodCiv7, NodCiv8, NodCiv9 }
Atk6TriggerFunction = function() Atk6TriggerFunction = function()
Reinforcements.ReinforceWithTransport(GDI, 'apc', Atk6Units, Atk6WaypointsPart1, Atk6WaypointsPart2, Reinforcements.ReinforceWithTransport(enemy, 'apc', Atk6Units, Atk6WaypointsPart1, Atk6WaypointsPart2,
function(transport, cargo) function(transport, cargo)
Utils.Do(cargo, function(actor) Utils.Do(cargo, function(actor)
IdleHunt(actor) IdleHunt(actor)
@@ -57,7 +57,7 @@ end
Atk5TriggerFunction = function () Atk5TriggerFunction = function ()
if not Atk5TriggerSwitch then if not Atk5TriggerSwitch then
Atk5TriggerSwitch = true Atk5TriggerSwitch = true
Reinforcements.ReinforceWithTransport(GDI, 'apc', Atk5Units, Atk5Waypoints, nil, Reinforcements.ReinforceWithTransport(enemy, 'apc', Atk5Units, Atk5Waypoints, nil,
function(transport, cargo) function(transport, cargo)
transport.UnloadPassengers() transport.UnloadPassengers()
Utils.Do(cargo, function(actor) Utils.Do(cargo, function(actor)
@@ -71,7 +71,7 @@ Atk5TriggerFunction = function ()
end end
Atk1TriggerFunction = function() Atk1TriggerFunction = function()
Reinforcements.Reinforce(GDI, Atk1Units, Spawnpoint, 15, Reinforcements.Reinforce(enemy, Atk1Units, Spawnpoint, 15,
function(actor) function(actor)
Atk1Movement(actor) Atk1Movement(actor)
end) end)
@@ -79,7 +79,7 @@ end
XxxxTriggerFunction = function() XxxxTriggerFunction = function()
if not XxxxTriggerSwitch then if not XxxxTriggerSwitch then
Reinforcements.Reinforce(GDI, XxxxUnits, Spawnpoint, 15, Reinforcements.Reinforce(enemy, XxxxUnits, Spawnpoint, 15,
function(actor) function(actor)
Atk2Movement(actor) Atk2Movement(actor)
end) end)
@@ -88,7 +88,7 @@ end
YyyyTriggerFunction = function() YyyyTriggerFunction = function()
if not YyyyTriggerSwitch then if not YyyyTriggerSwitch then
Reinforcements.Reinforce(GDI, YyyyUnits, Spawnpoint, 15, Reinforcements.Reinforce(enemy, YyyyUnits, Spawnpoint, 15,
function(actor) function(actor)
Atk4Movement(actor) Atk4Movement(actor)
end) end)
@@ -97,7 +97,7 @@ end
ZzzzTriggerFunction = function() ZzzzTriggerFunction = function()
if not ZzzzTriggerSwitch then if not ZzzzTriggerSwitch then
Reinforcements.ReinforceWithTransport(GDI, 'apc', ZzzzUnits, Atk5Waypoints, nil, Reinforcements.ReinforceWithTransport(enemy, 'apc', ZzzzUnits, Atk5Waypoints, nil,
function(transport, cargo) function(transport, cargo)
transport.UnloadPassengers() transport.UnloadPassengers()
Utils.Do(cargo, function(actor) Utils.Do(cargo, function(actor)
@@ -145,21 +145,21 @@ Atk4Movement = function(unit)
end end
InsertNodUnits = function() InsertNodUnits = function()
Media.PlaySpeechNotification(Nod, "Reinforce") Media.PlaySpeechNotification(player, "Reinforce")
Reinforcements.Reinforce(Nod, NodUnitsBuggy, { UnitsEntryBuggy.Location, UnitsRallyBuggy.Location }, 11) Reinforcements.Reinforce(player, NodUnitsBuggy, { UnitsEntryBuggy.Location, UnitsRallyBuggy.Location }, 11)
Reinforcements.Reinforce(Nod, NodUnitsBikes, { UnitsEntryBikes.Location, UnitsRallyBikes.Location }, 15) Reinforcements.Reinforce(player, NodUnitsBikes, { UnitsEntryBikes.Location, UnitsRallyBikes.Location }, 15)
Reinforcements.Reinforce(Nod, NodUnitsGunner, { UnitsEntryGunner.Location, UnitsRallyGunner.Location }, 15) Reinforcements.Reinforce(player, NodUnitsGunner, { UnitsEntryGunner.Location, UnitsRallyGunner.Location }, 15)
Reinforcements.Reinforce(Nod, NodUnitsRocket, { UnitsEntryRocket.Location, UnitsRallyRocket.Location }, 15) Reinforcements.Reinforce(player, NodUnitsRocket, { UnitsEntryRocket.Location, UnitsRallyRocket.Location }, 15)
end end
CreateCivilians = function(actor, discoverer) CreateCivilians = function(actor, discoverer)
Utils.Do(NodCiviliansActors, function(actor) Utils.Do(NodCiviliansActors, function(actor)
actor.Owner = Nod actor.Owner = player
end) end)
NodObjective2 = Nod.AddPrimaryObjective("Protect the civilians that support Nod.") NodObjective2 = player.AddPrimaryObjective("Protect the civilians that support Nod.")
Trigger.OnAllKilled(NodCiviliansActors, function() Trigger.OnAllKilled(NodCiviliansActors, function()
Nod.MarkFailedObjective(NodObjective2) player.MarkFailedObjective(NodObjective2)
end) end)
Utils.Do(GcivActors, function(actor) Utils.Do(GcivActors, function(actor)
@@ -172,26 +172,26 @@ CreateCivilians = function(actor, discoverer)
end end
WorldLoaded = function() WorldLoaded = function()
player = Player.GetPlayer("Nod")
NodSupporter = Player.GetPlayer("NodSupporter") NodSupporter = Player.GetPlayer("NodSupporter")
Nod = Player.GetPlayer("Nod") enemy = Player.GetPlayer("GDI")
GDI = Player.GetPlayer("GDI")
Trigger.OnObjectiveAdded(Nod, function(p, id) Trigger.OnObjectiveAdded(player, function(p, id)
Media.DisplayMessage(p.GetObjectiveDescription(id), "New " .. string.lower(p.GetObjectiveType(id)) .. " objective") Media.DisplayMessage(p.GetObjectiveDescription(id), "New " .. string.lower(p.GetObjectiveType(id)) .. " objective")
end) end)
Trigger.OnObjectiveCompleted(Nod, function(p, id) Trigger.OnObjectiveCompleted(player, function(p, id)
Media.DisplayMessage(p.GetObjectiveDescription(id), "Objective completed") Media.DisplayMessage(p.GetObjectiveDescription(id), "Objective completed")
end) end)
Trigger.OnObjectiveFailed(Nod, function(p, id) Trigger.OnObjectiveFailed(player, function(p, id)
Media.DisplayMessage(p.GetObjectiveDescription(id), "Objective failed") Media.DisplayMessage(p.GetObjectiveDescription(id), "Objective failed")
end) end)
Trigger.OnPlayerWon(Nod, function() Trigger.OnPlayerWon(player, function()
Media.PlaySpeechNotification(Nod, "Win") Media.PlaySpeechNotification(player, "Win")
end) end)
Trigger.OnPlayerLost(Nod, function() Trigger.OnPlayerLost(player, function()
Media.PlaySpeechNotification(Nod, "Lose") Media.PlaySpeechNotification(player, "Lose")
end) end)
Trigger.OnAnyKilled(Atk6ActorTriggerActivator, Atk6TriggerFunction) Trigger.OnAnyKilled(Atk6ActorTriggerActivator, Atk6TriggerFunction)
@@ -199,9 +199,9 @@ WorldLoaded = function()
OnAnyDamaged(Atk5ActorTriggerActivator, Atk5TriggerFunction) OnAnyDamaged(Atk5ActorTriggerActivator, Atk5TriggerFunction)
Trigger.OnEnteredFootprint(Atk3CellTriggerActivator, function(a, id) Trigger.OnEnteredFootprint(Atk3CellTriggerActivator, function(a, id)
if a.Owner == Nod then if a.Owner == player then
for type, count in pairs({ ['e1'] = 3, ['e2'] = 2, ['mtnk'] = 1 }) do for type, count in pairs({ ['e1'] = 3, ['e2'] = 2, ['mtnk'] = 1 }) do
local myActors = Utils.Take(count, GDI.GetActorsByType(type)) local myActors = Utils.Take(count, enemy.GetActorsByType(type))
Utils.Do(myActors, function(actor) Utils.Do(myActors, function(actor)
Atk3Movement(actor) Atk3Movement(actor)
end) end)
@@ -215,8 +215,8 @@ WorldLoaded = function()
end) end)
Trigger.OnEnteredFootprint(Atk2CellTriggerActivator, function(a, id) Trigger.OnEnteredFootprint(Atk2CellTriggerActivator, function(a, id)
if a.Owner == Nod then if a.Owner == player then
MyActors = Utils.Take(1, GDI.GetActorsByType('jeep')) MyActors = Utils.Take(1, enemy.GetActorsByType('jeep'))
Utils.Do(MyActors, function(actor) Utils.Do(MyActors, function(actor)
Atk2Movement(actor) Atk2Movement(actor)
end) end)
@@ -225,7 +225,7 @@ WorldLoaded = function()
end) end)
Trigger.OnEnteredFootprint(GcivCellTriggerActivator, function(a, id) Trigger.OnEnteredFootprint(GcivCellTriggerActivator, function(a, id)
if a.Owner == Nod then if a.Owner == player then
Utils.Do(GcivActors, function(actor) Utils.Do(GcivActors, function(actor)
GcivMovement(actor) GcivMovement(actor)
end) end)
@@ -236,9 +236,9 @@ WorldLoaded = function()
Trigger.AfterDelay(Atk1TriggerFunctionTime, Atk1TriggerFunction) Trigger.AfterDelay(Atk1TriggerFunctionTime, Atk1TriggerFunction)
Trigger.OnEnteredFootprint(Atk4CellTriggerActivator, function(a, id) Trigger.OnEnteredFootprint(Atk4CellTriggerActivator, function(a, id)
if a.Owner == Nod then if a.Owner == player then
for type, count in pairs({ ['e1'] = 2,['e2'] = 1 }) do for type, count in pairs({ ['e1'] = 2,['e2'] = 1 }) do
local myActors = Utils.Take(count, GDI.GetActorsByType(type)) local myActors = Utils.Take(count, enemy.GetActorsByType(type))
Utils.Do(myActors, function(actor) Utils.Do(myActors, function(actor)
Atk4Movement(actor) Atk4Movement(actor)
end) end)
@@ -252,21 +252,21 @@ WorldLoaded = function()
Trigger.AfterDelay(ZzzzTriggerFunctionTime, ZzzzTriggerFunction) Trigger.AfterDelay(ZzzzTriggerFunctionTime, ZzzzTriggerFunction)
Trigger.OnEnteredFootprint(DelxCellTriggerActivator, function(a, id) Trigger.OnEnteredFootprint(DelxCellTriggerActivator, function(a, id)
if a.Owner == Nod then if a.Owner == player then
XxxxTriggerSwitch = true XxxxTriggerSwitch = true
Trigger.RemoveFootprintTrigger(id) Trigger.RemoveFootprintTrigger(id)
end end
end) end)
Trigger.OnEnteredFootprint(DelyCellTriggerActivator, function(a, id) Trigger.OnEnteredFootprint(DelyCellTriggerActivator, function(a, id)
if a.Owner == Nod then if a.Owner == player then
YyyyTriggerSwitch = true YyyyTriggerSwitch = true
Trigger.RemoveFootprintTrigger(id) Trigger.RemoveFootprintTrigger(id)
end end
end) end)
Trigger.OnEnteredFootprint(DelzCellTriggerActivator, function(a, id) Trigger.OnEnteredFootprint(DelzCellTriggerActivator, function(a, id)
if a.Owner == Nod then if a.Owner == player then
ZzzzTriggerSwitch = true ZzzzTriggerSwitch = true
Trigger.RemoveFootprintTrigger(id) Trigger.RemoveFootprintTrigger(id)
end end
@@ -275,23 +275,23 @@ WorldLoaded = function()
Trigger.OnPlayerDiscovered(NodSupporter, CreateCivilians) Trigger.OnPlayerDiscovered(NodSupporter, CreateCivilians)
Trigger.OnAllKilled(WinActorTriggerActivator, function() Trigger.OnAllKilled(WinActorTriggerActivator, function()
Nod.MarkCompletedObjective(NodObjective1) player.MarkCompletedObjective(NodObjective1)
if NodObjective2 then if NodObjective2 then
Nod.MarkCompletedObjective(NodObjective2) player.MarkCompletedObjective(NodObjective2)
end end
end) end)
GDIObjective = GDI.AddPrimaryObjective("Eliminate all Nod forces in the area.") GDIObjective = enemy.AddPrimaryObjective("Eliminate all Nod forces in the area.")
NodObjective1 = Nod.AddPrimaryObjective("Kill all civilian GDI supporters.") NodObjective1 = player.AddPrimaryObjective("Kill all civilian GDI supporters.")
InsertNodUnits() InsertNodUnits()
Camera.Position = waypoint6.CenterPosition Camera.Position = waypoint6.CenterPosition
end end
Tick = function() Tick = function()
if Nod.HasNoRequiredUnits() then if player.HasNoRequiredUnits() then
if DateTime.GameTime > 2 then if DateTime.GameTime > 2 then
GDI.MarkCompletedObjective(GDIObjective) enemy.MarkCompletedObjective(GDIObjective)
end end
end end
end end

View File

@@ -21,7 +21,7 @@ Hummer1Waypoints = { waypoint8, waypoint7, waypoint6, waypoint5, waypoint4, wayp
Apc1TriggerFunctionTime = DateTime.Seconds(3) Apc1TriggerFunctionTime = DateTime.Seconds(3)
Apc1TriggerFunction = function() Apc1TriggerFunction = function()
Reinforcements.ReinforceWithTransport(GDI, 'apc', Apc1Units, Apc1Waypoints, nil, Reinforcements.ReinforceWithTransport(enemy, 'apc', Apc1Units, Apc1Waypoints, nil,
function(transport, cargo) function(transport, cargo)
Utils.Do(cargo, function(actor) Utils.Do(cargo, function(actor)
IdleHunt(actor) IdleHunt(actor)
@@ -31,7 +31,7 @@ Apc1TriggerFunction = function()
end end
Hum1TriggerFunction = function(actor, discoverer) Hum1TriggerFunction = function(actor, discoverer)
MyActors = Utils.Take(2, GDI.GetActorsByType('jeep')) MyActors = Utils.Take(2, enemy.GetActorsByType('jeep'))
Utils.Do(MyActors, function(actor) Utils.Do(MyActors, function(actor)
MoveAndHunt(actor, Hummer1Waypoints) MoveAndHunt(actor, Hummer1Waypoints)
end) end)
@@ -55,35 +55,35 @@ MoveAndHunt = function(unit)
end end
Apc2TriggerFunction = function() Apc2TriggerFunction = function()
MyActors = Utils.Take(1, GDI.GetActorsByType('apc')) MyActors = Utils.Take(1, enemy.GetActorsByType('apc'))
Utils.Do(MyActors, function(actor) Utils.Do(MyActors, function(actor)
MoveAndHunt(actor, Apc2Waypoints) MoveAndHunt(actor, Apc2Waypoints)
end) end)
end end
WinTriggerFunction = function() WinTriggerFunction = function()
Nod.MarkCompletedObjective(NodObjective1) player.MarkCompletedObjective(NodObjective1)
end end
InsertNodUnits = function() InsertNodUnits = function()
Camera.Position = CameraPoint.CenterPosition Camera.Position = CameraPoint.CenterPosition
Media.PlaySpeechNotification(Nod, "Reinforce") Media.PlaySpeechNotification(player, "Reinforce")
Reinforcements.ReinforceWithTransport(Nod, 'tran', NodUnitsBuggy, { EntryPointVehicle.Location, RallyPointVehicle.Location }, { EntryPointVehicle.Location }, nil, nil) Reinforcements.ReinforceWithTransport(player, 'tran', NodUnitsBuggy, { EntryPointVehicle.Location, RallyPointVehicle.Location }, { EntryPointVehicle.Location }, nil, nil)
Reinforcements.ReinforceWithTransport(Nod, 'tran', NodUnitsRocket, { EntryPointRocket.Location, RallyPointRocket.Location }, { EntryPointRocket.Location }, nil, nil) Reinforcements.ReinforceWithTransport(player, 'tran', NodUnitsRocket, { EntryPointRocket.Location, RallyPointRocket.Location }, { EntryPointRocket.Location }, nil, nil)
Reinforcements.ReinforceWithTransport(Nod, 'tran', NodUnitsGunner, { EntryPointGunner.Location, RallyPointGunner.Location }, { EntryPointGunner.Location }, nil, nil) Reinforcements.ReinforceWithTransport(player, 'tran', NodUnitsGunner, { EntryPointGunner.Location, RallyPointGunner.Location }, { EntryPointGunner.Location }, nil, nil)
end end
WorldLoaded = function() WorldLoaded = function()
GDI = Player.GetPlayer("GDI") player = Player.GetPlayer("Nod")
Nod = Player.GetPlayer("Nod") enemy = Player.GetPlayer("GDI")
Trigger.AfterDelay(Apc1TriggerFunctionTime, Apc1TriggerFunction) Trigger.AfterDelay(Apc1TriggerFunctionTime, Apc1TriggerFunction)
Trigger.OnEnteredFootprint(Civ2CellTriggerActivator, function(a, id) Trigger.OnEnteredFootprint(Civ2CellTriggerActivator, function(a, id)
if a.Owner == Nod then if a.Owner == player then
for type, count in pairs({ ['c6'] = 1, ['c7'] = 1, ['c8'] = 1, ['c9'] = 1 }) do for type, count in pairs({ ['c6'] = 1, ['c7'] = 1, ['c8'] = 1, ['c9'] = 1 }) do
MyActors = Utils.Take(count, GDI.GetActorsByType(type)) MyActors = Utils.Take(count, enemy.GetActorsByType(type))
Utils.Do(MyActors, function(actor) Utils.Do(MyActors, function(actor)
Movement(actor, Civ2Waypoints) Movement(actor, Civ2Waypoints)
end) end)
@@ -93,9 +93,9 @@ WorldLoaded = function()
end) end)
Trigger.OnEnteredFootprint(Civ1CellTriggerActivator, function(a, id) Trigger.OnEnteredFootprint(Civ1CellTriggerActivator, function(a, id)
if a.Owner == Nod then if a.Owner == player then
for type, count in pairs({ ['c2'] = 1, ['c3'] = 1, ['c4'] = 1, ['c5'] = 1 }) do for type, count in pairs({ ['c2'] = 1, ['c3'] = 1, ['c4'] = 1, ['c5'] = 1 }) do
MyActors = Utils.Take(count, GDI.GetActorsByType(type)) MyActors = Utils.Take(count, enemy.GetActorsByType(type))
Utils.Do(MyActors, function(actor) Utils.Do(MyActors, function(actor)
Movement(actor, Civ1Waypoints) Movement(actor, Civ1Waypoints)
end) end)
@@ -109,50 +109,50 @@ WorldLoaded = function()
Trigger.OnAllRemovedFromWorld(Apc2ActorTriggerActivator, Apc2TriggerFunction) Trigger.OnAllRemovedFromWorld(Apc2ActorTriggerActivator, Apc2TriggerFunction)
Trigger.OnEnteredFootprint(Apc3CellTriggerActivator, function(a, id) Trigger.OnEnteredFootprint(Apc3CellTriggerActivator, function(a, id)
if a.Owner == Nod then if a.Owner == player then
MoveAndHunt(GDI.GetActorsByType('apc')[1], Apc3Waypoints) MoveAndHunt(enemy.GetActorsByType('apc')[1], Apc3Waypoints)
Trigger.RemoveFootprintTrigger(id) Trigger.RemoveFootprintTrigger(id)
end end
end) end)
Trigger.OnAllRemovedFromWorld(WinActorTriggerActivator, WinTriggerFunction) Trigger.OnAllRemovedFromWorld(WinActorTriggerActivator, WinTriggerFunction)
Trigger.OnObjectiveAdded(Nod, function(p, id) Trigger.OnObjectiveAdded(player, function(p, id)
Media.DisplayMessage(p.GetObjectiveDescription(id), "New " .. string.lower(p.GetObjectiveType(id)) .. " objective") Media.DisplayMessage(p.GetObjectiveDescription(id), "New " .. string.lower(p.GetObjectiveType(id)) .. " objective")
end) end)
Trigger.OnObjectiveCompleted(Nod, function(p, id) Trigger.OnObjectiveCompleted(player, function(p, id)
Media.DisplayMessage(p.GetObjectiveDescription(id), "Objective completed") Media.DisplayMessage(p.GetObjectiveDescription(id), "Objective completed")
end) end)
Trigger.OnObjectiveFailed(Nod, function(p, id) Trigger.OnObjectiveFailed(player, function(p, id)
Media.DisplayMessage(p.GetObjectiveDescription(id), "Objective failed") Media.DisplayMessage(p.GetObjectiveDescription(id), "Objective failed")
end) end)
Trigger.OnPlayerWon(Nod, function() Trigger.OnPlayerWon(player, function()
Media.PlaySpeechNotification(Nod, "Win") Media.PlaySpeechNotification(player, "Win")
end) end)
Trigger.OnPlayerLost(Nod, function() Trigger.OnPlayerLost(player, function()
Media.PlaySpeechNotification(Nod, "Lose") Media.PlaySpeechNotification(player, "Lose")
end) end)
GDIObjective = GDI.AddPrimaryObjective("Kill all enemies.") GDIObjective = enemy.AddPrimaryObjective("Kill all enemies.")
NodObjective1 = Nod.AddPrimaryObjective("Destroy the village and kill all civilians.") NodObjective1 = player.AddPrimaryObjective("Destroy the village and kill all civilians.")
NodObjective2 = Nod.AddSecondaryObjective("Kill all GDI units in the area.") NodObjective2 = player.AddSecondaryObjective("Kill all GDI units in the area.")
InsertNodUnits() InsertNodUnits()
end end
Tick = function() Tick = function()
if Nod.HasNoRequiredUnits() then if player.HasNoRequiredUnits() then
if DateTime.GameTime > 2 then if DateTime.GameTime > 2 then
GDI.MarkCompletedObjective(GDIObjective) enemy.MarkCompletedObjective(GDIObjective)
end end
end end
if GDI.HasNoRequiredUnits() then if enemy.HasNoRequiredUnits() then
Nod.MarkCompletedObjective(NodObjective2) player.MarkCompletedObjective(NodObjective2)
end end
end end

View File

@@ -42,7 +42,7 @@ PrimaryTargets = { Tower1, Tower2, Radar, Silo1, Silo2, Silo3, Refinery, Barrack
GDIStartUnits = { } GDIStartUnits = { }
SendGDIAirstrike = function() SendGDIAirstrike = function()
if not Radar.IsDead and Radar.Owner == GDI then if not Radar.IsDead and Radar.Owner == enemy then
local target = getAirstrikeTarget() local target = getAirstrikeTarget()
if target then if target then
@@ -57,7 +57,7 @@ end
YyyyTriggerFunction = function() YyyyTriggerFunction = function()
if not YyyyTriggerSwitch then if not YyyyTriggerSwitch then
for type, count in pairs(Gdi2Units) do for type, count in pairs(Gdi2Units) do
MyActors = Utils.Take(count, GDI.GetActorsByType(type)) MyActors = Utils.Take(count, enemy.GetActorsByType(type))
Utils.Do(MyActors, function(actor) Utils.Do(MyActors, function(actor)
WaypointMovementAndHunt(actor, Gdi2Waypoints) WaypointMovementAndHunt(actor, Gdi2Waypoints)
end) end)
@@ -68,7 +68,7 @@ end
ZzzzTriggerFunction = function() ZzzzTriggerFunction = function()
if not ZzzzTriggerSwitch then if not ZzzzTriggerSwitch then
for type, count in pairs(Gdi1Units) do for type, count in pairs(Gdi1Units) do
MyActors = Utils.Take(count, GDI.GetActorsByType(type)) MyActors = Utils.Take(count, enemy.GetActorsByType(type))
Utils.Do(MyActors, function(actor) Utils.Do(MyActors, function(actor)
WaypointMovementAndHunt(actor, Gdi1Waypoints) WaypointMovementAndHunt(actor, Gdi1Waypoints)
end) end)
@@ -77,19 +77,19 @@ ZzzzTriggerFunction = function()
end end
Grd1TriggerFunction = function() Grd1TriggerFunction = function()
MyActors = Utils.Take(2, GDI.GetActorsByType('jeep')) MyActors = Utils.Take(2, enemy.GetActorsByType('jeep'))
Utils.Do(MyActors, function(actor) Utils.Do(MyActors, function(actor)
WaypointMovementAndHunt(actor, Gdi5Waypoints) WaypointMovementAndHunt(actor, Gdi5Waypoints)
end) end)
end end
Atk5TriggerFunction = function() Atk5TriggerFunction = function()
WaypointMovementAndHunt(GDI.GetActorsByType('mtnk')[1], Gdi12Waypoints) WaypointMovementAndHunt(enemy.GetActorsByType('mtnk')[1], Gdi12Waypoints)
end end
Atk2TriggerFunction = function() Atk2TriggerFunction = function()
for type, count in pairs(Gdi1Units) do for type, count in pairs(Gdi1Units) do
MyActors = Utils.Take(count, GDI.GetActorsByType(type)) MyActors = Utils.Take(count, enemy.GetActorsByType(type))
Utils.Do(MyActors, function(actor) Utils.Do(MyActors, function(actor)
WaypointMovementAndHunt(actor, Gdi1Waypoints) WaypointMovementAndHunt(actor, Gdi1Waypoints)
end) end)
@@ -98,7 +98,7 @@ end
Atk3TriggerFunction = function() Atk3TriggerFunction = function()
for type, count in pairs(Gdi2Units) do for type, count in pairs(Gdi2Units) do
MyActors = Utils.Take(count, GDI.GetActorsByType(type)) MyActors = Utils.Take(count, enemy.GetActorsByType(type))
Utils.Do(MyActors, function(actor) Utils.Do(MyActors, function(actor)
WaypointMovementAndHunt(actor, Gdi2Waypoints) WaypointMovementAndHunt(actor, Gdi2Waypoints)
end) end)
@@ -106,15 +106,15 @@ Atk3TriggerFunction = function()
end end
Atk4TriggerFunction = function() Atk4TriggerFunction = function()
WaypointMovementAndHunt(GDI.GetActorsByType('jeep')[1], Gdi3Waypoints) WaypointMovementAndHunt(enemy.GetActorsByType('jeep')[1], Gdi3Waypoints)
end end
Atk6TriggerFunction = function() Atk6TriggerFunction = function()
WaypointMovementAndHunt(GDI.GetActorsByType('mtnk')[1], Gdi2Waypoints) WaypointMovementAndHunt(enemy.GetActorsByType('mtnk')[1], Gdi2Waypoints)
end end
Atk1TriggerFunction = function() Atk1TriggerFunction = function()
Reinforcements.ReinforceWithTransport(GDI, 'tran', GDIReinforceUnits, { waypoint9.Location, waypoint26.Location }, nil, Reinforcements.ReinforceWithTransport(enemy, 'tran', GDIReinforceUnits, { waypoint9.Location, waypoint26.Location }, nil,
function(transport, cargo) function(transport, cargo)
transport.UnloadPassengers() transport.UnloadPassengers()
Utils.Do(cargo, function(actor) Utils.Do(cargo, function(actor)
@@ -128,7 +128,7 @@ AutoTriggerFunction = function()
local waypoints = AllWaypoints[DateTime.GameTime % #AllWaypoints + 1] local waypoints = AllWaypoints[DateTime.GameTime % #AllWaypoints + 1]
for type, count in pairs(units) do for type, count in pairs(units) do
MyActors = Utils.Take(count, GDI.GetActorsByType(type)) MyActors = Utils.Take(count, enemy.GetActorsByType(type))
Utils.Do(MyActors, function(actor) Utils.Do(MyActors, function(actor)
WaypointMovementAndHunt(actor, waypoints) WaypointMovementAndHunt(actor, waypoints)
end) end)
@@ -136,7 +136,7 @@ AutoTriggerFunction = function()
end end
HuntTriggerFunction = function() HuntTriggerFunction = function()
local list = GDI.GetGroundAttackers() local list = enemy.GetGroundAttackers()
Utils.Do(list, function(unit) Utils.Do(list, function(unit)
IdleHunt(unit) IdleHunt(unit)
end) end)
@@ -154,58 +154,58 @@ end
InsertNodUnits = function() InsertNodUnits = function()
Camera.Position = UnitsEntry.CenterPosition Camera.Position = UnitsEntry.CenterPosition
Media.PlaySpeechNotification(Nod, "Reinforce") Media.PlaySpeechNotification(player, "Reinforce")
Reinforcements.Reinforce(Nod, NodUnitsVehicle, { UnitsEntry.Location, UnitsRallyVehicle.Location }, 1) Reinforcements.Reinforce(player, NodUnitsVehicle, { UnitsEntry.Location, UnitsRallyVehicle.Location }, 1)
Reinforcements.Reinforce(Nod, NodUnitsRocket, { UnitsEntry.Location, UnitsRallyRocket.Location }, 50) Reinforcements.Reinforce(player, NodUnitsRocket, { UnitsEntry.Location, UnitsRallyRocket.Location }, 50)
Reinforcements.Reinforce(Nod, NodUnitsGunner, { UnitsEntry.Location, UnitsRallyGunner.Location }, 50) Reinforcements.Reinforce(player, NodUnitsGunner, { UnitsEntry.Location, UnitsRallyGunner.Location }, 50)
Trigger.AfterDelay(DateTime.Seconds(6), function() Trigger.AfterDelay(DateTime.Seconds(6), function()
Reinforcements.Reinforce(Nod, { 'mcv' }, { UnitsEntry.Location, UnitsRallyMCV.Location }) Reinforcements.Reinforce(player, { 'mcv' }, { UnitsEntry.Location, UnitsRallyMCV.Location })
end) end)
end end
WorldLoaded = function() WorldLoaded = function()
GDI = Player.GetPlayer("GDI") player = Player.GetPlayer("Nod")
Nod = Player.GetPlayer("Nod") enemy = Player.GetPlayer("GDI")
InsertNodUnits() InsertNodUnits()
Trigger.OnObjectiveAdded(Nod, function(p, id) Trigger.OnObjectiveAdded(player, function(p, id)
Media.DisplayMessage(p.GetObjectiveDescription(id), "New " .. string.lower(p.GetObjectiveType(id)) .. " objective") Media.DisplayMessage(p.GetObjectiveDescription(id), "New " .. string.lower(p.GetObjectiveType(id)) .. " objective")
end) end)
Trigger.OnObjectiveCompleted(Nod, function(p, id) Trigger.OnObjectiveCompleted(player, function(p, id)
Media.DisplayMessage(p.GetObjectiveDescription(id), "Objective completed") Media.DisplayMessage(p.GetObjectiveDescription(id), "Objective completed")
end) end)
Trigger.OnObjectiveFailed(Nod, function(p, id) Trigger.OnObjectiveFailed(player, function(p, id)
Media.DisplayMessage(p.GetObjectiveDescription(id), "Objective failed") Media.DisplayMessage(p.GetObjectiveDescription(id), "Objective failed")
end) end)
Trigger.OnPlayerWon(Nod, function() Trigger.OnPlayerWon(player, function()
Media.PlaySpeechNotification(Nod, "Win") Media.PlaySpeechNotification(player, "Win")
end) end)
Trigger.OnPlayerLost(Nod, function() Trigger.OnPlayerLost(player, function()
Media.PlaySpeechNotification(Nod, "Lose") Media.PlaySpeechNotification(player, "Lose")
end) end)
NodObjective1 = Nod.AddPrimaryObjective("Build 3 SAMs.") NodObjective1 = player.AddPrimaryObjective("Build 3 SAMs.")
NodObjective2 = Nod.AddPrimaryObjective("Destroy the GDI base.") NodObjective2 = player.AddPrimaryObjective("Destroy the GDI base.")
GDIObjective = GDI.AddPrimaryObjective("Kill all enemies.") GDIObjective = enemy.AddPrimaryObjective("Kill all enemies.")
Trigger.AfterDelay(AirstrikeDelay, SendGDIAirstrike) Trigger.AfterDelay(AirstrikeDelay, SendGDIAirstrike)
Trigger.AfterDelay(YyyyTriggerFunctionTime, YyyyTriggerFunction) Trigger.AfterDelay(YyyyTriggerFunctionTime, YyyyTriggerFunction)
Trigger.AfterDelay(ZzzzTriggerFunctionTime, ZzzzTriggerFunction) Trigger.AfterDelay(ZzzzTriggerFunctionTime, ZzzzTriggerFunction)
Trigger.OnEnteredFootprint(DelyCellTriggerActivator, function(a, id) Trigger.OnEnteredFootprint(DelyCellTriggerActivator, function(a, id)
if a.Owner == Nod then if a.Owner == player then
YyyyTriggerSwitch = true YyyyTriggerSwitch = true
Trigger.RemoveFootprintTrigger(id) Trigger.RemoveFootprintTrigger(id)
end end
end) end)
Trigger.OnEnteredFootprint(DelzCellTriggerActivator, function(a, id) Trigger.OnEnteredFootprint(DelzCellTriggerActivator, function(a, id)
if a.Owner == Nod then if a.Owner == player then
ZzzzTriggerSwitch = true ZzzzTriggerSwitch = true
Trigger.RemoveFootprintTrigger(id) Trigger.RemoveFootprintTrigger(id)
end end
@@ -214,7 +214,7 @@ WorldLoaded = function()
Trigger.AfterDelay(Grd1TriggerFunctionTime, Grd1TriggerFunction) Trigger.AfterDelay(Grd1TriggerFunctionTime, Grd1TriggerFunction)
Trigger.OnEnteredFootprint(Atk5CellTriggerActivator, function(a, id) Trigger.OnEnteredFootprint(Atk5CellTriggerActivator, function(a, id)
if a.Owner == Nod then if a.Owner == player then
Atk5TriggerFunction() Atk5TriggerFunction()
Trigger.RemoveFootprintTrigger(id) Trigger.RemoveFootprintTrigger(id)
end end
@@ -226,7 +226,7 @@ WorldLoaded = function()
Trigger.AfterDelay(Atk6TriggerFunctionTime, Atk6TriggerFunction) Trigger.AfterDelay(Atk6TriggerFunctionTime, Atk6TriggerFunction)
Trigger.OnEnteredFootprint(Atk1CellTriggerActivator, function(a, id) Trigger.OnEnteredFootprint(Atk1CellTriggerActivator, function(a, id)
if a.Owner == Nod then if a.Owner == player then
Atk1TriggerFunction() Atk1TriggerFunction()
Trigger.RemoveFootprintTrigger(id) Trigger.RemoveFootprintTrigger(id)
end end
@@ -236,7 +236,7 @@ WorldLoaded = function()
Trigger.OnDiscovered(Tower2, AutoTriggerFunction) Trigger.OnDiscovered(Tower2, AutoTriggerFunction)
Trigger.OnAllKilledOrCaptured(PrimaryTargets, function() Trigger.OnAllKilledOrCaptured(PrimaryTargets, function()
Nod.MarkCompletedObjective(NodObjective2) player.MarkCompletedObjective(NodObjective2)
HuntTriggerFunction() HuntTriggerFunction()
end) end)
@@ -244,18 +244,18 @@ WorldLoaded = function()
end end
Tick = function() Tick = function()
if Nod.HasNoRequiredUnits() then if player.HasNoRequiredUnits() then
if DateTime.GameTime > 2 then if DateTime.GameTime > 2 then
GDI.MarkCompletedObjective(GDIObjective) enemy.MarkCompletedObjective(GDIObjective)
end end
end end
if not Nod.IsObjectiveCompleted(NodObjective1) and CheckForSams(Nod) then if not player.IsObjectiveCompleted(NodObjective1) and CheckForSams(player) then
Nod.MarkCompletedObjective(NodObjective1) player.MarkCompletedObjective(NodObjective1)
end end
if DateTime.GameTime % DateTime.Seconds(3) == 0 then if DateTime.GameTime % DateTime.Seconds(3) == 0 then
checkProduction(GDI) checkProduction(enemy)
end end
if DateTime.GameTime % DateTime.Seconds(45) == 0 then if DateTime.GameTime % DateTime.Seconds(45) == 0 then
@@ -270,13 +270,13 @@ IdleHunt = function(unit)
end end
CheckForSams = function(player) CheckForSams = function(player)
local sams = Nod.GetActorsByType("sam") local sams = player.GetActorsByType("sam")
return #sams >= 3 return #sams >= 3
end end
checkProduction = function(player) checkProduction = function(player)
local Units = Map.ActorsInBox(Map.TopLeft, Map.BottomRight, function(actor) local Units = Map.ActorsInBox(Map.TopLeft, Map.BottomRight, function(actor)
return actor.Owner == GDI return actor.Owner == enemy
end) end)
local UnitsType = { } local UnitsType = { }
@@ -293,9 +293,9 @@ checkProduction = function(player)
end end
end end
if #UnitsType > 0 then if #UnitsType > 0 then
if (type == 'jeep' or type == 'mtnk') and not Factory.IsDead and Factory.Owner == GDI then if (type == 'jeep' or type == 'mtnk') and not Factory.IsDead and Factory.Owner == enemy then
Factory.Build(UnitsType) Factory.Build(UnitsType)
elseif (type == 'e1' or type == 'e2') and not Barracks.IsDead and Barracks.Owner == GDI then elseif (type == 'e1' or type == 'e2') and not Barracks.IsDead and Barracks.Owner == enemy then
Barracks.Build(UnitsType) Barracks.Build(UnitsType)
end end
end end
@@ -305,7 +305,7 @@ end
getStartUnits = function() getStartUnits = function()
local Units = Map.ActorsInBox(Map.TopLeft, Map.BottomRight, function(actor) local Units = Map.ActorsInBox(Map.TopLeft, Map.BottomRight, function(actor)
return actor.Owner == GDI and ( actor.Type == 'e2' or actor.Type == 'e1' or actor.Type == 'jeep' or actor.Type == 'mtnk') return actor.Owner == enemy and ( actor.Type == 'e2' or actor.Type == 'e1' or actor.Type == 'jeep' or actor.Type == 'mtnk')
end) end)
Utils.Do(Units, function(unit) Utils.Do(Units, function(unit)
if not GDIStartUnits[unit.Type] then if not GDIStartUnits[unit.Type] then
@@ -318,7 +318,7 @@ end
searches = 0 searches = 0
getAirstrikeTarget = function() getAirstrikeTarget = function()
local list = Nod.GetGroundAttackers() local list = player.GetGroundAttackers()
local target = list[DateTime.GameTime % #list + 1].CenterPosition local target = list[DateTime.GameTime % #list + 1].CenterPosition
local sams = Map.ActorsInCircle(target, WDist.New(8 * 1024), function(actor) local sams = Map.ActorsInCircle(target, WDist.New(8 * 1024), function(actor)

View File

@@ -26,7 +26,7 @@ Gdi6Waypoints = { waypoint2, waypoints3 }
Grd1TriggerFunctionTime = DateTime.Seconds(3) Grd1TriggerFunctionTime = DateTime.Seconds(3)
Grd1TriggerFunction = function() Grd1TriggerFunction = function()
MyActors = Utils.Take(2, GDI.GetActorsByType('mtnk')) MyActors = Utils.Take(2, enemy.GetActorsByType('mtnk'))
Utils.Do(MyActors, function(actor) Utils.Do(MyActors, function(actor)
MovementAndHunt(actor, Gdi3Waypoints) MovementAndHunt(actor, Gdi3Waypoints)
end) end)
@@ -35,7 +35,7 @@ end
Grd2TriggerFunction = function() Grd2TriggerFunction = function()
if not Grd2Switch then if not Grd2Switch then
for type, count in pairs({ ['e1'] = 2, ['e2'] = 1, ['jeep'] = 1 }) do for type, count in pairs({ ['e1'] = 2, ['e2'] = 1, ['jeep'] = 1 }) do
MyActors = Utils.Take(count, GDI.GetActorsByType(type)) MyActors = Utils.Take(count, enemy.GetActorsByType(type))
Utils.Do(MyActors, function(actor) Utils.Do(MyActors, function(actor)
MovementAndHunt(actor, Gdi4Waypoints) MovementAndHunt(actor, Gdi4Waypoints)
end) end)
@@ -47,7 +47,7 @@ end
Atk1TriggerFunction = function() Atk1TriggerFunction = function()
if not Atk1Switch then if not Atk1Switch then
for type, count in pairs({ ['e1'] = 3, ['e2'] = 3, ['jeep'] = 1 }) do for type, count in pairs({ ['e1'] = 3, ['e2'] = 3, ['jeep'] = 1 }) do
MyActors = Utils.Take(count, GDI.GetActorsByType(type)) MyActors = Utils.Take(count, enemy.GetActorsByType(type))
Utils.Do(MyActors, function(actor) Utils.Do(MyActors, function(actor)
MovementAndHunt(actor, Gdi5Waypoints) MovementAndHunt(actor, Gdi5Waypoints)
end) end)
@@ -59,7 +59,7 @@ end
Atk2TriggerFunction = function() Atk2TriggerFunction = function()
if not Atk2Switch then if not Atk2Switch then
for type, count in pairs({ ['mtnk'] = 1, ['jeep'] = 1 }) do for type, count in pairs({ ['mtnk'] = 1, ['jeep'] = 1 }) do
MyActors = Utils.Take(count, GDI.GetActorsByType(type)) MyActors = Utils.Take(count, enemy.GetActorsByType(type))
Utils.Do(MyActors, function(actor) Utils.Do(MyActors, function(actor)
MovementAndHunt(actor, Gdi6Waypoints) MovementAndHunt(actor, Gdi6Waypoints)
end) end)
@@ -72,7 +72,7 @@ Atk3TriggerFunction = function()
if not Atk3Switch then if not Atk3Switch then
Atk3Switch = true Atk3Switch = true
if not Radar.IsDead then if not Radar.IsDead then
local targets = Nod.GetGroundAttackers() local targets = player.GetGroundAttackers()
local target = targets[DateTime.GameTime % #targets + 1].CenterPosition local target = targets[DateTime.GameTime % #targets + 1].CenterPosition
if target then if target then
@@ -83,22 +83,22 @@ Atk3TriggerFunction = function()
end end
Chn1TriggerFunction = function() Chn1TriggerFunction = function()
local cargo = Reinforcements.ReinforceWithTransport(GDI, 'tran', Chn1Units, Chn1Waypoints, { waypoint14.Location })[2] local cargo = Reinforcements.ReinforceWithTransport(enemy, 'tran', Chn1Units, Chn1Waypoints, { waypoint14.Location })[2]
Utils.Do(cargo, function(actor) Utils.Do(cargo, function(actor)
IdleHunt(actor) IdleHunt(actor)
end) end)
end end
Chn2TriggerFunction = function() Chn2TriggerFunction = function()
local cargo = Reinforcements.ReinforceWithTransport(GDI, 'tran', Chn2Units, Chn2Waypoints, { waypoint14.Location })[2] local cargo = Reinforcements.ReinforceWithTransport(enemy, 'tran', Chn2Units, Chn2Waypoints, { waypoint14.Location })[2]
Utils.Do(cargo, function(actor) Utils.Do(cargo, function(actor)
IdleHunt(actor) IdleHunt(actor)
end) end)
end end
Obj2TriggerFunction = function() Obj2TriggerFunction = function()
Nod.MarkCompletedObjective(NodObjective2) player.MarkCompletedObjective(NodObjective2)
Reinforcements.Reinforce(Nod, Obj2Units, { Obj2UnitsEntry.Location, waypoint13.Location }, 15) Reinforcements.Reinforce(player, Obj2Units, { Obj2UnitsEntry.Location, waypoint13.Location }, 15)
end end
MovementAndHunt = function(unit, waypoints) MovementAndHunt = function(unit, waypoints)
@@ -113,39 +113,39 @@ end
InsertNodUnits = function() InsertNodUnits = function()
Camera.Position = UnitsRallyRight.CenterPosition Camera.Position = UnitsRallyRight.CenterPosition
Media.PlaySpeechNotification(Nod, "Reinforce") Media.PlaySpeechNotification(player, "Reinforce")
Reinforcements.Reinforce(Nod, NodStartUnitsLeft, { UnitsEntryLeft.Location, UnitsRallyLeft.Location }, 15) Reinforcements.Reinforce(player, NodStartUnitsLeft, { UnitsEntryLeft.Location, UnitsRallyLeft.Location }, 15)
Reinforcements.Reinforce(Nod, NodStartUnitsRight, { UnitsEntryRight.Location, UnitsRallyRight.Location }, 15) Reinforcements.Reinforce(player, NodStartUnitsRight, { UnitsEntryRight.Location, UnitsRallyRight.Location }, 15)
end end
WorldLoaded = function() WorldLoaded = function()
GDI = Player.GetPlayer("GDI") player = Player.GetPlayer("Nod")
Nod = Player.GetPlayer("Nod") enemy = Player.GetPlayer("GDI")
Trigger.OnObjectiveAdded(Nod, function(p, id) Trigger.OnObjectiveAdded(player, function(p, id)
Media.DisplayMessage(p.GetObjectiveDescription(id), "New " .. string.lower(p.GetObjectiveType(id)) .. " objective") Media.DisplayMessage(p.GetObjectiveDescription(id), "New " .. string.lower(p.GetObjectiveType(id)) .. " objective")
end) end)
Trigger.OnObjectiveCompleted(Nod, function(p, id) Trigger.OnObjectiveCompleted(player, function(p, id)
Media.DisplayMessage(p.GetObjectiveDescription(id), "Objective completed") Media.DisplayMessage(p.GetObjectiveDescription(id), "Objective completed")
end) end)
Trigger.OnObjectiveFailed(Nod, function(p, id) Trigger.OnObjectiveFailed(player, function(p, id)
Media.DisplayMessage(p.GetObjectiveDescription(id), "Objective failed") Media.DisplayMessage(p.GetObjectiveDescription(id), "Objective failed")
end) end)
Trigger.OnPlayerWon(Nod, function() Trigger.OnPlayerWon(player, function()
Media.PlaySpeechNotification(Nod, "Win") Media.PlaySpeechNotification(player, "Win")
end) end)
Trigger.OnPlayerLost(Nod, function() Trigger.OnPlayerLost(player, function()
Media.PlaySpeechNotification(Nod, "Lose") Media.PlaySpeechNotification(player, "Lose")
end) end)
NodObjective1 = Nod.AddPrimaryObjective("Steal the GDI nuclear detonator.") NodObjective1 = player.AddPrimaryObjective("Steal the GDI nuclear detonator.")
NodObjective2 = Nod.AddSecondaryObjective("Destroy the houses of the GDI supporters\nin the village.") NodObjective2 = player.AddSecondaryObjective("Destroy the houses of the GDI supporters\nin the village.")
GDIObjective = GDI.AddPrimaryObjective("Stop the Nod taskforce from escaping with the detonator.") GDIObjective = enemy.AddPrimaryObjective("Stop the Nod taskforce from escaping with the detonator.")
InsertNodUnits() InsertNodUnits()
@@ -166,16 +166,16 @@ WorldLoaded = function()
Trigger.OnAllKilled(Chn2ActorTriggerActivator, Chn2TriggerFunction) Trigger.OnAllKilled(Chn2ActorTriggerActivator, Chn2TriggerFunction)
Trigger.OnEnteredFootprint(Chn3CellTriggerActivator, function(a, id) Trigger.OnEnteredFootprint(Chn3CellTriggerActivator, function(a, id)
if a.Owner == Nod then if a.Owner == player then
Media.PlaySpeechNotification(Nod, "Reinforce") Media.PlaySpeechNotification(player, "Reinforce")
Reinforcements.ReinforceWithTransport(Nod, 'tran', nil, { ChnEntry.Location, waypoint17.Location }, nil, nil, nil) Reinforcements.ReinforceWithTransport(player, 'tran', nil, { ChnEntry.Location, waypoint17.Location }, nil, nil, nil)
Trigger.RemoveFootprintTrigger(id) Trigger.RemoveFootprintTrigger(id)
end end
end) end)
Trigger.OnEnteredFootprint(DzneCellTriggerActivator, function(a, id) Trigger.OnEnteredFootprint(DzneCellTriggerActivator, function(a, id)
if a.Owner == Nod then if a.Owner == player then
Actor.Create('flare', true, { Owner = Nod, Location = waypoint17.Location }) Actor.Create('flare', true, { Owner = player, Location = waypoint17.Location })
Trigger.RemoveFootprintTrigger(id) Trigger.RemoveFootprintTrigger(id)
end end
end) end)
@@ -183,24 +183,24 @@ WorldLoaded = function()
Trigger.OnAllRemovedFromWorld(Obj2ActorTriggerActivator, Obj2TriggerFunction) Trigger.OnAllRemovedFromWorld(Obj2ActorTriggerActivator, Obj2TriggerFunction)
Trigger.OnEnteredFootprint(Win1CellTriggerActivator, function(a, id) Trigger.OnEnteredFootprint(Win1CellTriggerActivator, function(a, id)
if a.Owner == Nod then if a.Owner == player then
NodObjective3 = Nod.AddPrimaryObjective("Move to the evacuation point.") NodObjective3 = player.AddPrimaryObjective("Move to the evacuation point.")
Nod.MarkCompletedObjective(NodObjective1) player.MarkCompletedObjective(NodObjective1)
Trigger.RemoveFootprintTrigger(id) Trigger.RemoveFootprintTrigger(id)
end end
end) end)
Trigger.OnEnteredFootprint(Win2CellTriggerActivator, function(a, id) Trigger.OnEnteredFootprint(Win2CellTriggerActivator, function(a, id)
if a.Owner == Nod and NodObjective3 then if a.Owner == player and NodObjective3 then
Nod.MarkCompletedObjective(NodObjective3) player.MarkCompletedObjective(NodObjective3)
Trigger.RemoveFootprintTrigger(id) Trigger.RemoveFootprintTrigger(id)
end end
end) end)
end end
Tick = function() Tick = function()
if DateTime.GameTime > 2 and Nod.HasNoRequiredUnits() then if DateTime.GameTime > 2 and player.HasNoRequiredUnits() then
GDI.MarkCompletedObjective(GDIObjective) enemy.MarkCompletedObjective(GDIObjective)
end end
end end

View File

@@ -20,20 +20,20 @@ Chn2Waypoints = { ChnEntry.Location, waypoint0.Location }
Gdi5Waypoint = { waypoint1, waypoint2, waypoint3, waypoint4, waypoint5, waypoint6, waypoint7 } Gdi5Waypoint = { waypoint1, waypoint2, waypoint3, waypoint4, waypoint5, waypoint6, waypoint7 }
HuntTriggerFunction = function() HuntTriggerFunction = function()
local list = GDI.GetGroundAttackers() local list = enemy.GetGroundAttackers()
Utils.Do(list, function(unit) Utils.Do(list, function(unit)
IdleHunt(unit) IdleHunt(unit)
end) end)
end end
Win1TriggerFunction = function() Win1TriggerFunction = function()
NodObjective2 = Nod.AddPrimaryObjective("Move to the evacuation point.") NodObjective2 = player.AddPrimaryObjective("Move to the evacuation point.")
Nod.MarkCompletedObjective(NodObjective1) player.MarkCompletedObjective(NodObjective1)
end end
Chn1TriggerFunction = function() Chn1TriggerFunction = function()
if not Chn1Switch then if not Chn1Switch then
local cargo = Reinforcements.ReinforceWithTransport(GDI, 'tran', Gdi1Units, Chn1Waypoints, { ChnEntry.Location })[2] local cargo = Reinforcements.ReinforceWithTransport(enemy, 'tran', Gdi1Units, Chn1Waypoints, { ChnEntry.Location })[2]
Utils.Do(cargo, function(actor) Utils.Do(cargo, function(actor)
IdleHunt(actor) IdleHunt(actor)
end) end)
@@ -44,7 +44,7 @@ end
Atk1TriggerFunction = function() Atk1TriggerFunction = function()
if not Atk1Switch then if not Atk1Switch then
for type, count in pairs({ ['e2'] = 2, ['jeep'] = 1, ['e1'] = 2}) do for type, count in pairs({ ['e2'] = 2, ['jeep'] = 1, ['e1'] = 2}) do
MyActors = Utils.Take(count, GDI.GetActorsByType(type)) MyActors = Utils.Take(count, enemy.GetActorsByType(type))
Utils.Do(MyActors, function(actor) Utils.Do(MyActors, function(actor)
IdleHunt(actor) IdleHunt(actor)
end) end)
@@ -56,7 +56,7 @@ end
Atk2TriggerFunction = function() Atk2TriggerFunction = function()
if not Atk2Switch then if not Atk2Switch then
for type, count in pairs({ ['e2'] = 2, ['e1'] = 2}) do for type, count in pairs({ ['e2'] = 2, ['e1'] = 2}) do
MyActors = Utils.Take(count, GDI.GetActorsByType(type)) MyActors = Utils.Take(count, enemy.GetActorsByType(type))
Utils.Do(MyActors, function(actor) Utils.Do(MyActors, function(actor)
MoveAndHunt(actor, Gdi5Waypoint) MoveAndHunt(actor, Gdi5Waypoint)
end) end)
@@ -67,7 +67,7 @@ end
Chn2TriggerFunction = function() Chn2TriggerFunction = function()
if not Chn2Switch then if not Chn2Switch then
local cargo = Reinforcements.ReinforceWithTransport(GDI, 'tran', Gdi1Units, Chn2Waypoints, { ChnEntry.Location })[2] local cargo = Reinforcements.ReinforceWithTransport(enemy, 'tran', Gdi1Units, Chn2Waypoints, { ChnEntry.Location })[2]
Utils.Do(cargo, function(actor) Utils.Do(cargo, function(actor)
IdleHunt(actor) IdleHunt(actor)
end) end)
@@ -85,68 +85,68 @@ MoveAndHunt = function(unit, waypoints)
end end
InsertNodUnits = function() InsertNodUnits = function()
Media.PlaySpeechNotification(Nod, "Reinforce") Media.PlaySpeechNotification(player, "Reinforce")
Camera.Position = UnitsRallyVehicle2.CenterPosition Camera.Position = UnitsRallyVehicle2.CenterPosition
Reinforcements.Reinforce(Nod, NodUnitsVehicle1, { UnitsEntryVehicle.Location, UnitsRallyVehicle1.Location }, 10) Reinforcements.Reinforce(player, NodUnitsVehicle1, { UnitsEntryVehicle.Location, UnitsRallyVehicle1.Location }, 10)
Reinforcements.Reinforce(Nod, NodUnitsVehicle2, { UnitsEntryVehicle.Location, UnitsRallyVehicle2.Location }, 15) Reinforcements.Reinforce(player, NodUnitsVehicle2, { UnitsEntryVehicle.Location, UnitsRallyVehicle2.Location }, 15)
Reinforcements.Reinforce(Nod, NodUnitsGunner, { UnitsEntryGunner.Location, UnitsRallyGunner.Location }, 15) Reinforcements.Reinforce(player, NodUnitsGunner, { UnitsEntryGunner.Location, UnitsRallyGunner.Location }, 15)
Reinforcements.Reinforce(Nod, NodUnitsRocket, { UnitsEntryRocket.Location, UnitsRallyRocket.Location }, 25) Reinforcements.Reinforce(player, NodUnitsRocket, { UnitsEntryRocket.Location, UnitsRallyRocket.Location }, 25)
end end
WorldLoaded = function() WorldLoaded = function()
GDI = Player.GetPlayer("GDI") player = Player.GetPlayer("Nod")
Nod = Player.GetPlayer("Nod") enemy = Player.GetPlayer("GDI")
Trigger.OnObjectiveAdded(Nod, function(p, id) Trigger.OnObjectiveAdded(player, function(p, id)
Media.DisplayMessage(p.GetObjectiveDescription(id), "New " .. string.lower(p.GetObjectiveType(id)) .. " objective") Media.DisplayMessage(p.GetObjectiveDescription(id), "New " .. string.lower(p.GetObjectiveType(id)) .. " objective")
end) end)
Trigger.OnObjectiveCompleted(Nod, function(p, id) Trigger.OnObjectiveCompleted(player, function(p, id)
Media.DisplayMessage(p.GetObjectiveDescription(id), "Objective completed") Media.DisplayMessage(p.GetObjectiveDescription(id), "Objective completed")
end) end)
Trigger.OnObjectiveFailed(Nod, function(p, id) Trigger.OnObjectiveFailed(player, function(p, id)
Media.DisplayMessage(p.GetObjectiveDescription(id), "Objective failed") Media.DisplayMessage(p.GetObjectiveDescription(id), "Objective failed")
end) end)
Trigger.OnPlayerWon(Nod, function() Trigger.OnPlayerWon(player, function()
Media.PlaySpeechNotification(Nod, "Win") Media.PlaySpeechNotification(player, "Win")
end) end)
Trigger.OnPlayerLost(Nod, function() Trigger.OnPlayerLost(player, function()
Media.PlaySpeechNotification(Nod, "Lose") Media.PlaySpeechNotification(player, "Lose")
end) end)
NodObjective1 = Nod.AddPrimaryObjective("Steal the GDI nuclear detonator.") NodObjective1 = player.AddPrimaryObjective("Steal the GDI nuclear detonator.")
GDIObjective = GDI.AddPrimaryObjective("Stop the Nod taskforce from escaping with the detonator.") GDIObjective = enemy.AddPrimaryObjective("Stop the Nod taskforce from escaping with the detonator.")
InsertNodUnits() InsertNodUnits()
Trigger.OnEnteredFootprint(HuntCellTriggerActivator, function(a, id) Trigger.OnEnteredFootprint(HuntCellTriggerActivator, function(a, id)
if a.Owner == Nod then if a.Owner == player then
HuntTriggerFunction() HuntTriggerFunction()
Trigger.RemoveFootprintTrigger(id) Trigger.RemoveFootprintTrigger(id)
end end
end) end)
Trigger.OnEnteredFootprint(DzneCellTriggerActivator, function(a, id) Trigger.OnEnteredFootprint(DzneCellTriggerActivator, function(a, id)
if a.Owner == Nod then if a.Owner == player then
Actor.Create('flare', true, { Owner = Nod, Location = waypoint17.Location }) Actor.Create('flare', true, { Owner = player, Location = waypoint17.Location })
Trigger.RemoveFootprintTrigger(id) Trigger.RemoveFootprintTrigger(id)
end end
end) end)
Trigger.OnEnteredFootprint(Win1CellTriggerActivator, function(a, id) Trigger.OnEnteredFootprint(Win1CellTriggerActivator, function(a, id)
if a.Owner == Nod then if a.Owner == player then
Win1TriggerFunction() Win1TriggerFunction()
Trigger.RemoveFootprintTrigger(id) Trigger.RemoveFootprintTrigger(id)
end end
end) end)
Trigger.OnEnteredFootprint(Win2CellTriggerActivator, function(a, id) Trigger.OnEnteredFootprint(Win2CellTriggerActivator, function(a, id)
if a.Owner == Nod and NodObjective2 then if a.Owner == player and NodObjective2 then
Nod.MarkCompletedObjective(NodObjective2) player.MarkCompletedObjective(NodObjective2)
Trigger.RemoveFootprintTrigger(id) Trigger.RemoveFootprintTrigger(id)
end end
end) end)
@@ -160,18 +160,18 @@ WorldLoaded = function()
OnAnyDamaged(Chn2ActorTriggerActivator, Chn2TriggerFunction) OnAnyDamaged(Chn2ActorTriggerActivator, Chn2TriggerFunction)
Trigger.OnEnteredFootprint(ChnCellTriggerActivator, function(a, id) Trigger.OnEnteredFootprint(ChnCellTriggerActivator, function(a, id)
if a.Owner == Nod then if a.Owner == player then
Media.PlaySpeechNotification(Nod, "Reinforce") Media.PlaySpeechNotification(player, "Reinforce")
Reinforcements.ReinforceWithTransport(Nod, 'tran', nil, { ChnEntry.Location, waypoint17.Location }, nil, nil, nil) Reinforcements.ReinforceWithTransport(player, 'tran', nil, { ChnEntry.Location, waypoint17.Location }, nil, nil, nil)
Trigger.RemoveFootprintTrigger(id) Trigger.RemoveFootprintTrigger(id)
end end
end) end)
end end
Tick = function() Tick = function()
if Nod.HasNoRequiredUnits() then if player.HasNoRequiredUnits() then
if DateTime.GameTime > 2 then if DateTime.GameTime > 2 then
GDI.MarkCompletedObjective(GDIObjective) enemy.MarkCompletedObjective(GDIObjective)
end end
end end
end end

View File

@@ -24,7 +24,7 @@ ProdTriggerFunctionTime = DateTime.Minutes(5)
Atk1TriggerFunction = function() Atk1TriggerFunction = function()
for type, count in pairs({ ['e1'] = 2, ['e2'] = 3 }) do for type, count in pairs({ ['e1'] = 2, ['e2'] = 3 }) do
MyActors = Utils.Take(count, GDI.GetActorsByType(type)) MyActors = Utils.Take(count, enemy.GetActorsByType(type))
Utils.Do(MyActors, function(actor) Utils.Do(MyActors, function(actor)
MovementAndHunt(actor, Grd1Waypoints) MovementAndHunt(actor, Grd1Waypoints)
end) end)
@@ -33,7 +33,7 @@ end
Atk2TriggerFunction = function() Atk2TriggerFunction = function()
for type, count in pairs({ ['e1'] = 2, ['e2'] = 3 , ['jeep'] = 1}) do for type, count in pairs({ ['e1'] = 2, ['e2'] = 3 , ['jeep'] = 1}) do
MyActors = Utils.Take(count, GDI.GetActorsByType(type)) MyActors = Utils.Take(count, enemy.GetActorsByType(type))
Utils.Do(MyActors, function(actor) Utils.Do(MyActors, function(actor)
IdleHunt(actor) IdleHunt(actor)
end) end)
@@ -44,14 +44,14 @@ ProdTriggerFunction = function()
local Units = AllUnits[DateTime.GameTime % #AllUnits + 1] local Units = AllUnits[DateTime.GameTime % #AllUnits + 1]
Utils.Do(Units, function(UnitType) Utils.Do(Units, function(UnitType)
if (UnitType == 'jeep' or UnitType == 'mtnk') and not Factory.IsDead and Factory.Owner == GDI then if (UnitType == 'jeep' or UnitType == 'mtnk') and not Factory.IsDead and Factory.Owner == enemy then
Factory.Build({UnitType}) Factory.Build({UnitType})
elseif (UnitType == 'e1' or UnitType == 'e2' or UnitType == 'e3') and not Barracks.IsDead and Barracks.Owner == GDI then elseif (UnitType == 'e1' or UnitType == 'e2' or UnitType == 'e3') and not Barracks.IsDead and Barracks.Owner == enemy then
Barracks.Build({UnitType}) Barracks.Build({UnitType})
end end
end) end)
local list = GDI.GetGroundAttackers() local list = enemy.GetGroundAttackers()
local counter = 1 local counter = 1
while counter <= 5 do while counter <= 5 do
counter = counter + 1 counter = counter + 1
@@ -75,40 +75,40 @@ end
InsertNodUnits = function() InsertNodUnits = function()
Camera.Position = UnitsRallyRight.CenterPosition Camera.Position = UnitsRallyRight.CenterPosition
Media.PlaySpeechNotification(Nod, "Reinforce") Media.PlaySpeechNotification(player, "Reinforce")
Reinforcements.Reinforce(Nod, NodStartUnitsVehicle, { UnitsEntryMiddle.Location, UnitsRallyMiddle.Location }, 30) Reinforcements.Reinforce(player, NodStartUnitsVehicle, { UnitsEntryMiddle.Location, UnitsRallyMiddle.Location }, 30)
Reinforcements.Reinforce(Nod, NodStartUnitsMiddle, { UnitsEntryMiddle.Location, UnitsRallyMiddle.Location }, 15) Reinforcements.Reinforce(player, NodStartUnitsMiddle, { UnitsEntryMiddle.Location, UnitsRallyMiddle.Location }, 15)
Reinforcements.Reinforce(Nod, NodStartUnitsLeft, { UnitsEntryLeft.Location, UnitsRallyLeft.Location }, 15) Reinforcements.Reinforce(player, NodStartUnitsLeft, { UnitsEntryLeft.Location, UnitsRallyLeft.Location }, 15)
Reinforcements.Reinforce(Nod, NodStartUnitsRight, { UnitsEntryRight.Location, UnitsRallyRight.Location }, 15) Reinforcements.Reinforce(player, NodStartUnitsRight, { UnitsEntryRight.Location, UnitsRallyRight.Location }, 15)
end end
WorldLoaded = function() WorldLoaded = function()
GDI = Player.GetPlayer("GDI") player = Player.GetPlayer("Nod")
Nod = Player.GetPlayer("Nod") enemy = Player.GetPlayer("GDI")
Trigger.OnObjectiveAdded(Nod, function(p, id) Trigger.OnObjectiveAdded(player, function(p, id)
Media.DisplayMessage(p.GetObjectiveDescription(id), "New " .. string.lower(p.GetObjectiveType(id)) .. " objective") Media.DisplayMessage(p.GetObjectiveDescription(id), "New " .. string.lower(p.GetObjectiveType(id)) .. " objective")
end) end)
Trigger.OnObjectiveCompleted(Nod, function(p, id) Trigger.OnObjectiveCompleted(player, function(p, id)
Media.DisplayMessage(p.GetObjectiveDescription(id), "Objective completed") Media.DisplayMessage(p.GetObjectiveDescription(id), "Objective completed")
end) end)
Trigger.OnObjectiveFailed(Nod, function(p, id) Trigger.OnObjectiveFailed(player, function(p, id)
Media.DisplayMessage(p.GetObjectiveDescription(id), "Objective failed") Media.DisplayMessage(p.GetObjectiveDescription(id), "Objective failed")
end) end)
Trigger.OnPlayerWon(Nod, function() Trigger.OnPlayerWon(player, function()
Media.PlaySpeechNotification(Nod, "Win") Media.PlaySpeechNotification(player, "Win")
end) end)
Trigger.OnPlayerLost(Nod, function() Trigger.OnPlayerLost(player, function()
Media.PlaySpeechNotification(Nod, "Lose") Media.PlaySpeechNotification(player, "Lose")
end) end)
NodObjective1 = Nod.AddPrimaryObjective("Steal the GDI nuclear detonator.") NodObjective1 = player.AddPrimaryObjective("Steal the GDI nuclear detonator.")
NodObjective3 = Nod.AddSecondaryObjective("Infiltrate the barracks, weapon factory and \nthe construction yard.") NodObjective3 = player.AddSecondaryObjective("Infiltrate the barracks, weapon factory and \nthe construction yard.")
GDIObjective = GDI.AddPrimaryObjective("Stop the Nod taskforce from escaping with the detonator.") GDIObjective = enemy.AddPrimaryObjective("Stop the Nod taskforce from escaping with the detonator.")
InsertNodUnits() InsertNodUnits()
@@ -117,31 +117,31 @@ WorldLoaded = function()
Trigger.OnAllKilled(Atk2ActorTriggerActivator, Atk2TriggerFunction) Trigger.OnAllKilled(Atk2ActorTriggerActivator, Atk2TriggerFunction)
Trigger.OnEnteredFootprint(ChinCellTriggerActivator, function(a, id) Trigger.OnEnteredFootprint(ChinCellTriggerActivator, function(a, id)
if a.Owner == Nod then if a.Owner == player then
Media.PlaySpeechNotification(Nod, "Reinforce") Media.PlaySpeechNotification(player, "Reinforce")
Reinforcements.ReinforceWithTransport(Nod, 'tran', nil, { ChnEntry.Location, waypoint10.Location }, nil, nil, nil) Reinforcements.ReinforceWithTransport(player, 'tran', nil, { ChnEntry.Location, waypoint10.Location }, nil, nil, nil)
Trigger.RemoveFootprintTrigger(id) Trigger.RemoveFootprintTrigger(id)
end end
end) end)
Trigger.OnEnteredFootprint(DzneCellTriggerActivator, function(a, id) Trigger.OnEnteredFootprint(DzneCellTriggerActivator, function(a, id)
if a.Owner == Nod then if a.Owner == player then
Actor.Create('flare', true, { Owner = Nod, Location = waypoint10.Location }) Actor.Create('flare', true, { Owner = player, Location = waypoint10.Location })
Trigger.RemoveFootprintTrigger(id) Trigger.RemoveFootprintTrigger(id)
end end
end) end)
Trigger.OnEnteredFootprint(Win1CellTriggerActivator, function(a, id) Trigger.OnEnteredFootprint(Win1CellTriggerActivator, function(a, id)
if a.Owner == Nod then if a.Owner == player then
NodObjective2 = Nod.AddPrimaryObjective("Move to the evacuation point.") NodObjective2 = player.AddPrimaryObjective("Move to the evacuation point.")
Nod.MarkCompletedObjective(NodObjective1) player.MarkCompletedObjective(NodObjective1)
Trigger.RemoveFootprintTrigger(id) Trigger.RemoveFootprintTrigger(id)
end end
end) end)
Trigger.OnEnteredFootprint(Win2CellTriggerActivator, function(a, id) Trigger.OnEnteredFootprint(Win2CellTriggerActivator, function(a, id)
if a.Owner == Nod and NodObjective2 then if a.Owner == player and NodObjective2 then
Nod.MarkCompletedObjective(NodObjective2) player.MarkCompletedObjective(NodObjective2)
Trigger.RemoveFootprintTrigger(id) Trigger.RemoveFootprintTrigger(id)
end end
end) end)
@@ -150,16 +150,16 @@ WorldLoaded = function()
end end
Tick = function() Tick = function()
if DateTime.GameTime > 2 and Nod.HasNoRequiredUnits() then if DateTime.GameTime > 2 and player.HasNoRequiredUnits() then
GDI.MarkCompletedObjective(GDIObjective) enemy.MarkCompletedObjective(GDIObjective)
end end
if DateTime.GameTime % 5 == 0 and Barracks.Owner == Nod and Factory.Owner == Nod and Yard.Owner == Nod then if DateTime.GameTime % 5 == 0 and Barracks.Owner == player and Factory.Owner == player and Yard.Owner == player then
Nod.MarkCompletedObjective(NodObjective3) player.MarkCompletedObjective(NodObjective3)
end end
if DateTime.GameTime % 7 == 0 and not Nod.IsObjectiveCompleted(NodObjective3) and (Barracks.IsDead or Factory.IsDead or Yard.IsDead) then if DateTime.GameTime % 7 == 0 and not player.IsObjectiveCompleted(NodObjective3) and (Barracks.IsDead or Factory.IsDead or Yard.IsDead) then
Nod.MarkFailedObjective(NodObjective3) player.MarkFailedObjective(NodObjective3)
end end
end end