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)
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
Utils.Do(units, function(a)
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
WorldLoaded = function()
nod = Player.GetPlayer("Nod")
player = Player.GetPlayer("Nod")
dinosaur = Player.GetPlayer("Dinosaur")
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")
end)
Trigger.OnObjectiveCompleted(nod, function(p, id)
Trigger.OnObjectiveCompleted(player, function(p, id)
Media.DisplayMessage(p.GetObjectiveDescription(id), "Objective completed")
end)
Trigger.OnObjectiveFailed(nod, function(p, id)
Trigger.OnObjectiveFailed(player, function(p, id)
Media.DisplayMessage(p.GetObjectiveDescription(id), "Objective failed")
end)
Trigger.OnPlayerWon(nod, function()
Media.PlaySpeechNotification(nod, "Win")
Trigger.OnPlayerWon(player, function()
Media.PlaySpeechNotification(player, "Win")
end)
Trigger.OnPlayerLost(nod, function()
Media.PlaySpeechNotification(nod, "Lose")
Trigger.OnPlayerLost(player, function()
Media.PlaySpeechNotification(player, "Lose")
end)
ReachVillageObj = nod.AddPrimaryObjective("Reach the village.")
ReachVillageObj = player.AddPrimaryObjective("Reach the village.")
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
KillDinos = nod.AddPrimaryObjective("Kill all creatures in the area.")
KillDinos = player.AddPrimaryObjective("Kill all creatures in the area.")
end
nod.MarkCompletedObjective(ReachVillageObj)
player.MarkCompletedObjective(ReachVillageObj)
end
end)
@@ -89,12 +89,12 @@ end
Tick = function()
if InitialUnitsArrived then
if nod.HasNoRequiredUnits() then
nod.MarkFailedObjective(InvestigateObj)
if player.HasNoRequiredUnits() then
player.MarkFailedObjective(InvestigateObj)
end
if dinosaur.HasNoRequiredUnits() then
if KillDinos then nod.MarkCompletedObjective(KillDinos) end
nod.MarkCompletedObjective(InvestigateObj)
if KillDinos then player.MarkCompletedObjective(KillDinos) end
player.MarkCompletedObjective(InvestigateObj)
end
end
end

View File

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

View File

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

View File

@@ -36,12 +36,12 @@ TownAttackAction = function(actor)
end
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()
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)
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
@@ -63,7 +63,7 @@ end
WorldLoaded = function()
player = Player.GetPlayer("GDI")
nod = Player.GetPlayer("Nod")
enemy = Player.GetPlayer("Nod")
Trigger.OnObjectiveAdded(player, function(p, id)
Media.DisplayMessage(p.GetObjectiveDescription(id), "New " .. string.lower(p.GetObjectiveType(id)) .. " objective")
@@ -87,7 +87,7 @@ WorldLoaded = function()
Media.PlaySpeechNotification(player, "Lose")
end)
nodObjective = nod.AddPrimaryObjective("Destroy all GDI troops.")
nodObjective = enemy.AddPrimaryObjective("Destroy all GDI troops.")
gdiObjective1 = player.AddPrimaryObjective("Defend the town of Białystok.")
gdiObjective2 = player.AddPrimaryObjective("Eliminate all Nod forces in the area.")
@@ -123,9 +123,9 @@ end
Tick = function()
if player.HasNoRequiredUnits() then
nod.MarkCompletedObjective(nodObjective)
enemy.MarkCompletedObjective(nodObjective)
end
if nod.HasNoRequiredUnits() then
if enemy.HasNoRequiredUnits() then
player.MarkCompletedObjective(gdiObjective1)
player.MarkCompletedObjective(gdiObjective2)
end

View File

@@ -56,7 +56,7 @@ AttackPaths =
}
Build = function(factory, units, action)
if factory.IsDead or factory.Owner ~= nod then
if factory.IsDead or factory.Owner ~= enemy then
return
end
@@ -72,7 +72,7 @@ Attack = function()
local path = Utils.Random(AttackPaths)
Build(types[1], types[2], function(units)
Utils.Do(units, function(unit)
if unit.Owner ~= nod then return end
if unit.Owner ~= enemy then return end
unit.Patrol(path, false)
Trigger.OnIdle(unit, unit.Hunt)
end)
@@ -84,7 +84,7 @@ end
Grd1Action = function()
Build(Airfield, Grd1UnitTypes, function(units)
Utils.Do(units, function(unit)
if unit.Owner ~= nod then return end
if unit.Owner ~= enemy then return end
Trigger.OnKilled(unit, function()
Trigger.AfterDelay(Grd1Delay[Map.Difficulty], Grd1Action)
end)
@@ -96,7 +96,7 @@ end
Grd2Action = function()
Build(Airfield, Grd2UnitTypes, function(units)
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))
end)
end)
@@ -121,19 +121,19 @@ Grd3Action = function()
end
DiscoverGdiBase = function(actor, discoverer)
if baseDiscovered or not discoverer == gdi then
if baseDiscovered or not discoverer == player then
return
end
Utils.Do(GdiBase, function(actor)
actor.Owner = gdi
actor.Owner = player
end)
GdiHarv.FindResources()
baseDiscovered = true
gdiObjective3 = gdi.AddPrimaryObjective("Eliminate all Nod forces in the area.")
gdi.MarkCompletedObjective(gdiObjective1)
gdiObjective3 = player.AddPrimaryObjective("Eliminate all Nod forces in the area.")
player.MarkCompletedObjective(gdiObjective1)
Attack()
end
@@ -143,17 +143,17 @@ SetupWorld = function()
unit.Destroy()
end)
Media.PlaySpeechNotification(gdi, "Reinforce")
Reinforcements.Reinforce(gdi, 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(gdi, GdiInfantry, { GdiInfantryEntry.Location, GdiInfantryRallyPoint.Location }, 15, function(actor) actor.Stance = "Defend" end)
Media.PlaySpeechNotification(player, "Reinforce")
Reinforcements.Reinforce(player, GdiTanks, { GdiTankEntry.Location, GdiTankRallyPoint.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(player, GdiInfantry, { GdiInfantryEntry.Location, GdiInfantryRallyPoint.Location }, 15, function(actor) actor.Stance = "Defend" end)
Trigger.OnPlayerDiscovered(gdiBase, DiscoverGdiBase)
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)
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()
end
end)
@@ -161,15 +161,15 @@ SetupWorld = function()
end)
Trigger.OnAllKilled(NodSams, function()
gdi.MarkCompletedObjective(gdiObjective2)
Actor.Create("airstrike.proxy", true, { Owner = gdi })
player.MarkCompletedObjective(gdiObjective2)
Actor.Create("airstrike.proxy", true, { Owner = player })
end)
GdiHarv.Stop()
NodHarv.FindResources()
if Map.Difficulty ~= "Easy" then
Trigger.OnDamaged(NodHarv, function()
Utils.Do(nod.GetGroundAttackers(), function(unit)
Utils.Do(enemy.GetGroundAttackers(), function(unit)
unit.AttackMove(NodHarv.Location)
if Map.Difficulty == "Hard" then
unit.Hunt()
@@ -185,30 +185,30 @@ end
WorldLoaded = function()
gdiBase = Player.GetPlayer("AbandonedBase")
gdi = Player.GetPlayer("GDI")
nod = Player.GetPlayer("Nod")
player = Player.GetPlayer("GDI")
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")
end)
Trigger.OnObjectiveCompleted(gdi, function(p, id)
Trigger.OnObjectiveCompleted(player, function(p, id)
Media.DisplayMessage(p.GetObjectiveDescription(id), "Objective completed")
end)
Trigger.OnObjectiveFailed(gdi, function(p, id)
Trigger.OnObjectiveFailed(player, function(p, id)
Media.DisplayMessage(p.GetObjectiveDescription(id), "Objective failed")
end)
Trigger.OnPlayerLost(gdi, function()
Trigger.OnPlayerLost(player, function()
Media.PlaySpeechNotification(player, "Lose")
end)
Trigger.OnPlayerWon(gdi, function()
Trigger.OnPlayerWon(player, function()
Media.PlaySpeechNotification(player, "Win")
end)
nodObjective = nod.AddPrimaryObjective("Destroy all GDI troops.")
gdiObjective1 = gdi.AddPrimaryObjective("Find the GDI base.")
gdiObjective2 = gdi.AddSecondaryObjective("Destroy all SAM sites to receive air support.")
nodObjective = enemy.AddPrimaryObjective("Destroy all GDI troops.")
gdiObjective1 = player.AddPrimaryObjective("Find the GDI base.")
gdiObjective2 = player.AddSecondaryObjective("Destroy all SAM sites to receive air support.")
SetupWorld()
@@ -216,12 +216,12 @@ WorldLoaded = function()
end
Tick = function()
if gdi.HasNoRequiredUnits() then
if player.HasNoRequiredUnits() then
if DateTime.GameTime > 2 then
nod.MarkCompletedObjective(nodObjective)
enemy.MarkCompletedObjective(nodObjective)
end
end
if baseDiscovered and nod.HasNoRequiredUnits() then
gdi.MarkCompletedObjective(gdiObjective3)
if baseDiscovered and enemy.HasNoRequiredUnits() then
player.MarkCompletedObjective(gdiObjective3)
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 }
AllToHunt = function()
local list = nod.GetGroundAttackers()
local list = enemy.GetGroundAttackers()
Utils.Do(list, function(unit)
unit.Hunt()
end)
@@ -56,60 +56,60 @@ end
AutoCreateTeam = function()
local team = Utils.Random(AutoCreateTeams)
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
Trigger.AfterDelay(Utils.RandomInteger(AutoAtkMinDelay, AutoAtkMaxDelay), AutoCreateTeam)
end
DiscoverGdiBase = function(actor, discoverer)
if baseDiscovered or not discoverer == gdi then
if baseDiscovered or not discoverer == player then
return
end
Utils.Do(GdiBase, function(actor)
actor.Owner = gdi
actor.Owner = player
end)
GdiHarv.FindResources()
baseDiscovered = true
gdiObjective3 = gdi.AddPrimaryObjective("Eliminate all Nod forces in the area.")
gdi.MarkCompletedObjective(gdiObjective1)
gdiObjective3 = player.AddPrimaryObjective("Eliminate all Nod forces in the area.")
player.MarkCompletedObjective(gdiObjective1)
end
Atk1TriggerFunction = function()
MoveThenHunt(Utils.Take(2, nod.GetActorsByType('e1')), AtkRoute1)
MoveThenHunt(Utils.Take(3, nod.GetActorsByType('e3')), AtkRoute1)
MoveThenHunt(Utils.Take(2, enemy.GetActorsByType('e1')), AtkRoute1)
MoveThenHunt(Utils.Take(3, enemy.GetActorsByType('e3')), AtkRoute1)
end
Atk2TriggerFunction = function()
MoveThenHunt(Utils.Take(3, nod.GetActorsByType('e1')), AtkRoute2)
MoveThenHunt(Utils.Take(3, nod.GetActorsByType('e3')), AtkRoute2)
MoveThenHunt(Utils.Take(3, enemy.GetActorsByType('e1')), AtkRoute2)
MoveThenHunt(Utils.Take(3, enemy.GetActorsByType('e3')), AtkRoute2)
end
Atk3TriggerFunction = function()
MoveThenHunt(Utils.Take(1, nod.GetActorsByType('bggy')), AtkRoute1)
MoveThenHunt(Utils.Take(1, enemy.GetActorsByType('bggy')), AtkRoute1)
end
Atk4TriggerFunction = function()
MoveThenHunt(Utils.Take(1, nod.GetActorsByType('bggy')), AtkRoute2)
MoveThenHunt(Utils.Take(1, enemy.GetActorsByType('bggy')), AtkRoute2)
end
Atk5TriggerFunction = function()
MoveThenHunt(Utils.Take(1, nod.GetActorsByType('ltnk')), AtkRoute2)
MoveThenHunt(Utils.Take(1, enemy.GetActorsByType('ltnk')), AtkRoute2)
end
StartProduction = function(type)
if Hand1.IsInWorld and Hand1.Owner == nod then
if Hand1.IsInWorld and Hand1.Owner == enemy then
Hand1.Build(type)
Trigger.AfterDelay(DateTime.Seconds(30), function() StartProduction(type) end)
end
end
InsertGdiUnits = function()
Media.PlaySpeechNotification(gdi, "Reinforce")
Reinforcements.Reinforce(gdi, GdiUnits, { UnitsEntry.Location, UnitsRally.Location }, 15)
Media.PlaySpeechNotification(player, "Reinforce")
Reinforcements.Reinforce(player, GdiUnits, { UnitsEntry.Location, UnitsRally.Location }, 15)
end
IdleHunt = function(unit)
@@ -119,48 +119,48 @@ IdleHunt = function(unit)
end
WorldLoaded = function()
gdi = Player.GetPlayer("GDI")
player = Player.GetPlayer("GDI")
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")
end)
Trigger.OnObjectiveCompleted(gdi, function(p, id)
Trigger.OnObjectiveCompleted(player, function(p, id)
Media.DisplayMessage(p.GetObjectiveDescription(id), "Objective completed")
end)
Trigger.OnObjectiveFailed(gdi, function(p, id)
Trigger.OnObjectiveFailed(player, function(p, id)
Media.DisplayMessage(p.GetObjectiveDescription(id), "Objective failed")
end)
Trigger.OnPlayerWon(gdi, function()
Media.PlaySpeechNotification(gdi, "Win")
Trigger.OnPlayerWon(player, function()
Media.PlaySpeechNotification(player, "Win")
end)
Trigger.OnPlayerLost(gdi, function()
Media.PlaySpeechNotification(gdi, "Lose")
Trigger.OnPlayerLost(player, function()
Media.PlaySpeechNotification(player, "Lose")
end)
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)
if building.Owner == nod and building.Health < RepairThreshold * building.MaxHealth then
if building.Owner == enemy and building.Health < RepairThreshold * building.MaxHealth then
building.StartBuildingRepairs()
end
end)
end
end)
gdiObjective1 = gdi.AddPrimaryObjective("Find the GDI base.")
gdiObjective2 = gdi.AddSecondaryObjective("Destroy all SAM sites to receive air support.")
nodObjective = nod.AddPrimaryObjective("Destroy all GDI troops.")
gdiObjective1 = player.AddPrimaryObjective("Find the GDI base.")
gdiObjective2 = player.AddSecondaryObjective("Destroy all SAM sites to receive air support.")
nodObjective = enemy.AddPrimaryObjective("Destroy all GDI troops.")
Trigger.AfterDelay(Atk1Delay, Atk1TriggerFunction)
Trigger.AfterDelay(Atk2Delay, Atk2TriggerFunction)
Trigger.AfterDelay(Atk3Delay, Atk3TriggerFunction)
Trigger.AfterDelay(Atk4Delay, Atk4TriggerFunction)
Trigger.OnEnteredFootprint(Atk5CellTriggers, function(a, id)
if a.Owner == gdi then
if a.Owner == player then
Atk5TriggerFunction()
Trigger.RemoveFootprintTrigger(id)
end
@@ -174,8 +174,8 @@ WorldLoaded = function()
Trigger.OnPlayerDiscovered(gdiBase, DiscoverGdiBase)
Trigger.OnAllKilled(NodSams, function()
gdi.MarkCompletedObjective(gdiObjective2)
Actor.Create("airstrike.proxy", true, { Owner = gdi })
player.MarkCompletedObjective(gdiObjective2)
Actor.Create("airstrike.proxy", true, { Owner = player })
end)
Camera.Position = UnitsRally.CenterPosition
@@ -184,12 +184,12 @@ WorldLoaded = function()
end
Tick = function()
if gdi.HasNoRequiredUnits() then
if player.HasNoRequiredUnits() then
if DateTime.GameTime > 2 then
nod.MarkCompletedObjective(nodObjective)
enemy.MarkCompletedObjective(nodObjective)
end
end
if baseDiscovered and nod.HasNoRequiredUnits() then
gdi.MarkCompletedObjective(gdiObjective3)
if baseDiscovered and enemy.HasNoRequiredUnits() then
player.MarkCompletedObjective(gdiObjective3)
end
end

View File

@@ -5,26 +5,26 @@ RifleInfantryReinforcements = { "e1", "e1" }
RocketInfantryReinforcements = { "e3", "e3", "e3", "e3", "e3" }
SendInitialForces = function()
Media.PlaySpeechNotification(nod, "Reinforce")
Reinforcements.Reinforce(nod, InitialForcesA, { StartSpawnPointLeft.Location, StartRallyPoint.Location }, 5)
Reinforcements.Reinforce(nod, InitialForcesB, { StartSpawnPointRight.Location, StartRallyPoint.Location }, 10)
Media.PlaySpeechNotification(player, "Reinforce")
Reinforcements.Reinforce(player, InitialForcesA, { StartSpawnPointLeft.Location, StartRallyPoint.Location }, 5)
Reinforcements.Reinforce(player, InitialForcesB, { StartSpawnPointRight.Location, StartRallyPoint.Location }, 10)
end
SendFirstInfantryReinforcements = function()
Media.PlaySpeechNotification(nod, "Reinforce")
Reinforcements.Reinforce(nod, RifleInfantryReinforcements, { StartSpawnPointRight.Location, StartRallyPoint.Location }, 15)
Media.PlaySpeechNotification(player, "Reinforce")
Reinforcements.Reinforce(player, RifleInfantryReinforcements, { StartSpawnPointRight.Location, StartRallyPoint.Location }, 15)
end
SendSecondInfantryReinforcements = function()
Media.PlaySpeechNotification(nod, "Reinforce")
Reinforcements.Reinforce(nod, RifleInfantryReinforcements, { StartSpawnPointLeft.Location, StartRallyPoint.Location }, 15)
Media.PlaySpeechNotification(player, "Reinforce")
Reinforcements.Reinforce(player, RifleInfantryReinforcements, { StartSpawnPointLeft.Location, StartRallyPoint.Location }, 15)
end
SendLastInfantryReinforcements = function()
Media.PlaySpeechNotification(nod, "Reinforce")
Media.PlaySpeechNotification(player, "Reinforce")
-- 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)
a.Stance = "Defend"
a.CallFunc(function() a.Stance = "AttackAnything" end)
@@ -32,35 +32,35 @@ SendLastInfantryReinforcements = function()
end
WorldLoaded = function()
nod = Player.GetPlayer("Nod")
gdi = Player.GetPlayer("GDI")
player = Player.GetPlayer("Nod")
enemy = Player.GetPlayer("GDI")
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")
end)
Trigger.OnObjectiveCompleted(nod, function(p, id)
Trigger.OnObjectiveCompleted(player, function(p, id)
Media.DisplayMessage(p.GetObjectiveDescription(id), "Objective completed")
end)
Trigger.OnObjectiveFailed(nod, function(p, id)
Trigger.OnObjectiveFailed(player, function(p, id)
Media.DisplayMessage(p.GetObjectiveDescription(id), "Objective failed")
end)
Trigger.OnPlayerWon(nod, function()
Media.PlaySpeechNotification(nod, "Win")
Trigger.OnPlayerWon(player, function()
Media.PlaySpeechNotification(player, "Win")
end)
Trigger.OnPlayerLost(nod, function()
Media.PlaySpeechNotification(nod, "Lose")
Trigger.OnPlayerLost(player, function()
Media.PlaySpeechNotification(player, "Lose")
end)
NodObjective1 = nod.AddPrimaryObjective("Kill Nikoomba.")
NodObjective2 = nod.AddPrimaryObjective("Destroy the village.")
NodObjective3 = nod.AddSecondaryObjective("Destroy all GDI troops in the area.")
GDIObjective1 = gdi.AddPrimaryObjective("Eliminate all Nod forces.")
NodObjective1 = player.AddPrimaryObjective("Kill Nikoomba.")
NodObjective2 = player.AddPrimaryObjective("Destroy the village.")
NodObjective3 = player.AddSecondaryObjective("Destroy all GDI troops in the area.")
GDIObjective1 = enemy.AddPrimaryObjective("Eliminate all Nod forces.")
Trigger.OnKilled(Nikoomba, function()
nod.MarkCompletedObjective(NodObjective1)
player.MarkCompletedObjective(NodObjective1)
Trigger.AfterDelay(DateTime.Seconds(1), function()
SendLastInfantryReinforcements()
end)
@@ -75,14 +75,14 @@ end
Tick = function()
if DateTime.GameTime > 2 then
if nod.HasNoRequiredUnits() then
gdi.MarkCompletedObjective(GDIObjective1)
if player.HasNoRequiredUnits() then
enemy.MarkCompletedObjective(GDIObjective1)
end
if villagers.HasNoRequiredUnits() then
nod.MarkCompletedObjective(NodObjective2)
player.MarkCompletedObjective(NodObjective2)
end
if gdi.HasNoRequiredUnits() then
nod.MarkCompletedObjective(NodObjective3)
if enemy.HasNoRequiredUnits() then
player.MarkCompletedObjective(NodObjective3)
end
end
end

View File

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

View File

@@ -19,7 +19,7 @@ GDIStartUnits = 0
Grd2TriggerFunction = function()
if not Grd2TriggerSwitch then
Grd2TriggerSwitch = true
MyActors = getActors(GDI, { ['e1'] = 5 })
MyActors = getActors(enemy, { ['e1'] = 5 })
Utils.Do(MyActors, function(actor)
Gdi5Movement(actor)
end)
@@ -27,35 +27,35 @@ Grd2TriggerFunction = function()
end
Atk8TriggerFunction = function()
MyActors = getActors(GDI, { ['e1'] = 2 })
MyActors = getActors(enemy, { ['e1'] = 2 })
Utils.Do(MyActors, function(actor)
Gdi1Movement(actor)
end)
end
Atk7TriggerFunction = function()
MyActors = getActors(GDI, { ['e1'] = 3 })
MyActors = getActors(enemy, { ['e1'] = 3 })
Utils.Do(MyActors, function(actor)
Gdi3Movement(actor)
end)
end
Atk4TriggerFunction = function()
MyActors = getActors(GDI, { ['e1'] = 3 })
MyActors = getActors(enemy, { ['e1'] = 3 })
Utils.Do(MyActors, function(actor)
Gdi3Movement(actor)
end)
end
Atk3TriggerFunction = function()
MyActors = getActors(GDI, { ['e1'] = 2 })
MyActors = getActors(enemy, { ['e1'] = 2 })
Utils.Do(MyActors, function(actor)
Gdi1Movement(actor)
end)
end
Atk6TriggerFunction = function()
MyActors = getActors(GDI, { ['e1'] = 2 })
MyActors = getActors(enemy, { ['e1'] = 2 })
Utils.Do(MyActors, function(actor)
Gdi1Movement(actor)
end)
@@ -64,7 +64,7 @@ end
Atk5TriggerFunction = function()
if not Atk5TriggerSwitch then
Atk5TriggerSwitch = true
MyActors = getActors(GDI, { ['e1'] = 3 })
MyActors = getActors(enemy, { ['e1'] = 3 })
Utils.Do(MyActors, function(actor)
Gdi3Movement(actor)
end)
@@ -72,7 +72,7 @@ Atk5TriggerFunction = function()
end
HuntTriggerFunction = function()
local list = GDI.GetGroundAttackers()
local list = enemy.GetGroundAttackers()
Utils.Do(list, function(unit)
IdleHunt(unit)
end)
@@ -97,32 +97,32 @@ Gdi3Movement = function(unit)
end
WorldLoaded = function()
GDI = Player.GetPlayer("GDI")
Nod = Player.GetPlayer("Nod")
player = 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")
end)
Trigger.OnObjectiveCompleted(Nod, function(p, id)
Trigger.OnObjectiveCompleted(player, function(p, id)
Media.DisplayMessage(p.GetObjectiveDescription(id), "Objective completed")
end)
Trigger.OnObjectiveFailed(Nod, function(p, id)
Trigger.OnObjectiveFailed(player, function(p, id)
Media.DisplayMessage(p.GetObjectiveDescription(id), "Objective failed")
end)
Trigger.OnPlayerWon(Nod, function()
Media.PlaySpeechNotification(Nod, "Win")
Trigger.OnPlayerWon(player, function()
Media.PlaySpeechNotification(player, "Win")
end)
Trigger.OnPlayerLost(Nod, function()
Media.PlaySpeechNotification(Nod, "Lose")
Trigger.OnPlayerLost(player, function()
Media.PlaySpeechNotification(player, "Lose")
end)
GDIObjective = GDI.AddPrimaryObjective("Kill all enemies.")
NodObjective1 = Nod.AddPrimaryObjective("Build a base.")
NodObjective2 = Nod.AddPrimaryObjective("Destroy all GDI units.")
GDIObjective = enemy.AddPrimaryObjective("Kill all enemies.")
NodObjective1 = player.AddPrimaryObjective("Build a base.")
NodObjective2 = player.AddPrimaryObjective("Destroy all GDI units.")
OnAnyDamaged(Grd2ActorTriggerActivator, Grd2TriggerFunction)
Trigger.AfterDelay(Atk8TriggerFunctionTime, Atk8TriggerFunction)
@@ -139,22 +139,22 @@ WorldLoaded = function()
end
Tick = function()
if Nod.HasNoRequiredUnits() then
if player.HasNoRequiredUnits() then
if DateTime.GameTime > 2 then
GDI.MarkCompletedObjective(GDIObjective)
enemy.MarkCompletedObjective(GDIObjective)
end
end
if GDI.HasNoRequiredUnits() then
Nod.MarkCompletedObjective(NodObjective2)
if enemy.HasNoRequiredUnits() then
player.MarkCompletedObjective(NodObjective2)
end
if DateTime.GameTime % DateTime.Seconds(1) == 0 and not Nod.IsObjectiveCompleted(NodObjective1) and CheckForBase(Nod) then
Nod.MarkCompletedObjective(NodObjective1)
if DateTime.GameTime % DateTime.Seconds(1) == 0 and not player.IsObjectiveCompleted(NodObjective1) and CheckForBase(player) then
player.MarkCompletedObjective(NodObjective1)
end
if DateTime.GameTime % DateTime.Seconds(3) == 0 and Barracks.IsInWorld and Barracks.Owner == gdi then
checkProduction(GDI)
if DateTime.GameTime % DateTime.Seconds(3) == 0 and Barracks.IsInWorld and Barracks.Owner == enemy then
checkProduction(enemy)
end
end
@@ -214,7 +214,7 @@ end
getStartUnits = function()
local Units = Map.ActorsInBox(Map.TopLeft, Map.BottomRight, function(actor)
return actor.Owner == GDI
return actor.Owner == enemy
end)
Utils.Do(Units, function(unit)
if unit.Type == UnitToRebuild then
@@ -224,9 +224,9 @@ getStartUnits = function()
end
InsertNodUnits = function()
Media.PlaySpeechNotification(Nod, "Reinforce")
Reinforcements.Reinforce(Nod, NodUnits, { UnitsEntry.Location, UnitsRally.Location }, 15)
Reinforcements.Reinforce(Nod, { "mcv" }, { McvEntry.Location, McvRally.Location })
Media.PlaySpeechNotification(player, "Reinforce")
Reinforcements.Reinforce(player, NodUnits, { UnitsEntry.Location, UnitsRally.Location }, 15)
Reinforcements.Reinforce(player, { "mcv" }, { McvEntry.Location, McvRally.Location })
end
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 }
Atk6TriggerFunction = function()
Reinforcements.ReinforceWithTransport(GDI, 'apc', Atk6Units, Atk6WaypointsPart1, Atk6WaypointsPart2,
Reinforcements.ReinforceWithTransport(enemy, 'apc', Atk6Units, Atk6WaypointsPart1, Atk6WaypointsPart2,
function(transport, cargo)
Utils.Do(cargo, function(actor)
IdleHunt(actor)
@@ -57,7 +57,7 @@ end
Atk5TriggerFunction = function ()
if not Atk5TriggerSwitch then
Atk5TriggerSwitch = true
Reinforcements.ReinforceWithTransport(GDI, 'apc', Atk5Units, Atk5Waypoints, nil,
Reinforcements.ReinforceWithTransport(enemy, 'apc', Atk5Units, Atk5Waypoints, nil,
function(transport, cargo)
transport.UnloadPassengers()
Utils.Do(cargo, function(actor)
@@ -71,7 +71,7 @@ Atk5TriggerFunction = function ()
end
Atk1TriggerFunction = function()
Reinforcements.Reinforce(GDI, Atk1Units, Spawnpoint, 15,
Reinforcements.Reinforce(enemy, Atk1Units, Spawnpoint, 15,
function(actor)
Atk1Movement(actor)
end)
@@ -79,7 +79,7 @@ end
XxxxTriggerFunction = function()
if not XxxxTriggerSwitch then
Reinforcements.Reinforce(GDI, XxxxUnits, Spawnpoint, 15,
Reinforcements.Reinforce(enemy, XxxxUnits, Spawnpoint, 15,
function(actor)
Atk2Movement(actor)
end)
@@ -88,7 +88,7 @@ end
YyyyTriggerFunction = function()
if not YyyyTriggerSwitch then
Reinforcements.Reinforce(GDI, YyyyUnits, Spawnpoint, 15,
Reinforcements.Reinforce(enemy, YyyyUnits, Spawnpoint, 15,
function(actor)
Atk4Movement(actor)
end)
@@ -97,7 +97,7 @@ end
ZzzzTriggerFunction = function()
if not ZzzzTriggerSwitch then
Reinforcements.ReinforceWithTransport(GDI, 'apc', ZzzzUnits, Atk5Waypoints, nil,
Reinforcements.ReinforceWithTransport(enemy, 'apc', ZzzzUnits, Atk5Waypoints, nil,
function(transport, cargo)
transport.UnloadPassengers()
Utils.Do(cargo, function(actor)
@@ -145,21 +145,21 @@ Atk4Movement = function(unit)
end
InsertNodUnits = function()
Media.PlaySpeechNotification(Nod, "Reinforce")
Reinforcements.Reinforce(Nod, NodUnitsBuggy, { UnitsEntryBuggy.Location, UnitsRallyBuggy.Location }, 11)
Reinforcements.Reinforce(Nod, NodUnitsBikes, { UnitsEntryBikes.Location, UnitsRallyBikes.Location }, 15)
Reinforcements.Reinforce(Nod, NodUnitsGunner, { UnitsEntryGunner.Location, UnitsRallyGunner.Location }, 15)
Reinforcements.Reinforce(Nod, NodUnitsRocket, { UnitsEntryRocket.Location, UnitsRallyRocket.Location }, 15)
Media.PlaySpeechNotification(player, "Reinforce")
Reinforcements.Reinforce(player, NodUnitsBuggy, { UnitsEntryBuggy.Location, UnitsRallyBuggy.Location }, 11)
Reinforcements.Reinforce(player, NodUnitsBikes, { UnitsEntryBikes.Location, UnitsRallyBikes.Location }, 15)
Reinforcements.Reinforce(player, NodUnitsGunner, { UnitsEntryGunner.Location, UnitsRallyGunner.Location }, 15)
Reinforcements.Reinforce(player, NodUnitsRocket, { UnitsEntryRocket.Location, UnitsRallyRocket.Location }, 15)
end
CreateCivilians = function(actor, discoverer)
Utils.Do(NodCiviliansActors, function(actor)
actor.Owner = Nod
actor.Owner = player
end)
NodObjective2 = Nod.AddPrimaryObjective("Protect the civilians that support Nod.")
NodObjective2 = player.AddPrimaryObjective("Protect the civilians that support Nod.")
Trigger.OnAllKilled(NodCiviliansActors, function()
Nod.MarkFailedObjective(NodObjective2)
player.MarkFailedObjective(NodObjective2)
end)
Utils.Do(GcivActors, function(actor)
@@ -172,26 +172,26 @@ CreateCivilians = function(actor, discoverer)
end
WorldLoaded = function()
player = Player.GetPlayer("Nod")
NodSupporter = Player.GetPlayer("NodSupporter")
Nod = Player.GetPlayer("Nod")
GDI = Player.GetPlayer("GDI")
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")
end)
Trigger.OnObjectiveCompleted(Nod, function(p, id)
Trigger.OnObjectiveCompleted(player, function(p, id)
Media.DisplayMessage(p.GetObjectiveDescription(id), "Objective completed")
end)
Trigger.OnObjectiveFailed(Nod, function(p, id)
Trigger.OnObjectiveFailed(player, function(p, id)
Media.DisplayMessage(p.GetObjectiveDescription(id), "Objective failed")
end)
Trigger.OnPlayerWon(Nod, function()
Media.PlaySpeechNotification(Nod, "Win")
Trigger.OnPlayerWon(player, function()
Media.PlaySpeechNotification(player, "Win")
end)
Trigger.OnPlayerLost(Nod, function()
Media.PlaySpeechNotification(Nod, "Lose")
Trigger.OnPlayerLost(player, function()
Media.PlaySpeechNotification(player, "Lose")
end)
Trigger.OnAnyKilled(Atk6ActorTriggerActivator, Atk6TriggerFunction)
@@ -199,9 +199,9 @@ WorldLoaded = function()
OnAnyDamaged(Atk5ActorTriggerActivator, Atk5TriggerFunction)
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
local myActors = Utils.Take(count, GDI.GetActorsByType(type))
local myActors = Utils.Take(count, enemy.GetActorsByType(type))
Utils.Do(myActors, function(actor)
Atk3Movement(actor)
end)
@@ -215,8 +215,8 @@ WorldLoaded = function()
end)
Trigger.OnEnteredFootprint(Atk2CellTriggerActivator, function(a, id)
if a.Owner == Nod then
MyActors = Utils.Take(1, GDI.GetActorsByType('jeep'))
if a.Owner == player then
MyActors = Utils.Take(1, enemy.GetActorsByType('jeep'))
Utils.Do(MyActors, function(actor)
Atk2Movement(actor)
end)
@@ -225,7 +225,7 @@ WorldLoaded = function()
end)
Trigger.OnEnteredFootprint(GcivCellTriggerActivator, function(a, id)
if a.Owner == Nod then
if a.Owner == player then
Utils.Do(GcivActors, function(actor)
GcivMovement(actor)
end)
@@ -236,9 +236,9 @@ WorldLoaded = function()
Trigger.AfterDelay(Atk1TriggerFunctionTime, Atk1TriggerFunction)
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
local myActors = Utils.Take(count, GDI.GetActorsByType(type))
local myActors = Utils.Take(count, enemy.GetActorsByType(type))
Utils.Do(myActors, function(actor)
Atk4Movement(actor)
end)
@@ -252,21 +252,21 @@ WorldLoaded = function()
Trigger.AfterDelay(ZzzzTriggerFunctionTime, ZzzzTriggerFunction)
Trigger.OnEnteredFootprint(DelxCellTriggerActivator, function(a, id)
if a.Owner == Nod then
if a.Owner == player then
XxxxTriggerSwitch = true
Trigger.RemoveFootprintTrigger(id)
end
end)
Trigger.OnEnteredFootprint(DelyCellTriggerActivator, function(a, id)
if a.Owner == Nod then
if a.Owner == player then
YyyyTriggerSwitch = true
Trigger.RemoveFootprintTrigger(id)
end
end)
Trigger.OnEnteredFootprint(DelzCellTriggerActivator, function(a, id)
if a.Owner == Nod then
if a.Owner == player then
ZzzzTriggerSwitch = true
Trigger.RemoveFootprintTrigger(id)
end
@@ -275,23 +275,23 @@ WorldLoaded = function()
Trigger.OnPlayerDiscovered(NodSupporter, CreateCivilians)
Trigger.OnAllKilled(WinActorTriggerActivator, function()
Nod.MarkCompletedObjective(NodObjective1)
player.MarkCompletedObjective(NodObjective1)
if NodObjective2 then
Nod.MarkCompletedObjective(NodObjective2)
player.MarkCompletedObjective(NodObjective2)
end
end)
GDIObjective = GDI.AddPrimaryObjective("Eliminate all Nod forces in the area.")
NodObjective1 = Nod.AddPrimaryObjective("Kill all civilian GDI supporters.")
GDIObjective = enemy.AddPrimaryObjective("Eliminate all Nod forces in the area.")
NodObjective1 = player.AddPrimaryObjective("Kill all civilian GDI supporters.")
InsertNodUnits()
Camera.Position = waypoint6.CenterPosition
end
Tick = function()
if Nod.HasNoRequiredUnits() then
if player.HasNoRequiredUnits() then
if DateTime.GameTime > 2 then
GDI.MarkCompletedObjective(GDIObjective)
enemy.MarkCompletedObjective(GDIObjective)
end
end
end

View File

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

View File

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

View File

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

View File

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

View File

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