Resolve Lua language server diagnosed problems.

This commit is contained in:
Matthias Mailänder
2023-03-01 10:40:46 +01:00
committed by abcdefg30
parent 3d0efa1cbe
commit 378f66a1ff
122 changed files with 3006 additions and 3012 deletions

View File

@@ -95,7 +95,7 @@ Tick = function()
end end
SetupWorld = function() SetupWorld = function()
Utils.Do(Nod.GetGroundAttackers(Nod), function(unit) Utils.Do(Nod.GetGroundAttackers(), function(unit)
Trigger.OnKilled(unit, NodUnitKilled) Trigger.OnKilled(unit, NodUnitKilled)
end) end)

View File

@@ -103,7 +103,7 @@ AttackPlayer = function()
Utils.Do(NodBase, function(actor) Utils.Do(NodBase, function(actor)
Trigger.OnRemovedFromWorld(actor, function() Trigger.OnRemovedFromWorld(actor, function()
Utils.Do(Nod.GetGroundAttackers(Nod), IdleHunt) Utils.Do(Nod.GetGroundAttackers(), IdleHunt)
end) end)
end) end)

View File

@@ -32,7 +32,7 @@ WorldLoaded = function()
InitObjectives(Nod) InitObjectives(Nod)
GDIObjective = AddPrimaryObjective(GDI, "") GDIObjective = AddPrimaryObjective(GDI, "")
BuildBase = AddPrimaryObjective(Nod, "build-base") BuildBaseObjective = AddPrimaryObjective(Nod, "build-base")
DestroyGDI = AddPrimaryObjective(Nod, "destroy-gdi-units") DestroyGDI = AddPrimaryObjective(Nod, "destroy-gdi-units")
Utils.Do({ Refinery, Yard }, function(actor) Utils.Do({ Refinery, Yard }, function(actor)
@@ -97,7 +97,7 @@ Tick = function()
Nod.MarkCompletedObjective(DestroyGDI) Nod.MarkCompletedObjective(DestroyGDI)
end end
if DateTime.GameTime % DateTime.Seconds(1) == 0 and not Nod.IsObjectiveCompleted(BuildBase) and CheckForBase(Nod, NodBaseBuildings) then if DateTime.GameTime % DateTime.Seconds(1) == 0 and not Nod.IsObjectiveCompleted(BuildBaseObjective) and CheckForBase(Nod, NodBaseBuildings) then
Nod.MarkCompletedObjective(BuildBase) Nod.MarkCompletedObjective(BuildBaseObjective)
end end
end end

View File

@@ -38,7 +38,7 @@ WorldLoaded = function()
InitObjectives(Nod) InitObjectives(Nod)
BuildBase = AddPrimaryObjective(Nod, "build-base") BuildBaseObjective = AddPrimaryObjective(Nod, "build-base")
DestroyGDI = AddPrimaryObjective(Nod, "destroy-gdi-base") DestroyGDI = AddPrimaryObjective(Nod, "destroy-gdi-base")
GDIObjective = AddPrimaryObjective(GDI, "") GDIObjective = AddPrimaryObjective(GDI, "")
@@ -111,7 +111,7 @@ Tick = function()
GDI.MarkCompletedObjective(GDIObjective) GDI.MarkCompletedObjective(GDIObjective)
end end
if DateTime.GameTime % DateTime.Seconds(1) == 0 and not Nod.IsObjectiveCompleted(BuildBase) and CheckForBase(Nod, NodBaseBuildings) then if DateTime.GameTime % DateTime.Seconds(1) == 0 and not Nod.IsObjectiveCompleted(BuildBaseObjective) and CheckForBase(Nod, NodBaseBuildings) then
Nod.MarkCompletedObjective(BuildBase) Nod.MarkCompletedObjective(BuildBaseObjective)
end end
end end

View File

@@ -68,7 +68,7 @@ SendApcReinforcements = function()
end end
end end
CreateCivilians = function(actor, discoverer) CreateCivilians = function()
Utils.Do(NodCiviliansActors, function(actor) Utils.Do(NodCiviliansActors, function(actor)
actor.Owner = Nod actor.Owner = Nod
end) end)
@@ -96,7 +96,7 @@ WorldLoaded = function()
Trigger.OnAnyKilled(Atk6ActorTriggerActivator, function() Trigger.OnAnyKilled(Atk6ActorTriggerActivator, function()
Reinforcements.ReinforceWithTransport(GDI, "apc", Atk6Units, Atk6WaypointsPart1, Atk6WaypointsPart2, Reinforcements.ReinforceWithTransport(GDI, "apc", Atk6Units, Atk6WaypointsPart1, Atk6WaypointsPart2,
function(transport, cargo) function(_, cargo)
Utils.Do(cargo, IdleHunt) Utils.Do(cargo, IdleHunt)
end, IdleHunt) end, IdleHunt)
end) end)

View File

@@ -47,7 +47,7 @@ SamSiteGoal = 3
CaptureStructures = function(actor) CaptureStructures = function(actor)
for i = 1, #WhitelistedStructures do for i = 1, #WhitelistedStructures do
structures = Nod.GetActorsByType(WhitelistedStructures[i]) local structures = Nod.GetActorsByType(WhitelistedStructures[i])
if #structures > 0 and not actor.IsDead and not structures[1].IsDead then if #structures > 0 and not actor.IsDead and not structures[1].IsDead then
actor.Capture(structures[1]) actor.Capture(structures[1])
return return

View File

@@ -61,16 +61,16 @@ Messages =
CachedResources = -1 CachedResources = -1
Tick = function() Tick = function()
if HarkonnenArrived and harkonnen.HasNoRequiredUnits() then if HarkonnenArrived and Harkonnen.HasNoRequiredUnits() then
player.MarkCompletedObjective(KillHarkonnen) Atreides.MarkCompletedObjective(KillHarkonnen)
end end
if player.Resources > SpiceToHarvest - 1 then if Atreides.Resources > SpiceToHarvest - 1 then
player.MarkCompletedObjective(GatherSpice) Atreides.MarkCompletedObjective(GatherSpice)
end end
-- player has no Wind Trap -- player has no Wind Trap
if (player.PowerProvided <= 20 or player.PowerState ~= "Normal") and DateTime.GameTime % DateTime.Seconds(32) == 0 then if (Atreides.PowerProvided <= 20 or Atreides.PowerState ~= "Normal") and DateTime.GameTime % DateTime.Seconds(32) == 0 then
HasPower = false HasPower = false
Media.DisplayMessage(Messages[2], Mentat) Media.DisplayMessage(Messages[2], Mentat)
else else
@@ -78,40 +78,40 @@ Tick = function()
end end
-- player has no Refinery and no Silos -- player has no Refinery and no Silos
if HasPower and player.ResourceCapacity == 0 and DateTime.GameTime % DateTime.Seconds(32) == 0 then if HasPower and Atreides.ResourceCapacity == 0 and DateTime.GameTime % DateTime.Seconds(32) == 0 then
Media.DisplayMessage(Messages[3], Mentat) Media.DisplayMessage(Messages[3], Mentat)
end end
if HasPower and player.Resources > player.ResourceCapacity * 0.8 and DateTime.GameTime % DateTime.Seconds(32) == 0 then if HasPower and Atreides.Resources > Atreides.ResourceCapacity * 0.8 and DateTime.GameTime % DateTime.Seconds(32) == 0 then
Media.DisplayMessage(Messages[4], Mentat) Media.DisplayMessage(Messages[4], Mentat)
end end
if player.Resources ~= CachedResources then if Atreides.Resources ~= CachedResources then
local parameters = { ["harvested"] = player.Resources, ["goal"] = SpiceToHarvest } local parameters = { ["harvested"] = Atreides.Resources, ["goal"] = SpiceToHarvest }
local harvestedResources = UserInterface.Translate("harvested-resources", parameters) local harvestedResources = UserInterface.Translate("harvested-resources", parameters)
UserInterface.SetMissionText(harvestedResources) UserInterface.SetMissionText(harvestedResources)
CachedResources = player.Resources CachedResources = Atreides.Resources
end end
end end
WorldLoaded = function() WorldLoaded = function()
player = Player.GetPlayer("Atreides") Atreides = Player.GetPlayer("Atreides")
harkonnen = Player.GetPlayer("Harkonnen") Harkonnen = Player.GetPlayer("Harkonnen")
SpiceToHarvest = ToHarvest[Difficulty] SpiceToHarvest = ToHarvest[Difficulty]
InitObjectives(player) InitObjectives(Atreides)
KillAtreides = AddPrimaryObjective(harkonnen, "") KillAtreides = AddPrimaryObjective(Harkonnen, "")
local harvestSpice = UserInterface.Translate("harvest-spice", { ["spice"] = SpiceToHarvest }) local harvestSpice = UserInterface.Translate("harvest-spice", { ["spice"] = SpiceToHarvest })
GatherSpice = AddPrimaryObjective(player, harvestSpice) GatherSpice = AddPrimaryObjective(Atreides, harvestSpice)
KillHarkonnen = AddSecondaryObjective(player, "eliminate-harkonnen-units-reinforcements") KillHarkonnen = AddSecondaryObjective(Atreides, "eliminate-harkonnen-units-reinforcements")
local checkResourceCapacity = function() local checkResourceCapacity = function()
Trigger.AfterDelay(0, function() Trigger.AfterDelay(0, function()
if player.ResourceCapacity < SpiceToHarvest then if Atreides.ResourceCapacity < SpiceToHarvest then
Media.DisplayMessage(UserInterface.Translate("not-enough-silos"), Mentat) Media.DisplayMessage(UserInterface.Translate("not-enough-silos"), Mentat)
Trigger.AfterDelay(DateTime.Seconds(3), function() Trigger.AfterDelay(DateTime.Seconds(3), function()
harkonnen.MarkCompletedObjective(KillAtreides) Harkonnen.MarkCompletedObjective(KillAtreides)
end) end)
return true return true
@@ -126,15 +126,15 @@ WorldLoaded = function()
return return
end end
local refs = Utils.Where(Map.ActorsInWorld, function(actor) return actor.Type == "refinery" and actor.Owner == player end) local refs = Utils.Where(Map.ActorsInWorld, function(actor) return actor.Type == "refinery" and actor.Owner == Atreides end)
if #refs == 0 then if #refs == 0 then
harkonnen.MarkCompletedObjective(KillAtreides) Harkonnen.MarkCompletedObjective(KillAtreides)
else else
Trigger.OnAllRemovedFromWorld(refs, function() Trigger.OnAllRemovedFromWorld(refs, function()
harkonnen.MarkCompletedObjective(KillAtreides) Harkonnen.MarkCompletedObjective(KillAtreides)
end) end)
local silos = Utils.Where(Map.ActorsInWorld, function(actor) return actor.Type == "silo" and actor.Owner == player end) local silos = Utils.Where(Map.ActorsInWorld, function(actor) return actor.Type == "silo" and actor.Owner == Atreides end)
Utils.Do(refs, function(actor) Trigger.OnRemovedFromWorld(actor, checkResourceCapacity) end) Utils.Do(refs, function(actor) Trigger.OnRemovedFromWorld(actor, checkResourceCapacity) end)
Utils.Do(silos, function(actor) Trigger.OnRemovedFromWorld(actor, checkResourceCapacity) end) Utils.Do(silos, function(actor) Trigger.OnRemovedFromWorld(actor, checkResourceCapacity) end)
end end
@@ -143,8 +143,8 @@ WorldLoaded = function()
Media.DisplayMessage(Messages[1], Mentat) Media.DisplayMessage(Messages[1], Mentat)
Trigger.AfterDelay(DateTime.Seconds(25), function() Trigger.AfterDelay(DateTime.Seconds(25), function()
Media.PlaySpeechNotification(player, "Reinforce") Media.PlaySpeechNotification(Atreides, "Reinforce")
Reinforcements.Reinforce(player, AtreidesReinforcements, AtreidesEntryPath) Reinforcements.Reinforce(Atreides, AtreidesReinforcements, AtreidesEntryPath)
end) end)
WavesLeft = HarkonnenAttackWaves[Difficulty] WavesLeft = HarkonnenAttackWaves[Difficulty]
@@ -158,7 +158,7 @@ SendReinforcements = function()
if HarkonnenAttackDelay < 0 then HarkonnenAttackDelay = 0 end if HarkonnenAttackDelay < 0 then HarkonnenAttackDelay = 0 end
Trigger.AfterDelay(delay, function() Trigger.AfterDelay(delay, function()
Reinforcements.Reinforce(harkonnen, Utils.Random(units), { Utils.Random(HarkonnenEntryWaypoints) }, 10, IdleHunt) Reinforcements.Reinforce(Harkonnen, Utils.Random(units), { Utils.Random(HarkonnenEntryWaypoints) }, 10, IdleHunt)
WavesLeft = WavesLeft - 1 WavesLeft = WavesLeft - 1
if WavesLeft == 0 then if WavesLeft == 0 then

View File

@@ -61,16 +61,16 @@ Messages =
CachedResources = -1 CachedResources = -1
Tick = function() Tick = function()
if HarkonnenArrived and harkonnen.HasNoRequiredUnits() then if HarkonnenArrived and Harkonnen.HasNoRequiredUnits() then
player.MarkCompletedObjective(KillHarkonnen) Atreides.MarkCompletedObjective(KillHarkonnen)
end end
if player.Resources > SpiceToHarvest - 1 then if Atreides.Resources > SpiceToHarvest - 1 then
player.MarkCompletedObjective(GatherSpice) Atreides.MarkCompletedObjective(GatherSpice)
end end
-- player has no Wind Trap -- player has no Wind Trap
if (player.PowerProvided <= 20 or player.PowerState ~= "Normal") and DateTime.GameTime % DateTime.Seconds(32) == 0 then if (Atreides.PowerProvided <= 20 or Atreides.PowerState ~= "Normal") and DateTime.GameTime % DateTime.Seconds(32) == 0 then
HasPower = false HasPower = false
Media.DisplayMessage(Messages[2], Mentat) Media.DisplayMessage(Messages[2], Mentat)
else else
@@ -78,40 +78,40 @@ Tick = function()
end end
-- player has no Refinery and no Silos -- player has no Refinery and no Silos
if HasPower and player.ResourceCapacity == 0 and DateTime.GameTime % DateTime.Seconds(32) == 0 then if HasPower and Atreides.ResourceCapacity == 0 and DateTime.GameTime % DateTime.Seconds(32) == 0 then
Media.DisplayMessage(Messages[3], Mentat) Media.DisplayMessage(Messages[3], Mentat)
end end
if HasPower and player.Resources > player.ResourceCapacity * 0.8 and DateTime.GameTime % DateTime.Seconds(32) == 0 then if HasPower and Atreides.Resources > Atreides.ResourceCapacity * 0.8 and DateTime.GameTime % DateTime.Seconds(32) == 0 then
Media.DisplayMessage(Messages[4], Mentat) Media.DisplayMessage(Messages[4], Mentat)
end end
if player.Resources ~= CachedResources then if Atreides.Resources ~= CachedResources then
local parameters = { ["harvested"] = player.Resources, ["goal"] = SpiceToHarvest } local parameters = { ["harvested"] = Atreides.Resources, ["goal"] = SpiceToHarvest }
local harvestedResources = UserInterface.Translate("harvested-resources", parameters) local harvestedResources = UserInterface.Translate("harvested-resources", parameters)
UserInterface.SetMissionText(harvestedResources) UserInterface.SetMissionText(harvestedResources)
CachedResources = player.Resources CachedResources = Atreides.Resources
end end
end end
WorldLoaded = function() WorldLoaded = function()
player = Player.GetPlayer("Atreides") Atreides = Player.GetPlayer("Atreides")
harkonnen = Player.GetPlayer("Harkonnen") Harkonnen = Player.GetPlayer("Harkonnen")
SpiceToHarvest = ToHarvest[Difficulty] SpiceToHarvest = ToHarvest[Difficulty]
InitObjectives(player) InitObjectives(Atreides)
KillAtreides = AddPrimaryObjective(harkonnen, "") KillAtreides = AddPrimaryObjective(Harkonnen, "")
local harvestSpice = UserInterface.Translate("harvest-spice", { ["spice"] = SpiceToHarvest }) local harvestSpice = UserInterface.Translate("harvest-spice", { ["spice"] = SpiceToHarvest })
GatherSpice = AddPrimaryObjective(player, harvestSpice) GatherSpice = AddPrimaryObjective(Atreides, harvestSpice)
KillHarkonnen = AddSecondaryObjective(player, "eliminate-harkonnen-units-reinforcements") KillHarkonnen = AddSecondaryObjective(Atreides, "eliminate-harkonnen-units-reinforcements")
local checkResourceCapacity = function() local checkResourceCapacity = function()
Trigger.AfterDelay(0, function() Trigger.AfterDelay(0, function()
if player.ResourceCapacity < SpiceToHarvest then if Atreides.ResourceCapacity < SpiceToHarvest then
Media.DisplayMessage(UserInterface.Translate("not-enough-silos"), Mentat) Media.DisplayMessage(UserInterface.Translate("not-enough-silos"), Mentat)
Trigger.AfterDelay(DateTime.Seconds(3), function() Trigger.AfterDelay(DateTime.Seconds(3), function()
harkonnen.MarkCompletedObjective(KillAtreides) Harkonnen.MarkCompletedObjective(KillAtreides)
end) end)
return true return true
@@ -126,15 +126,15 @@ WorldLoaded = function()
return return
end end
local refs = Utils.Where(Map.ActorsInWorld, function(actor) return actor.Type == "refinery" and actor.Owner == player end) local refs = Utils.Where(Map.ActorsInWorld, function(actor) return actor.Type == "refinery" and actor.Owner == Atreides end)
if #refs == 0 then if #refs == 0 then
harkonnen.MarkCompletedObjective(KillAtreides) Harkonnen.MarkCompletedObjective(KillAtreides)
else else
Trigger.OnAllRemovedFromWorld(refs, function() Trigger.OnAllRemovedFromWorld(refs, function()
harkonnen.MarkCompletedObjective(KillAtreides) Harkonnen.MarkCompletedObjective(KillAtreides)
end) end)
local silos = Utils.Where(Map.ActorsInWorld, function(actor) return actor.Type == "silo" and actor.Owner == player end) local silos = Utils.Where(Map.ActorsInWorld, function(actor) return actor.Type == "silo" and actor.Owner == Atreides end)
Utils.Do(refs, function(actor) Trigger.OnRemovedFromWorld(actor, checkResourceCapacity) end) Utils.Do(refs, function(actor) Trigger.OnRemovedFromWorld(actor, checkResourceCapacity) end)
Utils.Do(silos, function(actor) Trigger.OnRemovedFromWorld(actor, checkResourceCapacity) end) Utils.Do(silos, function(actor) Trigger.OnRemovedFromWorld(actor, checkResourceCapacity) end)
end end
@@ -143,8 +143,8 @@ WorldLoaded = function()
Media.DisplayMessage(Messages[1], Mentat) Media.DisplayMessage(Messages[1], Mentat)
Trigger.AfterDelay(DateTime.Seconds(25), function() Trigger.AfterDelay(DateTime.Seconds(25), function()
Media.PlaySpeechNotification(player, "Reinforce") Media.PlaySpeechNotification(Atreides, "Reinforce")
Reinforcements.Reinforce(player, AtreidesReinforcements, AtreidesEntryPath) Reinforcements.Reinforce(Atreides, AtreidesReinforcements, AtreidesEntryPath)
end) end)
WavesLeft = HarkonnenAttackWaves[Difficulty] WavesLeft = HarkonnenAttackWaves[Difficulty]
@@ -158,7 +158,7 @@ SendReinforcements = function()
if HarkonnenAttackDelay < 0 then HarkonnenAttackDelay = 0 end if HarkonnenAttackDelay < 0 then HarkonnenAttackDelay = 0 end
Trigger.AfterDelay(delay, function() Trigger.AfterDelay(delay, function()
Reinforcements.Reinforce(harkonnen, Utils.Random(units), { Utils.Random(HarkonnenEntryWaypoints) }, 10, IdleHunt) Reinforcements.Reinforce(Harkonnen, Utils.Random(units), { Utils.Random(HarkonnenEntryWaypoints) }, 10, IdleHunt)
WavesLeft = WavesLeft - 1 WavesLeft = WavesLeft - 1
if WavesLeft == 0 then if WavesLeft == 0 then

View File

@@ -24,11 +24,11 @@ AttackDelays =
HarkonnenInfantryTypes = { "light_inf" } HarkonnenInfantryTypes = { "light_inf" }
ActivateAI = function() ActivateAI = function()
IdlingUnits[harkonnen] = { } IdlingUnits[Harkonnen] = { }
DefendAndRepairBase(harkonnen, HarkonnenBase, 0.75, AttackGroupSize[Difficulty]) DefendAndRepairBase(Harkonnen, HarkonnenBase, 0.75, AttackGroupSize[Difficulty])
local delay = function() return Utils.RandomInteger(AttackDelays[Difficulty][1], AttackDelays[Difficulty][2] + 1) end local delay = function() return Utils.RandomInteger(AttackDelays[Difficulty][1], AttackDelays[Difficulty][2] + 1) end
local toBuild = function() return HarkonnenInfantryTypes end local toBuild = function() return HarkonnenInfantryTypes end
local attackThresholdSize = AttackGroupSize[Difficulty] * 2.5 local attackThresholdSize = AttackGroupSize[Difficulty] * 2.5
ProduceUnits(harkonnen, HBarracks, delay, toBuild, AttackGroupSize[Difficulty], attackThresholdSize) ProduceUnits(Harkonnen, HBarracks, delay, toBuild, AttackGroupSize[Difficulty], attackThresholdSize)
end end

View File

@@ -65,31 +65,31 @@ HarkonnenAttackWaves =
} }
Tick = function() Tick = function()
if player.HasNoRequiredUnits() then if Atreides.HasNoRequiredUnits() then
harkonnen.MarkCompletedObjective(KillAtreides) Harkonnen.MarkCompletedObjective(KillAtreides)
end end
if harkonnen.HasNoRequiredUnits() and not player.IsObjectiveCompleted(KillHarkonnen) then if Harkonnen.HasNoRequiredUnits() and not Atreides.IsObjectiveCompleted(KillHarkonnen) then
Media.DisplayMessage(UserInterface.Translate("harkonnen-annihilated"), Mentat) Media.DisplayMessage(UserInterface.Translate("harkonnen-annihilated"), Mentat)
player.MarkCompletedObjective(KillHarkonnen) Atreides.MarkCompletedObjective(KillHarkonnen)
end end
end end
WorldLoaded = function() WorldLoaded = function()
harkonnen = Player.GetPlayer("Harkonnen") Harkonnen = Player.GetPlayer("Harkonnen")
player = Player.GetPlayer("Atreides") Atreides = Player.GetPlayer("Atreides")
InitObjectives(player) InitObjectives(Atreides)
KillAtreides = AddPrimaryObjective(harkonnen, "") KillAtreides = AddPrimaryObjective(Harkonnen, "")
KillHarkonnen = AddPrimaryObjective(player, "destroy-harkonnen-forces") KillHarkonnen = AddPrimaryObjective(Atreides, "destroy-harkonnen-forces")
Camera.Position = AConyard.CenterPosition Camera.Position = AConyard.CenterPosition
Trigger.OnAllKilled(HarkonnenBase, function() Trigger.OnAllKilled(HarkonnenBase, function()
Utils.Do(harkonnen.GetGroundAttackers(), IdleHunt) Utils.Do(Harkonnen.GetGroundAttackers(), IdleHunt)
end) end)
local path = function() return Utils.Random(HarkonnenAttackPaths) end local path = function() return Utils.Random(HarkonnenAttackPaths) end
SendCarryallReinforcements(harkonnen, 0, HarkonnenAttackWaves[Difficulty], HarkonnenAttackDelay[Difficulty], path, HarkonnenReinforcements[Difficulty]) SendCarryallReinforcements(Harkonnen, 0, HarkonnenAttackWaves[Difficulty], HarkonnenAttackDelay[Difficulty], path, HarkonnenReinforcements[Difficulty])
Trigger.AfterDelay(0, ActivateAI) Trigger.AfterDelay(0, ActivateAI)
end end

View File

@@ -24,11 +24,11 @@ AttackDelays =
HarkonnenInfantryTypes = { "light_inf" } HarkonnenInfantryTypes = { "light_inf" }
ActivateAI = function() ActivateAI = function()
IdlingUnits[harkonnen] = { } IdlingUnits[Harkonnen] = { }
DefendAndRepairBase(harkonnen, HarkonnenBase, 0.75, AttackGroupSize[Difficulty]) DefendAndRepairBase(Harkonnen, HarkonnenBase, 0.75, AttackGroupSize[Difficulty])
local delay = function() return Utils.RandomInteger(AttackDelays[Difficulty][1], AttackDelays[Difficulty][2] + 1) end local delay = function() return Utils.RandomInteger(AttackDelays[Difficulty][1], AttackDelays[Difficulty][2] + 1) end
local toBuild = function() return HarkonnenInfantryTypes end local toBuild = function() return HarkonnenInfantryTypes end
local attackThresholdSize = AttackGroupSize[Difficulty] * 2.5 local attackThresholdSize = AttackGroupSize[Difficulty] * 2.5
ProduceUnits(harkonnen, HBarracks, delay, toBuild, AttackGroupSize[Difficulty], attackThresholdSize) ProduceUnits(Harkonnen, HBarracks, delay, toBuild, AttackGroupSize[Difficulty], attackThresholdSize)
end end

View File

@@ -65,31 +65,31 @@ HarkonnenAttackWaves =
} }
Tick = function() Tick = function()
if player.HasNoRequiredUnits() then if Atreides.HasNoRequiredUnits() then
harkonnen.MarkCompletedObjective(KillAtreides) Harkonnen.MarkCompletedObjective(KillAtreides)
end end
if harkonnen.HasNoRequiredUnits() and not player.IsObjectiveCompleted(KillHarkonnen) then if Harkonnen.HasNoRequiredUnits() and not Atreides.IsObjectiveCompleted(KillHarkonnen) then
Media.DisplayMessage(UserInterface.Translate("harkonnen-annihilated"), Mentat) Media.DisplayMessage(UserInterface.Translate("harkonnen-annihilated"), Mentat)
player.MarkCompletedObjective(KillHarkonnen) Atreides.MarkCompletedObjective(KillHarkonnen)
end end
end end
WorldLoaded = function() WorldLoaded = function()
harkonnen = Player.GetPlayer("Harkonnen") Harkonnen = Player.GetPlayer("Harkonnen")
player = Player.GetPlayer("Atreides") Atreides = Player.GetPlayer("Atreides")
InitObjectives(player) InitObjectives(Atreides)
KillAtreides = AddPrimaryObjective(harkonnen, "") KillAtreides = AddPrimaryObjective(Harkonnen, "")
KillHarkonnen = AddPrimaryObjective(player, "destroy-harkonnen-forces") KillHarkonnen = AddPrimaryObjective(Atreides, "destroy-harkonnen-forces")
Camera.Position = AConyard.CenterPosition Camera.Position = AConyard.CenterPosition
Trigger.OnAllKilled(HarkonnenBase, function() Trigger.OnAllKilled(HarkonnenBase, function()
Utils.Do(harkonnen.GetGroundAttackers(), IdleHunt) Utils.Do(Harkonnen.GetGroundAttackers(), IdleHunt)
end) end)
local path = function() return Utils.Random(HarkonnenAttackPaths) end local path = function() return Utils.Random(HarkonnenAttackPaths) end
SendCarryallReinforcements(harkonnen, 0, HarkonnenAttackWaves[Difficulty], HarkonnenAttackDelay[Difficulty], path, HarkonnenReinforcements[Difficulty]) SendCarryallReinforcements(Harkonnen, 0, HarkonnenAttackWaves[Difficulty], HarkonnenAttackDelay[Difficulty], path, HarkonnenReinforcements[Difficulty])
Trigger.AfterDelay(0, ActivateAI) Trigger.AfterDelay(0, ActivateAI)
end end

View File

@@ -24,16 +24,16 @@ OrdosInfantryTypes = { "light_inf", "light_inf", "light_inf", "trooper", "troope
OrdosVehicleTypes = { "raider", "raider", "quad" } OrdosVehicleTypes = { "raider", "raider", "quad" }
InitAIUnits = function() InitAIUnits = function()
IdlingUnits[ordos] = Reinforcements.Reinforce(ordos, InitialOrdosReinforcements, OrdosPaths[2]) IdlingUnits[Ordos] = Reinforcements.Reinforce(Ordos, InitialOrdosReinforcements, OrdosPaths[2])
IdlingUnits[ordos][#IdlingUnits + 1] = OTrooper1 IdlingUnits[Ordos][#IdlingUnits + 1] = OTrooper1
IdlingUnits[ordos][#IdlingUnits + 1] = OTrooper2 IdlingUnits[Ordos][#IdlingUnits + 1] = OTrooper2
IdlingUnits[ordos][#IdlingUnits + 1] = ORaider IdlingUnits[Ordos][#IdlingUnits + 1] = ORaider
DefendAndRepairBase(ordos, OrdosBase, 0.75, AttackGroupSize[Difficulty]) DefendAndRepairBase(Ordos, OrdosBase, 0.75, AttackGroupSize[Difficulty])
end end
ActivateAI = function() ActivateAI = function()
LastHarvesterEaten[ordos] = true LastHarvesterEaten[Ordos] = true
Trigger.AfterDelay(0, InitAIUnits) Trigger.AfterDelay(0, InitAIUnits)
OConyard.Produce(AtreidesUpgrades[1]) OConyard.Produce(AtreidesUpgrades[1])
@@ -46,7 +46,7 @@ ActivateAI = function()
-- Finish the upgrades first before trying to build something -- Finish the upgrades first before trying to build something
Trigger.AfterDelay(DateTime.Seconds(14), function() Trigger.AfterDelay(DateTime.Seconds(14), function()
ProduceUnits(ordos, OBarracks, delay, infantryToBuild, AttackGroupSize[Difficulty], attackThresholdSize) ProduceUnits(Ordos, OBarracks, delay, infantryToBuild, AttackGroupSize[Difficulty], attackThresholdSize)
ProduceUnits(ordos, OLightFactory, delay, vehiclesToBuild, AttackGroupSize[Difficulty], attackThresholdSize) ProduceUnits(Ordos, OLightFactory, delay, vehiclesToBuild, AttackGroupSize[Difficulty], attackThresholdSize)
end) end)
end end

View File

@@ -78,65 +78,65 @@ AtreidesBaseBuildings = { "barracks", "light_factory" }
AtreidesUpgrades = { "upgrade.barracks", "upgrade.light" } AtreidesUpgrades = { "upgrade.barracks", "upgrade.light" }
MessageCheck = function(index) MessageCheck = function(index)
return #player.GetActorsByType(AtreidesBaseBuildings[index]) > 0 and not player.HasPrerequisites({ AtreidesUpgrades[index] }) return #Atreides.GetActorsByType(AtreidesBaseBuildings[index]) > 0 and not Atreides.HasPrerequisites({ AtreidesUpgrades[index] })
end end
CachedResources = -1 CachedResources = -1
Tick = function() Tick = function()
if player.HasNoRequiredUnits() then if Atreides.HasNoRequiredUnits() then
ordos.MarkCompletedObjective(KillAtreides) Ordos.MarkCompletedObjective(KillAtreides)
end end
if ordos.HasNoRequiredUnits() and not player.IsObjectiveCompleted(KillOrdos) then if Ordos.HasNoRequiredUnits() and not Atreides.IsObjectiveCompleted(KillOrdos) then
Media.DisplayMessage(UserInterface.Translate("ordos-annihilated"), Mentat) Media.DisplayMessage(UserInterface.Translate("ordos-annihilated"), Mentat)
player.MarkCompletedObjective(KillOrdos) Atreides.MarkCompletedObjective(KillOrdos)
end end
if DateTime.GameTime % DateTime.Seconds(10) == 0 and LastHarvesterEaten[ordos] then if DateTime.GameTime % DateTime.Seconds(10) == 0 and LastHarvesterEaten[Ordos] then
local units = ordos.GetActorsByType("harvester") local units = Ordos.GetActorsByType("harvester")
if #units > 0 then if #units > 0 then
LastHarvesterEaten[ordos] = false LastHarvesterEaten[Ordos] = false
ProtectHarvester(units[1], ordos, AttackGroupSize[Difficulty]) ProtectHarvester(units[1], Ordos, AttackGroupSize[Difficulty])
end end
end end
if player.Resources > SpiceToHarvest - 1 then if Atreides.Resources > SpiceToHarvest - 1 then
player.MarkCompletedObjective(GatherSpice) Atreides.MarkCompletedObjective(GatherSpice)
end end
if DateTime.GameTime % DateTime.Seconds(32) == 0 and (MessageCheck(1) or MessageCheck(2)) then if DateTime.GameTime % DateTime.Seconds(32) == 0 and (MessageCheck(1) or MessageCheck(2)) then
Media.DisplayMessage(UserInterface.Translate("upgrade-barracks-light-factory"), Mentat) Media.DisplayMessage(UserInterface.Translate("upgrade-barracks-light-factory"), Mentat)
end end
if player.Resources ~= CachedResources then if Atreides.Resources ~= CachedResources then
local parameters = { ["harvested"] = player.Resources, ["goal"] = SpiceToHarvest } local parameters = { ["harvested"] = Atreides.Resources, ["goal"] = SpiceToHarvest }
local harvestedResources = UserInterface.Translate("harvested-resources", parameters) local harvestedResources = UserInterface.Translate("harvested-resources", parameters)
UserInterface.SetMissionText(harvestedResources) UserInterface.SetMissionText(harvestedResources)
CachedResources = player.Resources CachedResources = Atreides.Resources
end end
end end
WorldLoaded = function() WorldLoaded = function()
ordos = Player.GetPlayer("Ordos") Ordos = Player.GetPlayer("Ordos")
player = Player.GetPlayer("Atreides") Atreides = Player.GetPlayer("Atreides")
SpiceToHarvest = ToHarvest[Difficulty] SpiceToHarvest = ToHarvest[Difficulty]
InitObjectives(player) InitObjectives(Atreides)
KillAtreides = AddPrimaryObjective(ordos, "") KillAtreides = AddPrimaryObjective(Ordos, "")
local harvestSpice = UserInterface.Translate("harvest-spice", { ["spice"] = SpiceToHarvest }) local harvestSpice = UserInterface.Translate("harvest-spice", { ["spice"] = SpiceToHarvest })
GatherSpice = AddPrimaryObjective(player, harvestSpice) GatherSpice = AddPrimaryObjective(Atreides, harvestSpice)
KillOrdos = AddSecondaryObjective(player, "eliminate-ordos-units-reinforcements") KillOrdos = AddSecondaryObjective(Atreides, "eliminate-ordos-units-reinforcements")
Camera.Position = AConyard.CenterPosition Camera.Position = AConyard.CenterPosition
local checkResourceCapacity = function() local checkResourceCapacity = function()
Trigger.AfterDelay(0, function() Trigger.AfterDelay(0, function()
if player.ResourceCapacity < SpiceToHarvest then if Atreides.ResourceCapacity < SpiceToHarvest then
Media.DisplayMessage(UserInterface.Translate("not-enough-silos"), Mentat) Media.DisplayMessage(UserInterface.Translate("not-enough-silos"), Mentat)
Trigger.AfterDelay(DateTime.Seconds(3), function() Trigger.AfterDelay(DateTime.Seconds(3), function()
ordos.MarkCompletedObjective(KillAtreides) Ordos.MarkCompletedObjective(KillAtreides)
end) end)
return true return true
@@ -151,31 +151,31 @@ WorldLoaded = function()
return return
end end
local refs = Utils.Where(Map.ActorsInWorld, function(actor) return actor.Type == "refinery" and actor.Owner == player end) local refs = Utils.Where(Map.ActorsInWorld, function(actor) return actor.Type == "refinery" and actor.Owner == Atreides end)
if #refs == 0 then if #refs == 0 then
ordos.MarkCompletedObjective(KillAtreides) Ordos.MarkCompletedObjective(KillAtreides)
else else
Trigger.OnAllRemovedFromWorld(refs, function() Trigger.OnAllRemovedFromWorld(refs, function()
ordos.MarkCompletedObjective(KillAtreides) Ordos.MarkCompletedObjective(KillAtreides)
end) end)
local silos = Utils.Where(Map.ActorsInWorld, function(actor) return actor.Type == "silo" and actor.Owner == player end) local silos = Utils.Where(Map.ActorsInWorld, function(actor) return actor.Type == "silo" and actor.Owner == Atreides end)
Utils.Do(refs, function(actor) Trigger.OnRemovedFromWorld(actor, checkResourceCapacity) end) Utils.Do(refs, function(actor) Trigger.OnRemovedFromWorld(actor, checkResourceCapacity) end)
Utils.Do(silos, function(actor) Trigger.OnRemovedFromWorld(actor, checkResourceCapacity) end) Utils.Do(silos, function(actor) Trigger.OnRemovedFromWorld(actor, checkResourceCapacity) end)
end end
end) end)
Trigger.OnAllKilled(OrdosBase, function() Trigger.OnAllKilled(OrdosBase, function()
Utils.Do(ordos.GetGroundAttackers(), IdleHunt) Utils.Do(Ordos.GetGroundAttackers(), IdleHunt)
end) end)
local path = function() return OrdosPaths[1] end local path = function() return OrdosPaths[1] end
local waveCondition = function() return player.IsObjectiveCompleted(KillOrdos) end local waveCondition = function() return Atreides.IsObjectiveCompleted(KillOrdos) end
SendCarryallReinforcements(ordos, 0, OrdosAttackWaves[Difficulty], OrdosAttackDelay[Difficulty], path, OrdosReinforcements[Difficulty], waveCondition) SendCarryallReinforcements(Ordos, 0, OrdosAttackWaves[Difficulty], OrdosAttackDelay[Difficulty], path, OrdosReinforcements[Difficulty], waveCondition)
ActivateAI() ActivateAI()
Trigger.AfterDelay(DateTime.Minutes(2) + DateTime.Seconds(30), function() Trigger.AfterDelay(DateTime.Minutes(2) + DateTime.Seconds(30), function()
Media.PlaySpeechNotification(player, "Reinforce") Media.PlaySpeechNotification(Atreides, "Reinforce")
Reinforcements.ReinforceWithTransport(player, "carryall.reinforce", AtreidesReinforcements, AtreidesPath, { AtreidesPath[1] }) Reinforcements.ReinforceWithTransport(Atreides, "carryall.reinforce", AtreidesReinforcements, AtreidesPath, { AtreidesPath[1] })
end) end)
end end

View File

@@ -24,12 +24,12 @@ AttackDelays =
OrdosInfantryTypes = { "light_inf", "light_inf", "light_inf", "trooper", "trooper" } OrdosInfantryTypes = { "light_inf", "light_inf", "light_inf", "trooper", "trooper" }
InitAIUnits = function() InitAIUnits = function()
IdlingUnits[ordos] = Reinforcements.Reinforce(ordos, InitialOrdosReinforcements, OrdosPaths[2]) IdlingUnits[Ordos] = Reinforcements.Reinforce(Ordos, InitialOrdosReinforcements, OrdosPaths[2])
DefendAndRepairBase(ordos, OrdosBase, 0.75, AttackGroupSize[Difficulty]) DefendAndRepairBase(Ordos, OrdosBase, 0.75, AttackGroupSize[Difficulty])
end end
ActivateAI = function() ActivateAI = function()
LastHarvesterEaten[ordos] = true LastHarvesterEaten[Ordos] = true
Trigger.AfterDelay(0, InitAIUnits) Trigger.AfterDelay(0, InitAIUnits)
OConyard.Produce(AtreidesUpgrades[1]) OConyard.Produce(AtreidesUpgrades[1])
@@ -40,6 +40,6 @@ ActivateAI = function()
-- Finish the upgrades first before trying to build something -- Finish the upgrades first before trying to build something
Trigger.AfterDelay(DateTime.Seconds(14), function() Trigger.AfterDelay(DateTime.Seconds(14), function()
ProduceUnits(ordos, OBarracks, delay, toBuild, AttackGroupSize[Difficulty], attackThresholdSize) ProduceUnits(Ordos, OBarracks, delay, toBuild, AttackGroupSize[Difficulty], attackThresholdSize)
end) end)
end end

View File

@@ -78,65 +78,65 @@ AtreidesBaseBuildings = { "barracks", "light_factory" }
AtreidesUpgrades = { "upgrade.barracks", "upgrade.light" } AtreidesUpgrades = { "upgrade.barracks", "upgrade.light" }
MessageCheck = function(index) MessageCheck = function(index)
return #player.GetActorsByType(AtreidesBaseBuildings[index]) > 0 and not player.HasPrerequisites({ AtreidesUpgrades[index] }) return #Atreides.GetActorsByType(AtreidesBaseBuildings[index]) > 0 and not Atreides.HasPrerequisites({ AtreidesUpgrades[index] })
end end
CachedResources = -1 CachedResources = -1
Tick = function() Tick = function()
if player.HasNoRequiredUnits() then if Atreides.HasNoRequiredUnits() then
ordos.MarkCompletedObjective(KillAtreides) Ordos.MarkCompletedObjective(KillAtreides)
end end
if ordos.HasNoRequiredUnits() and not player.IsObjectiveCompleted(KillOrdos) then if Ordos.HasNoRequiredUnits() and not Atreides.IsObjectiveCompleted(KillOrdos) then
Media.DisplayMessage(UserInterface.Translate("ordos-annihilated"), Mentat) Media.DisplayMessage(UserInterface.Translate("ordos-annihilated"), Mentat)
player.MarkCompletedObjective(KillOrdos) Atreides.MarkCompletedObjective(KillOrdos)
end end
if DateTime.GameTime % DateTime.Seconds(10) == 0 and LastHarvesterEaten[ordos] then if DateTime.GameTime % DateTime.Seconds(10) == 0 and LastHarvesterEaten[Ordos] then
local units = ordos.GetActorsByType("harvester") local units = Ordos.GetActorsByType("harvester")
if #units > 0 then if #units > 0 then
LastHarvesterEaten[ordos] = false LastHarvesterEaten[Ordos] = false
ProtectHarvester(units[1], ordos, AttackGroupSize[Difficulty]) ProtectHarvester(units[1], Ordos, AttackGroupSize[Difficulty])
end end
end end
if player.Resources > SpiceToHarvest - 1 then if Atreides.Resources > SpiceToHarvest - 1 then
player.MarkCompletedObjective(GatherSpice) Atreides.MarkCompletedObjective(GatherSpice)
end end
if DateTime.GameTime % DateTime.Seconds(32) == 0 and (MessageCheck(1) or MessageCheck(2)) then if DateTime.GameTime % DateTime.Seconds(32) == 0 and (MessageCheck(1) or MessageCheck(2)) then
Media.DisplayMessage(UserInterface.Translate("upgrade-barracks-light-factory"), Mentat) Media.DisplayMessage(UserInterface.Translate("upgrade-barracks-light-factory"), Mentat)
end end
if player.Resources ~= CachedResources then if Atreides.Resources ~= CachedResources then
local parameters = { ["harvested"] = player.Resources, ["goal"] = SpiceToHarvest } local parameters = { ["harvested"] = Atreides.Resources, ["goal"] = SpiceToHarvest }
local harvestedResources = UserInterface.Translate("harvested-resources", parameters) local harvestedResources = UserInterface.Translate("harvested-resources", parameters)
UserInterface.SetMissionText(harvestedResources) UserInterface.SetMissionText(harvestedResources)
CachedResources = player.Resources CachedResources = Atreides.Resources
end end
end end
WorldLoaded = function() WorldLoaded = function()
ordos = Player.GetPlayer("Ordos") Ordos = Player.GetPlayer("Ordos")
player = Player.GetPlayer("Atreides") Atreides = Player.GetPlayer("Atreides")
SpiceToHarvest = ToHarvest[Difficulty] SpiceToHarvest = ToHarvest[Difficulty]
InitObjectives(player) InitObjectives(Atreides)
KillAtreides = AddPrimaryObjective(ordos, "") KillAtreides = AddPrimaryObjective(Ordos, "")
local harvestSpice = UserInterface.Translate("harvest-spice", { ["spice"] = SpiceToHarvest }) local harvestSpice = UserInterface.Translate("harvest-spice", { ["spice"] = SpiceToHarvest })
GatherSpice = AddPrimaryObjective(player, harvestSpice) GatherSpice = AddPrimaryObjective(Atreides, harvestSpice)
KillOrdos = AddSecondaryObjective(player, "eliminate-ordos-units-reinforcements") KillOrdos = AddSecondaryObjective(Atreides, "eliminate-ordos-units-reinforcements")
Camera.Position = AConyard.CenterPosition Camera.Position = AConyard.CenterPosition
local checkResourceCapacity = function() local checkResourceCapacity = function()
Trigger.AfterDelay(0, function() Trigger.AfterDelay(0, function()
if player.ResourceCapacity < SpiceToHarvest then if Atreides.ResourceCapacity < SpiceToHarvest then
Media.DisplayMessage(UserInterface.Translate("not-enough-silos"), Mentat) Media.DisplayMessage(UserInterface.Translate("not-enough-silos"), Mentat)
Trigger.AfterDelay(DateTime.Seconds(3), function() Trigger.AfterDelay(DateTime.Seconds(3), function()
ordos.MarkCompletedObjective(KillAtreides) Ordos.MarkCompletedObjective(KillAtreides)
end) end)
return true return true
@@ -151,31 +151,31 @@ WorldLoaded = function()
return return
end end
local refs = Utils.Where(Map.ActorsInWorld, function(actor) return actor.Type == "refinery" and actor.Owner == player end) local refs = Utils.Where(Map.ActorsInWorld, function(actor) return actor.Type == "refinery" and actor.Owner == Atreides end)
if #refs == 0 then if #refs == 0 then
ordos.MarkCompletedObjective(KillAtreides) Ordos.MarkCompletedObjective(KillAtreides)
else else
Trigger.OnAllRemovedFromWorld(refs, function() Trigger.OnAllRemovedFromWorld(refs, function()
ordos.MarkCompletedObjective(KillAtreides) Ordos.MarkCompletedObjective(KillAtreides)
end) end)
local silos = Utils.Where(Map.ActorsInWorld, function(actor) return actor.Type == "silo" and actor.Owner == player end) local silos = Utils.Where(Map.ActorsInWorld, function(actor) return actor.Type == "silo" and actor.Owner == Atreides end)
Utils.Do(refs, function(actor) Trigger.OnRemovedFromWorld(actor, checkResourceCapacity) end) Utils.Do(refs, function(actor) Trigger.OnRemovedFromWorld(actor, checkResourceCapacity) end)
Utils.Do(silos, function(actor) Trigger.OnRemovedFromWorld(actor, checkResourceCapacity) end) Utils.Do(silos, function(actor) Trigger.OnRemovedFromWorld(actor, checkResourceCapacity) end)
end end
end) end)
Trigger.OnAllKilled(OrdosBase, function() Trigger.OnAllKilled(OrdosBase, function()
Utils.Do(ordos.GetGroundAttackers(), IdleHunt) Utils.Do(Ordos.GetGroundAttackers(), IdleHunt)
end) end)
local path = function() return OrdosPaths[1] end local path = function() return OrdosPaths[1] end
local waveCondition = function() return player.IsObjectiveCompleted(KillOrdos) end local waveCondition = function() return Atreides.IsObjectiveCompleted(KillOrdos) end
SendCarryallReinforcements(ordos, 0, OrdosAttackWaves[Difficulty], OrdosAttackDelay[Difficulty], path, OrdosReinforcements[Difficulty], waveCondition) SendCarryallReinforcements(Ordos, 0, OrdosAttackWaves[Difficulty], OrdosAttackDelay[Difficulty], path, OrdosReinforcements[Difficulty], waveCondition)
ActivateAI() ActivateAI()
Trigger.AfterDelay(DateTime.Minutes(2) + DateTime.Seconds(30), function() Trigger.AfterDelay(DateTime.Minutes(2) + DateTime.Seconds(30), function()
Media.PlaySpeechNotification(player, "Reinforce") Media.PlaySpeechNotification(Atreides, "Reinforce")
Reinforcements.ReinforceWithTransport(player, "carryall.reinforce", AtreidesReinforcements, AtreidesPath, { AtreidesPath[1] }) Reinforcements.ReinforceWithTransport(Atreides, "carryall.reinforce", AtreidesReinforcements, AtreidesPath, { AtreidesPath[1] })
end) end)
end end

View File

@@ -46,13 +46,13 @@ SendAttack = function(owner, size)
end end
InitAIUnits = function() InitAIUnits = function()
IdlingUnits[harkonnen] = Reinforcements.Reinforce(harkonnen, InitialHarkonnenReinforcements, HarkonnenPaths[1]) IdlingUnits[Harkonnen] = Reinforcements.Reinforce(Harkonnen, InitialHarkonnenReinforcements, HarkonnenPaths[1])
DefendAndRepairBase(harkonnen, HarkonnenBase, 0.75, AttackGroupSize[Difficulty]) DefendAndRepairBase(Harkonnen, HarkonnenBase, 0.75, AttackGroupSize[Difficulty])
end end
ActivateAI = function() ActivateAI = function()
LastHarvesterEaten[harkonnen] = true LastHarvesterEaten[Harkonnen] = true
InitAIUnits() InitAIUnits()
FremenProduction() FremenProduction()
@@ -61,6 +61,6 @@ ActivateAI = function()
local tanksToBuild = function() return HarkonnenTankType end local tanksToBuild = function() return HarkonnenTankType end
local attackThresholdSize = AttackGroupSize[Difficulty] * 2.5 local attackThresholdSize = AttackGroupSize[Difficulty] * 2.5
ProduceUnits(harkonnen, HarkonnenBarracks, delay, infantryToBuild, AttackGroupSize[Difficulty], attackThresholdSize) ProduceUnits(Harkonnen, HarkonnenBarracks, delay, infantryToBuild, AttackGroupSize[Difficulty], attackThresholdSize)
ProduceUnits(harkonnen, HarkonnenHeavyFact, delay, tanksToBuild, AttackGroupSize[Difficulty], attackThresholdSize) ProduceUnits(Harkonnen, HarkonnenHeavyFact, delay, tanksToBuild, AttackGroupSize[Difficulty], attackThresholdSize)
end end

View File

@@ -96,30 +96,30 @@ FremenProduction = function()
end end
local delay = Utils.RandomInteger(FremenInterval[Difficulty][1], FremenInterval[Difficulty][2] + 1) local delay = Utils.RandomInteger(FremenInterval[Difficulty][1], FremenInterval[Difficulty][2] + 1)
fremen.Build({ "nsfremen" }, function() Fremen.Build({ "nsfremen" }, function()
Trigger.AfterDelay(delay, FremenProduction) Trigger.AfterDelay(delay, FremenProduction)
end) end)
end end
AttackNotifier = 0 AttackNotifier = 0
Tick = function() Tick = function()
if player.HasNoRequiredUnits() then if Atreides.HasNoRequiredUnits() then
harkonnen.MarkCompletedObjective(KillAtreides) Harkonnen.MarkCompletedObjective(KillAtreides)
end end
if harkonnen.HasNoRequiredUnits() and not player.IsObjectiveCompleted(KillHarkonnen) then if Harkonnen.HasNoRequiredUnits() and not Atreides.IsObjectiveCompleted(KillHarkonnen) then
Media.DisplayMessage(UserInterface.Translate("harkonnen-annihilated"), Mentat) Media.DisplayMessage(UserInterface.Translate("harkonnen-annihilated"), Mentat)
player.MarkCompletedObjective(KillHarkonnen) Atreides.MarkCompletedObjective(KillHarkonnen)
player.MarkCompletedObjective(ProtectFremen) Atreides.MarkCompletedObjective(ProtectFremen)
player.MarkCompletedObjective(KeepIntegrity) Atreides.MarkCompletedObjective(KeepIntegrity)
end end
if DateTime.GameTime % DateTime.Seconds(10) == 0 and LastHarvesterEaten[harkonnen] then if DateTime.GameTime % DateTime.Seconds(10) == 0 and LastHarvesterEaten[Harkonnen] then
local units = harkonnen.GetActorsByType("harvester") local units = Harkonnen.GetActorsByType("harvester")
if #units > 0 then if #units > 0 then
LastHarvesterEaten[harkonnen] = false LastHarvesterEaten[Harkonnen] = false
ProtectHarvester(units[1], harkonnen, AttackGroupSize[Difficulty]) ProtectHarvester(units[1], Harkonnen, AttackGroupSize[Difficulty])
end end
end end
@@ -127,50 +127,50 @@ Tick = function()
AttackNotifier = AttackNotifier - 1 AttackNotifier = AttackNotifier - 1
local integrity = math.floor((Sietch.Health * 100) / Sietch.MaxHealth) local integrity = math.floor((Sietch.Health * 100) / Sietch.MaxHealth)
SiegeIntegrity = UserInterface.Translate("sietch-integrity", { ["integrity"] = integrity }) SiegeIntegrity = UserInterface.Translate("sietch-integrity", { ["integrity"] = integrity })
UserInterface.SetMissionText(SiegeIntegrity, player.Color) UserInterface.SetMissionText(SiegeIntegrity, Atreides.Color)
if integrity < IntegrityLevel[Difficulty] then if integrity < IntegrityLevel[Difficulty] then
player.MarkFailedObjective(KeepIntegrity) Atreides.MarkFailedObjective(KeepIntegrity)
end end
end end
end end
WorldLoaded = function() WorldLoaded = function()
harkonnen = Player.GetPlayer("Harkonnen") Harkonnen = Player.GetPlayer("Harkonnen")
fremen = Player.GetPlayer("Fremen") Fremen = Player.GetPlayer("Fremen")
player = Player.GetPlayer("Atreides") Atreides = Player.GetPlayer("Atreides")
InitObjectives(player) InitObjectives(Atreides)
KillAtreides = AddPrimaryObjective(harkonnen, "") KillAtreides = AddPrimaryObjective(Harkonnen, "")
ProtectFremen = AddPrimaryObjective(player, "protect-fremen-sietch") ProtectFremen = AddPrimaryObjective(Atreides, "protect-fremen-sietch")
KillHarkonnen = AddPrimaryObjective(player, "destroy-harkonnen") KillHarkonnen = AddPrimaryObjective(Atreides, "destroy-harkonnen")
local keepSietchIntact = UserInterface.Translate("keep-sietch-intact", { ["integrity"] = IntegrityLevel[Difficulty] }) local keepSietchIntact = UserInterface.Translate("keep-sietch-intact", { ["integrity"] = IntegrityLevel[Difficulty] })
KeepIntegrity = AddPrimaryObjective(player, keepSietchIntact) KeepIntegrity = AddPrimaryObjective(Atreides, keepSietchIntact)
Camera.Position = AConyard.CenterPosition Camera.Position = AConyard.CenterPosition
HarkonnenAttackLocation = AConyard.Location HarkonnenAttackLocation = AConyard.Location
Trigger.AfterDelay(DateTime.Seconds(2), function() Trigger.AfterDelay(DateTime.Seconds(2), function()
Beacon.New(player, Sietch.CenterPosition + WVec.New(0, 1024, 0)) Beacon.New(Atreides, Sietch.CenterPosition + WVec.New(0, 1024, 0))
Media.DisplayMessage(UserInterface.Translate("fremen-sietch-southeast"), Mentat) Media.DisplayMessage(UserInterface.Translate("fremen-sietch-southeast"), Mentat)
end) end)
Trigger.OnAllKilledOrCaptured(HarkonnenBase, function() Trigger.OnAllKilledOrCaptured(HarkonnenBase, function()
Utils.Do(harkonnen.GetGroundAttackers(), IdleHunt) Utils.Do(Harkonnen.GetGroundAttackers(), IdleHunt)
end) end)
Trigger.OnKilled(Sietch, function() Trigger.OnKilled(Sietch, function()
Actor.Create("invisibleBlocker", true, { Owner = fremen, Location = CPos.New(62, 59) }) Actor.Create("invisibleBlocker", true, { Owner = Fremen, Location = CPos.New(62, 59) })
UserInterface.SetMissionText(UserInterface.Translate("sietch-destroyed"), player.Color) UserInterface.SetMissionText(UserInterface.Translate("sietch-destroyed"), Atreides.Color)
player.MarkFailedObjective(ProtectFremen) Atreides.MarkFailedObjective(ProtectFremen)
end) end)
Trigger.OnDamaged(Sietch, function() Trigger.OnDamaged(Sietch, function()
if AttackNotifier <= 0 then if AttackNotifier <= 0 then
AttackNotifier = DateTime.Seconds(10) AttackNotifier = DateTime.Seconds(10)
Beacon.New(player, Sietch.CenterPosition + WVec.New(0, 1024, 0), DateTime.Seconds(7)) Beacon.New(Atreides, Sietch.CenterPosition + WVec.New(0, 1024, 0), DateTime.Seconds(7))
Media.DisplayMessage(UserInterface.Translate("fremen-sietch-under-attack"), Mentat) Media.DisplayMessage(UserInterface.Translate("fremen-sietch-under-attack"), Mentat)
local defenders = fremen.GetGroundAttackers() local defenders = Fremen.GetGroundAttackers()
if #defenders > 0 then if #defenders > 0 then
Utils.Do(defenders, function(unit) Utils.Do(defenders, function(unit)
unit.Guard(Sietch) unit.Guard(Sietch)
@@ -180,35 +180,35 @@ WorldLoaded = function()
end) end)
local path = function() return Utils.Random(HarkonnenPaths) end local path = function() return Utils.Random(HarkonnenPaths) end
local waveCondition = function() return player.IsObjectiveCompleted(KillHarkonnen) end local waveCondition = function() return Atreides.IsObjectiveCompleted(KillHarkonnen) end
local huntFunction = function(unit) local huntFunction = function(unit)
unit.AttackMove(HarkonnenAttackLocation) unit.AttackMove(HarkonnenAttackLocation)
IdleHunt(unit) IdleHunt(unit)
end end
SendCarryallReinforcements(harkonnen, 0, HarkonnenAttackWaves[Difficulty], HarkonnenAttackDelay[Difficulty], path, HarkonnenReinforcements[Difficulty], waveCondition, huntFunction) SendCarryallReinforcements(Harkonnen, 0, HarkonnenAttackWaves[Difficulty], HarkonnenAttackDelay[Difficulty], path, HarkonnenReinforcements[Difficulty], waveCondition, huntFunction)
Actor.Create("upgrade.barracks", true, { Owner = harkonnen }) Actor.Create("upgrade.barracks", true, { Owner = Harkonnen })
Trigger.AfterDelay(0, ActivateAI) Trigger.AfterDelay(0, ActivateAI)
Trigger.AfterDelay(DateTime.Seconds(50), function() Trigger.AfterDelay(DateTime.Seconds(50), function()
Media.PlaySpeechNotification(player, "Reinforce") Media.PlaySpeechNotification(Atreides, "Reinforce")
Reinforcements.Reinforce(player, AtreidesReinforcements[1], AtreidesPath) Reinforcements.Reinforce(Atreides, AtreidesReinforcements[1], AtreidesPath)
end) end)
Trigger.AfterDelay(DateTime.Minutes(1) + DateTime.Seconds(40), function() Trigger.AfterDelay(DateTime.Minutes(1) + DateTime.Seconds(40), function()
Media.PlaySpeechNotification(player, "Reinforce") Media.PlaySpeechNotification(Atreides, "Reinforce")
Reinforcements.ReinforceWithTransport(player, "carryall.reinforce", AtreidesReinforcements[2], AtreidesPath, { AtreidesPath[1] }) Reinforcements.ReinforceWithTransport(Atreides, "carryall.reinforce", AtreidesReinforcements[2], AtreidesPath, { AtreidesPath[1] })
end) end)
Trigger.OnEnteredProximityTrigger(HarkonnenRally1.CenterPosition, WDist.New(6 * 1024), function(a, id) Trigger.OnEnteredProximityTrigger(HarkonnenRally1.CenterPosition, WDist.New(6 * 1024), function(a, id)
if a.Owner == player then if a.Owner == Atreides then
Trigger.RemoveProximityTrigger(id) Trigger.RemoveProximityTrigger(id)
local units = Reinforcements.Reinforce(harkonnen, { "light_inf", "combat_tank_h", "trike" }, HarkonnenPaths[1]) local units = Reinforcements.Reinforce(Harkonnen, { "light_inf", "combat_tank_h", "trike" }, HarkonnenPaths[1])
Utils.Do(units, IdleHunt) Utils.Do(units, IdleHunt)
end end
end) end)
Trigger.OnExitedProximityTrigger(Sietch.CenterPosition, WDist.New(10.5 * 1024), function(a, id) Trigger.OnExitedProximityTrigger(Sietch.CenterPosition, WDist.New(10.5 * 1024), function(a, id)
if a.Owner == fremen and not a.IsDead then if a.Owner == Fremen and not a.IsDead then
a.AttackMove(FremenRally.Location) a.AttackMove(FremenRally.Location)
Trigger.OnIdle(a, function() Trigger.OnIdle(a, function()
if a.Location.X < 54 or a.Location.Y < 54 then if a.Location.X < 54 or a.Location.Y < 54 then

View File

@@ -26,44 +26,44 @@ HarkonnenVehicleTypes = { "trike", "trike", "trike", "quad", "quad" }
HarkonnenTankType = { "combat_tank_h" } HarkonnenTankType = { "combat_tank_h" }
InitAIUnits = function() InitAIUnits = function()
IdlingUnits[harkonnen] = Reinforcements.ReinforceWithTransport(harkonnen, "carryall.reinforce", InitialHarkonnenReinforcements, HarkonnenPaths[1], { HarkonnenPaths[1][1] })[2] IdlingUnits[Harkonnen] = Reinforcements.ReinforceWithTransport(Harkonnen, "carryall.reinforce", InitialHarkonnenReinforcements, HarkonnenPaths[1], { HarkonnenPaths[1][1] })[2]
DefendAndRepairBase(harkonnen, HarkonnenBase, 0.75, AttackGroupSize[Difficulty]) DefendAndRepairBase(Harkonnen, HarkonnenBase, 0.75, AttackGroupSize[Difficulty])
DefendActor(HarkonnenBarracks, harkonnen, AttackGroupSize[Difficulty]) DefendActor(HarkonnenBarracks, Harkonnen, AttackGroupSize[Difficulty])
RepairBuilding(harkonnen, HarkonnenBarracks, 0.75) RepairBuilding(Harkonnen, HarkonnenBarracks, 0.75)
Utils.Do(SmugglerBase, function(actor) Utils.Do(SmugglerBase, function(actor)
RepairBuilding(smuggler, actor, 0.75) RepairBuilding(Smuggler, actor, 0.75)
end) end)
RepairBuilding(smuggler, Starport, 0.75) RepairBuilding(Smuggler, Starport, 0.75)
end end
-- Not using ProduceUnits because of the custom StopInfantryProduction condition -- Not using ProduceUnits because of the custom StopInfantryProduction condition
ProduceInfantry = function() ProduceInfantry = function()
if StopInfantryProduction or HarkonnenBarracks.IsDead or HarkonnenBarracks.Owner ~= harkonnen then if StopInfantryProduction or HarkonnenBarracks.IsDead or HarkonnenBarracks.Owner ~= Harkonnen then
return return
end end
if HoldProduction[harkonnen] then if HoldProduction[Harkonnen] then
Trigger.AfterDelay(DateTime.Seconds(30), ProduceInfantry) Trigger.AfterDelay(DateTime.Seconds(30), ProduceInfantry)
return return
end end
local delay = Utils.RandomInteger(AttackDelays[Difficulty][1], AttackDelays[Difficulty][2] + 1) local delay = Utils.RandomInteger(AttackDelays[Difficulty][1], AttackDelays[Difficulty][2] + 1)
local toBuild = { Utils.Random(HarkonnenInfantryTypes) } local toBuild = { Utils.Random(HarkonnenInfantryTypes) }
harkonnen.Build(toBuild, function(unit) Harkonnen.Build(toBuild, function(unit)
IdlingUnits[harkonnen][#IdlingUnits[harkonnen] + 1] = unit[1] IdlingUnits[Harkonnen][#IdlingUnits[Harkonnen] + 1] = unit[1]
Trigger.AfterDelay(delay, ProduceInfantry) Trigger.AfterDelay(delay, ProduceInfantry)
if #IdlingUnits[harkonnen] >= (AttackGroupSize[Difficulty] * 2.5) then if #IdlingUnits[Harkonnen] >= (AttackGroupSize[Difficulty] * 2.5) then
SendAttack(harkonnen, AttackGroupSize[Difficulty]) SendAttack(Harkonnen, AttackGroupSize[Difficulty])
end end
end) end)
end end
ActivateAI = function() ActivateAI = function()
harkonnen.Cash = 15000 Harkonnen.Cash = 15000
LastHarvesterEaten[harkonnen] = true LastHarvesterEaten[Harkonnen] = true
InitAIUnits() InitAIUnits()
local delay = function() return Utils.RandomInteger(AttackDelays[Difficulty][1], AttackDelays[Difficulty][2] + 1) end local delay = function() return Utils.RandomInteger(AttackDelays[Difficulty][1], AttackDelays[Difficulty][2] + 1) end
@@ -72,6 +72,6 @@ ActivateAI = function()
local attackThresholdSize = AttackGroupSize[Difficulty] * 2.5 local attackThresholdSize = AttackGroupSize[Difficulty] * 2.5
ProduceInfantry() ProduceInfantry()
ProduceUnits(harkonnen, HarkonnenLightFactory, delay, vehilcesToBuild, AttackGroupSize[Difficulty], attackThresholdSize) ProduceUnits(Harkonnen, HarkonnenLightFactory, delay, vehilcesToBuild, AttackGroupSize[Difficulty], attackThresholdSize)
ProduceUnits(harkonnen, HarkonnenHeavyFactory, delay, tanksToBuild, AttackGroupSize[Difficulty], attackThresholdSize) ProduceUnits(Harkonnen, HarkonnenHeavyFactory, delay, tanksToBuild, AttackGroupSize[Difficulty], attackThresholdSize)
end end

View File

@@ -148,17 +148,17 @@ ContrabandTimes =
hard = DateTime.Minutes(2) + DateTime.Seconds(30) hard = DateTime.Minutes(2) + DateTime.Seconds(30)
} }
wave = 0 Wave = 0
SendHarkonnen = function() SendHarkonnen = function()
Trigger.AfterDelay(HarkonnenAttackDelay[Difficulty], function() Trigger.AfterDelay(HarkonnenAttackDelay[Difficulty], function()
if player.IsObjectiveCompleted(KillHarkonnen) then if Atreides.IsObjectiveCompleted(KillHarkonnen) then
return return
end end
wave = wave + 1 Wave = Wave + 1
if InfantryReinforcements and wave % 4 == 0 then if InfantryReinforcements and Wave % 4 == 0 then
local inf = Reinforcements.Reinforce(harkonnen, HarkonnenInfantryReinforcements[Difficulty][wave/4], InfantryPath) local inf = Reinforcements.Reinforce(Harkonnen, HarkonnenInfantryReinforcements[Difficulty][Wave/4], InfantryPath)
Utils.Do(inf, function(unit) Utils.Do(inf, function(unit)
unit.AttackMove(HarkonnenAttackLocation) unit.AttackMove(HarkonnenAttackLocation)
IdleHunt(unit) IdleHunt(unit)
@@ -166,13 +166,13 @@ SendHarkonnen = function()
end end
local entryPath = Utils.Random(HarkonnenPaths) local entryPath = Utils.Random(HarkonnenPaths)
local units = Reinforcements.ReinforceWithTransport(harkonnen, "carryall.reinforce", HarkonnenReinforcements[Difficulty][wave], entryPath, { entryPath[1] })[2] local units = Reinforcements.ReinforceWithTransport(Harkonnen, "carryall.reinforce", HarkonnenReinforcements[Difficulty][Wave], entryPath, { entryPath[1] })[2]
Utils.Do(units, function(unit) Utils.Do(units, function(unit)
unit.AttackMove(HarkonnenAttackLocation) unit.AttackMove(HarkonnenAttackLocation)
IdleHunt(unit) IdleHunt(unit)
end) end)
if wave < HarkonnenAttackWaves[Difficulty] then if Wave < HarkonnenAttackWaves[Difficulty] then
SendHarkonnen() SendHarkonnen()
return return
end end
@@ -181,21 +181,21 @@ SendHarkonnen = function()
end) end)
end end
mercWave = 0 MercWave = 0
SendMercenaries = function() SendMercenaries = function()
Trigger.AfterDelay(MercenaryAttackDelay[Difficulty], function() Trigger.AfterDelay(MercenaryAttackDelay[Difficulty], function()
mercWave = mercWave + 1 MercWave = MercWave + 1
Media.DisplayMessage(UserInterface.Translate("incoming-mercenary-force"), Mentat) Media.DisplayMessage(UserInterface.Translate("incoming-mercenary-force"), Mentat)
local units = Reinforcements.Reinforce(mercenary, MercenaryReinforcements[Difficulty][mercWave], MercenarySpawn) local units = Reinforcements.Reinforce(Mercenary, MercenaryReinforcements[Difficulty][MercWave], MercenarySpawn)
Utils.Do(units, function(unit) Utils.Do(units, function(unit)
unit.AttackMove(MercenaryAttackLocation1) unit.AttackMove(MercenaryAttackLocation1)
unit.AttackMove(MercenaryAttackLocation2) unit.AttackMove(MercenaryAttackLocation2)
IdleHunt(unit) IdleHunt(unit)
end) end)
if mercWave < MercenaryAttackWaves[Difficulty] then if MercWave < MercenaryAttackWaves[Difficulty] then
SendMercenaries() SendMercenaries()
return return
end end
@@ -206,21 +206,21 @@ end
SendContraband = function(owner) SendContraband = function(owner)
ContrabandArrived = true ContrabandArrived = true
UserInterface.SetMissionText(UserInterface.Translate("contraband-has-arrived"), player.Color) UserInterface.SetMissionText(UserInterface.Translate("contraband-has-arrived"), Atreides.Color)
local units = SmugglerReinforcements local units = SmugglerReinforcements
if owner == player then if owner == Atreides then
units = ContrabandReinforcements units = ContrabandReinforcements
end end
Reinforcements.ReinforceWithTransport(owner, "frigate", units, { ContrabandEntry.Location, Starport.Location + CVec.New(1, 1) }, { ContrabandExit.Location }) Reinforcements.ReinforceWithTransport(owner, "frigate", units, { ContrabandEntry.Location, Starport.Location + CVec.New(1, 1) }, { ContrabandExit.Location })
Trigger.AfterDelay(DateTime.Seconds(3), function() Trigger.AfterDelay(DateTime.Seconds(3), function()
if owner == player then if owner == Atreides then
player.MarkCompletedObjective(CaptureStarport) Atreides.MarkCompletedObjective(CaptureStarport)
Media.DisplayMessage(UserInterface.Translate("contraband-confiscated"), Mentat) Media.DisplayMessage(UserInterface.Translate("contraband-confiscated"), Mentat)
else else
player.MarkFailedObjective(CaptureStarport) Atreides.MarkFailedObjective(CaptureStarport)
Media.DisplayMessage(UserInterface.Translate("contraband-not-confiscated"), Mentat) Media.DisplayMessage(UserInterface.Translate("contraband-not-confiscated"), Mentat)
end end
end) end)
@@ -232,13 +232,13 @@ end
SmugglersAttack = function() SmugglersAttack = function()
Utils.Do(SmugglerBase, function(building) Utils.Do(SmugglerBase, function(building)
if not building.IsDead and building.Owner == smuggler then if not building.IsDead and building.Owner == Smuggler then
building.Sell() building.Sell()
end end
end) end)
Trigger.AfterDelay(DateTime.Seconds(1), function() Trigger.AfterDelay(DateTime.Seconds(1), function()
Utils.Do(smuggler.GetGroundAttackers(), function(unit) Utils.Do(Smuggler.GetGroundAttackers(), function(unit)
IdleHunt(unit) IdleHunt(unit)
end) end)
end) end)
@@ -246,26 +246,26 @@ end
AttackNotifier = 0 AttackNotifier = 0
Tick = function() Tick = function()
if player.HasNoRequiredUnits() then if Atreides.HasNoRequiredUnits() then
harkonnen.MarkCompletedObjective(KillAtreides) Harkonnen.MarkCompletedObjective(KillAtreides)
end end
if LastHarkonnenArrived and not player.IsObjectiveCompleted(KillHarkonnen) and harkonnen.HasNoRequiredUnits() then if LastHarkonnenArrived and not Atreides.IsObjectiveCompleted(KillHarkonnen) and Harkonnen.HasNoRequiredUnits() then
Media.DisplayMessage(UserInterface.Translate("atreides-05"), Mentat) Media.DisplayMessage(UserInterface.Translate("atreides-05"), Mentat)
player.MarkCompletedObjective(KillHarkonnen) Atreides.MarkCompletedObjective(KillHarkonnen)
end end
if LastMercenariesArrived and not player.IsObjectiveCompleted(KillSmuggler) and smuggler.HasNoRequiredUnits() and mercenary.HasNoRequiredUnits() then if LastMercenariesArrived and not Atreides.IsObjectiveCompleted(KillSmuggler) and Smuggler.HasNoRequiredUnits() and Mercenary.HasNoRequiredUnits() then
Media.DisplayMessage(UserInterface.Translate("smugglers-annihilated"), Mentat) Media.DisplayMessage(UserInterface.Translate("smugglers-annihilated"), Mentat)
player.MarkCompletedObjective(KillSmuggler) Atreides.MarkCompletedObjective(KillSmuggler)
end end
if LastHarvesterEaten[harkonnen] and DateTime.GameTime % DateTime.Seconds(10) == 0 then if LastHarvesterEaten[Harkonnen] and DateTime.GameTime % DateTime.Seconds(10) == 0 then
local units = harkonnen.GetActorsByType("harvester") local units = Harkonnen.GetActorsByType("harvester")
if #units > 0 then if #units > 0 then
LastHarvesterEaten[harkonnen] = false LastHarvesterEaten[Harkonnen] = false
ProtectHarvester(units[1], harkonnen, AttackGroupSize[Difficulty]) ProtectHarvester(units[1], Harkonnen, AttackGroupSize[Difficulty])
end end
end end
@@ -275,28 +275,28 @@ Tick = function()
TimerTicks = TimerTicks - 1 TimerTicks = TimerTicks - 1
if (TimerTicks % DateTime.Seconds(1)) == 0 then if (TimerTicks % DateTime.Seconds(1)) == 0 then
local contrabandArrivesIn = UserInterface.Translate("contraband-arrives-in", { ["time"] = Utils.FormatTime(TimerTicks)}) local contrabandArrivesIn = UserInterface.Translate("contraband-arrives-in", { ["time"] = Utils.FormatTime(TimerTicks)})
UserInterface.SetMissionText(contrabandArrivesIn, player.Color) UserInterface.SetMissionText(contrabandArrivesIn, Atreides.Color)
end end
if TimerTicks <= 0 then if TimerTicks <= 0 then
SendContraband(smuggler) SendContraband(Smuggler)
end end
end end
end end
WorldLoaded = function() WorldLoaded = function()
harkonnen = Player.GetPlayer("Harkonnen") Harkonnen = Player.GetPlayer("Harkonnen")
smuggler = Player.GetPlayer("Smugglers") Smuggler = Player.GetPlayer("Smugglers")
mercenary = Player.GetPlayer("Mercenaries") Mercenary = Player.GetPlayer("Mercenaries")
player = Player.GetPlayer("Atreides") Atreides = Player.GetPlayer("Atreides")
InfantryReinforcements = Difficulty ~= "easy" InfantryReinforcements = Difficulty ~= "easy"
InitObjectives(player) InitObjectives(Atreides)
KillAtreides = AddPrimaryObjective(harkonnen, "") KillAtreides = AddPrimaryObjective(Harkonnen, "")
CaptureBarracks = AddPrimaryObjective(player, "capture-barracks-sietch-tabr") CaptureBarracks = AddPrimaryObjective(Atreides, "capture-barracks-sietch-tabr")
KillHarkonnen = AddSecondaryObjective(player, "annihilate-harkonnen-units-reinforcements") KillHarkonnen = AddSecondaryObjective(Atreides, "annihilate-harkonnen-units-reinforcements")
CaptureStarport = AddSecondaryObjective(player, "capture-smuggler-starport-confiscate-contraband") CaptureStarport = AddSecondaryObjective(Atreides, "capture-smuggler-starport-confiscate-contraband")
Camera.Position = ARefinery.CenterPosition Camera.Position = ARefinery.CenterPosition
HarkonnenAttackLocation = AtreidesRally.Location HarkonnenAttackLocation = AtreidesRally.Location
@@ -311,14 +311,14 @@ WorldLoaded = function()
end) end)
Trigger.OnAllKilledOrCaptured(HarkonnenBase, function() Trigger.OnAllKilledOrCaptured(HarkonnenBase, function()
Utils.Do(harkonnen.GetGroundAttackers(), IdleHunt) Utils.Do(Harkonnen.GetGroundAttackers(), IdleHunt)
end) end)
Trigger.OnKilled(Starport, function() Trigger.OnKilled(Starport, function()
if not player.IsObjectiveCompleted(CaptureStarport) then if not Atreides.IsObjectiveCompleted(CaptureStarport) then
ContrabandArrived = true ContrabandArrived = true
UserInterface.SetMissionText(UserInterface.Translate("starport-destroyed-no-contraband"), player.Color) UserInterface.SetMissionText(UserInterface.Translate("starport-destroyed-no-contraband"), Atreides.Color)
player.MarkFailedObjective(CaptureStarport) Atreides.MarkFailedObjective(CaptureStarport)
SmugglersAttack() SmugglersAttack()
Trigger.AfterDelay(DateTime.Seconds(15), function() Trigger.AfterDelay(DateTime.Seconds(15), function()
@@ -327,11 +327,11 @@ WorldLoaded = function()
end end
if DefendStarport then if DefendStarport then
player.MarkFailedObjective(DefendStarport) Atreides.MarkFailedObjective(DefendStarport)
end end
end) end)
Trigger.OnDamaged(Starport, function() Trigger.OnDamaged(Starport, function()
if Starport.Owner ~= smuggler then if Starport.Owner ~= Smuggler then
return return
end end
@@ -339,7 +339,7 @@ WorldLoaded = function()
AttackNotifier = DateTime.Seconds(10) AttackNotifier = DateTime.Seconds(10)
Media.DisplayMessage(UserInterface.Translate("do-not-destroy-starport"), Mentat) Media.DisplayMessage(UserInterface.Translate("do-not-destroy-starport"), Mentat)
local defenders = smuggler.GetGroundAttackers() local defenders = Smuggler.GetGroundAttackers()
if #defenders > 0 then if #defenders > 0 then
Utils.Do(defenders, function(unit) Utils.Do(defenders, function(unit)
unit.Guard(Starport) unit.Guard(Starport)
@@ -348,23 +348,23 @@ WorldLoaded = function()
end end
end) end)
Trigger.OnCapture(Starport, function() Trigger.OnCapture(Starport, function()
DefendStarport = AddSecondaryObjective(player, "defend-captured-starport") DefendStarport = AddSecondaryObjective(Atreides, "defend-captured-starport")
Trigger.ClearAll(Starport) Trigger.ClearAll(Starport)
Trigger.AfterDelay(0, function() Trigger.AfterDelay(0, function()
Trigger.OnRemovedFromWorld(Starport, function() Trigger.OnRemovedFromWorld(Starport, function()
player.MarkFailedObjective(DefendStarport) Atreides.MarkFailedObjective(DefendStarport)
end) end)
end) end)
if not ContrabandArrived then if not ContrabandArrived then
SendContraband(player) SendContraband(Atreides)
end end
SmugglersAttack() SmugglersAttack()
end) end)
Trigger.OnKilled(HarkonnenBarracks, function() Trigger.OnKilled(HarkonnenBarracks, function()
player.MarkFailedObjective(CaptureBarracks) Atreides.MarkFailedObjective(CaptureBarracks)
end) end)
Trigger.OnDamaged(HarkonnenBarracks, function() Trigger.OnDamaged(HarkonnenBarracks, function()
if AttackNotifier <= 0 and HarkonnenBarracks.Health < HarkonnenBarracks.MaxHealth * 3/4 then if AttackNotifier <= 0 and HarkonnenBarracks.Health < HarkonnenBarracks.MaxHealth * 3/4 then
@@ -376,52 +376,52 @@ WorldLoaded = function()
Media.DisplayMessage(UserInterface.Translate("hostages-released"), Mentat) Media.DisplayMessage(UserInterface.Translate("hostages-released"), Mentat)
if DefendStarport then if DefendStarport then
player.MarkCompletedObjective(DefendStarport) Atreides.MarkCompletedObjective(DefendStarport)
end end
Trigger.AfterDelay(DateTime.Seconds(3), function() Trigger.AfterDelay(DateTime.Seconds(3), function()
player.MarkCompletedObjective(CaptureBarracks) Atreides.MarkCompletedObjective(CaptureBarracks)
end) end)
end) end)
SendHarkonnen() SendHarkonnen()
Actor.Create("upgrade.barracks", true, { Owner = harkonnen }) Actor.Create("upgrade.barracks", true, { Owner = Harkonnen })
Actor.Create("upgrade.light", true, { Owner = harkonnen }) Actor.Create("upgrade.light", true, { Owner = Harkonnen })
Actor.Create("upgrade.heavy", true, { Owner = harkonnen }) Actor.Create("upgrade.heavy", true, { Owner = Harkonnen })
Trigger.AfterDelay(0, ActivateAI) Trigger.AfterDelay(0, ActivateAI)
Trigger.AfterDelay(DateTime.Minutes(1), function() Trigger.AfterDelay(DateTime.Minutes(1), function()
Media.PlaySpeechNotification(player, "Reinforce") Media.PlaySpeechNotification(Atreides, "Reinforce")
Reinforcements.ReinforceWithTransport(player, "carryall.reinforce", AtreidesReinforcements, AtreidesPath, { AtreidesPath[1] }) Reinforcements.ReinforceWithTransport(Atreides, "carryall.reinforce", AtreidesReinforcements, AtreidesPath, { AtreidesPath[1] })
end) end)
local smugglerWaypoint = SmugglerWaypoint1.Location local smugglerWaypoint = SmugglerWaypoint1.Location
Trigger.OnEnteredFootprint({ smugglerWaypoint + CVec.New(-2, 0), smugglerWaypoint + CVec.New(-1, 0), smugglerWaypoint, smugglerWaypoint + CVec.New(1, -1), smugglerWaypoint + CVec.New(2, -1), SmugglerWaypoint3.Location }, function(a, id) Trigger.OnEnteredFootprint({ smugglerWaypoint + CVec.New(-2, 0), smugglerWaypoint + CVec.New(-1, 0), smugglerWaypoint, smugglerWaypoint + CVec.New(1, -1), smugglerWaypoint + CVec.New(2, -1), SmugglerWaypoint3.Location }, function(a, id)
if not warned and a.Owner == player and a.Type ~= "carryall" then if not Warned and a.Owner == Atreides and a.Type ~= "carryall" then
warned = true Warned = true
Trigger.RemoveFootprintTrigger(id) Trigger.RemoveFootprintTrigger(id)
Media.DisplayMessage(UserInterface.Translate("stay-away-from-starport"), UserInterface.Translate("smuggler-leader")) Media.DisplayMessage(UserInterface.Translate("stay-away-from-starport"), UserInterface.Translate("smuggler-leader"))
end end
end) end)
Trigger.OnEnteredFootprint({ SmugglerWaypoint2.Location }, function(a, id) Trigger.OnEnteredFootprint({ SmugglerWaypoint2.Location }, function(a, id)
if not paid and a.Owner == player and a.Type ~= "carryall" then if not Paid and a.Owner == Atreides and a.Type ~= "carryall" then
paid = true Paid = true
Trigger.RemoveFootprintTrigger(id) Trigger.RemoveFootprintTrigger(id)
Media.DisplayMessage(UserInterface.Translate("were-warned-will-pay"), UserInterface.Translate("smuggler-leader")) Media.DisplayMessage(UserInterface.Translate("were-warned-will-pay"), UserInterface.Translate("smuggler-leader"))
Utils.Do(smuggler.GetGroundAttackers(), function(unit) Utils.Do(Smuggler.GetGroundAttackers(), function(unit)
unit.AttackMove(SmugglerWaypoint2.Location) unit.AttackMove(SmugglerWaypoint2.Location)
end) end)
Trigger.AfterDelay(DateTime.Seconds(3), function() Trigger.AfterDelay(DateTime.Seconds(3), function()
KillSmuggler = AddSecondaryObjective(player, "destroy-smugglers-mercenaries") KillSmuggler = AddSecondaryObjective(Atreides, "destroy-smugglers-mercenaries")
SendMercenaries() SendMercenaries()
end) end)
end end
end) end)
Trigger.OnEnteredProximityTrigger(HarkonnenBarracks.CenterPosition, WDist.New(5 * 1024), function(a, id) Trigger.OnEnteredProximityTrigger(HarkonnenBarracks.CenterPosition, WDist.New(5 * 1024), function(a, id)
if a.Owner == player and a.Type ~= "carryall" then if a.Owner == Atreides and a.Type ~= "carryall" then
Trigger.RemoveProximityTrigger(id) Trigger.RemoveProximityTrigger(id)
Media.DisplayMessage(UserInterface.Translate("capture-harkonnen-barracks-release-hostages"), Mentat) Media.DisplayMessage(UserInterface.Translate("capture-harkonnen-barracks-release-hostages"), Mentat)
StopInfantryProduction = true StopInfantryProduction = true

View File

@@ -61,16 +61,16 @@ Messages =
CachedResources = -1 CachedResources = -1
Tick = function() Tick = function()
if AtreidesArrived and atreides.HasNoRequiredUnits() then if AtreidesArrived and Atreides.HasNoRequiredUnits() then
player.MarkCompletedObjective(KillAtreides) Harkonnen.MarkCompletedObjective(KillAtreides)
end end
if player.Resources > SpiceToHarvest - 1 then if Harkonnen.Resources > SpiceToHarvest - 1 then
player.MarkCompletedObjective(GatherSpice) Harkonnen.MarkCompletedObjective(GatherSpice)
end end
-- player has no Wind Trap -- player has no Wind Trap
if (player.PowerProvided <= 20 or player.PowerState ~= "Normal") and DateTime.GameTime % DateTime.Seconds(32) == 0 then if (Harkonnen.PowerProvided <= 20 or Harkonnen.PowerState ~= "Normal") and DateTime.GameTime % DateTime.Seconds(32) == 0 then
HasPower = false HasPower = false
Media.DisplayMessage(Messages[2], Mentat) Media.DisplayMessage(Messages[2], Mentat)
else else
@@ -78,40 +78,40 @@ Tick = function()
end end
-- player has no Refinery and no Silos -- player has no Refinery and no Silos
if HasPower and player.ResourceCapacity == 0 and DateTime.GameTime % DateTime.Seconds(32) == 0 then if HasPower and Harkonnen.ResourceCapacity == 0 and DateTime.GameTime % DateTime.Seconds(32) == 0 then
Media.DisplayMessage(Messages[3], Mentat) Media.DisplayMessage(Messages[3], Mentat)
end end
if HasPower and player.Resources > player.ResourceCapacity * 0.8 and DateTime.GameTime % DateTime.Seconds(32) == 0 then if HasPower and Harkonnen.Resources > Harkonnen.ResourceCapacity * 0.8 and DateTime.GameTime % DateTime.Seconds(32) == 0 then
Media.DisplayMessage(Messages[4], Mentat) Media.DisplayMessage(Messages[4], Mentat)
end end
if player.Resources ~= CachedResources then if Harkonnen.Resources ~= CachedResources then
local parameters = { ["harvested"] = player.Resources, ["goal"] = SpiceToHarvest } local parameters = { ["harvested"] = Harkonnen.Resources, ["goal"] = SpiceToHarvest }
local harvestedResources = UserInterface.Translate("harvested-resources", parameters) local harvestedResources = UserInterface.Translate("harvested-resources", parameters)
UserInterface.SetMissionText(harvestedResources) UserInterface.SetMissionText(harvestedResources)
CachedResources = player.Resources CachedResources = Harkonnen.Resources
end end
end end
WorldLoaded = function() WorldLoaded = function()
player = Player.GetPlayer("Harkonnen") Harkonnen = Player.GetPlayer("Harkonnen")
atreides = Player.GetPlayer("Atreides") Atreides = Player.GetPlayer("Atreides")
SpiceToHarvest = ToHarvest[Difficulty] SpiceToHarvest = ToHarvest[Difficulty]
InitObjectives(player) InitObjectives(Harkonnen)
KillHarkonnen = AddPrimaryObjective(atreides, "") KillHarkonnen = AddPrimaryObjective(Atreides, "")
local harvestSpice = UserInterface.Translate("harvest-spice", { ["spice"] = SpiceToHarvest }) local harvestSpice = UserInterface.Translate("harvest-spice", { ["spice"] = SpiceToHarvest })
GatherSpice = AddPrimaryObjective(player, harvestSpice) GatherSpice = AddPrimaryObjective(Harkonnen, harvestSpice)
KillAtreides = AddSecondaryObjective(player, "eliminate-atreides-units-reinforcements") KillAtreides = AddSecondaryObjective(Harkonnen, "eliminate-atreides-units-reinforcements")
local checkResourceCapacity = function() local checkResourceCapacity = function()
Trigger.AfterDelay(0, function() Trigger.AfterDelay(0, function()
if player.ResourceCapacity < SpiceToHarvest then if Harkonnen.ResourceCapacity < SpiceToHarvest then
Media.DisplayMessage(UserInterface.Translate("not-enough-silos"), Mentat) Media.DisplayMessage(UserInterface.Translate("not-enough-silos"), Mentat)
Trigger.AfterDelay(DateTime.Seconds(3), function() Trigger.AfterDelay(DateTime.Seconds(3), function()
harkonnen.MarkCompletedObjective(KillAtreides) Harkonnen.MarkCompletedObjective(KillAtreides)
end) end)
return true return true
@@ -126,16 +126,16 @@ WorldLoaded = function()
return return
end end
local refs = Utils.Where(Map.ActorsInWorld, function(actor) return actor.Type == "refinery" and actor.Owner == player end) local refs = Utils.Where(Map.ActorsInWorld, function(actor) return actor.Type == "refinery" and actor.Owner == Harkonnen end)
if #refs == 0 then if #refs == 0 then
atreides.MarkCompletedObjective(KillHarkonnen) Atreides.MarkCompletedObjective(KillHarkonnen)
else else
Trigger.OnAllRemovedFromWorld(refs, function() Trigger.OnAllRemovedFromWorld(refs, function()
atreides.MarkCompletedObjective(KillHarkonnen) Atreides.MarkCompletedObjective(KillHarkonnen)
end) end)
local silos = Utils.Where(Map.ActorsInWorld, function(actor) return actor.Type == "silo" and actor.Owner == player end) local silos = Utils.Where(Map.ActorsInWorld, function(actor) return actor.Type == "silo" and actor.Owner == Harkonnen end)
Utils.Do(refs, function(actor) Trigger.OnRemovedFromWorld(actor, checkResourceCapacity) end) Utils.Do(refs, function(actor) Trigger.OnRemovedFromWorld(actor, checkResourceCapacity) end)
Utils.Do(silos, function(actor) Trigger.OnRemovedFromWorld(actor, checkResourceCapacity) end) Utils.Do(silos, function(actor) Trigger.OnRemovedFromWorld(actor, checkResourceCapacity) end)
end end
@@ -144,8 +144,8 @@ WorldLoaded = function()
Media.DisplayMessage(Messages[1], Mentat) Media.DisplayMessage(Messages[1], Mentat)
Trigger.AfterDelay(DateTime.Seconds(25), function() Trigger.AfterDelay(DateTime.Seconds(25), function()
Media.PlaySpeechNotification(player, "Reinforce") Media.PlaySpeechNotification(Harkonnen, "Reinforce")
Reinforcements.Reinforce(player, HarkonnenReinforcements, HarkonnenEntryPath) Reinforcements.Reinforce(Harkonnen, HarkonnenReinforcements, HarkonnenEntryPath)
end) end)
WavesLeft = AtreidesAttackWaves[Difficulty] WavesLeft = AtreidesAttackWaves[Difficulty]
@@ -159,7 +159,7 @@ SendReinforcements = function()
if AtreidesAttackDelay < 0 then AtreidesAttackDelay = 0 end if AtreidesAttackDelay < 0 then AtreidesAttackDelay = 0 end
Trigger.AfterDelay(delay, function() Trigger.AfterDelay(delay, function()
Reinforcements.Reinforce(atreides, Utils.Random(units), { Utils.Random(AtreidesEntryWaypoints) }, 10, IdleHunt) Reinforcements.Reinforce(Atreides, Utils.Random(units), { Utils.Random(AtreidesEntryWaypoints) }, 10, IdleHunt)
WavesLeft = WavesLeft - 1 WavesLeft = WavesLeft - 1
if WavesLeft == 0 then if WavesLeft == 0 then

View File

@@ -61,16 +61,16 @@ Messages =
CachedResources = -1 CachedResources = -1
Tick = function() Tick = function()
if AtreidesArrived and atreides.HasNoRequiredUnits() then if AtreidesArrived and Atreides.HasNoRequiredUnits() then
player.MarkCompletedObjective(KillAtreides) Harkonnen.MarkCompletedObjective(KillAtreides)
end end
if player.Resources > SpiceToHarvest - 1 then if Harkonnen.Resources > SpiceToHarvest - 1 then
player.MarkCompletedObjective(GatherSpice) Harkonnen.MarkCompletedObjective(GatherSpice)
end end
-- player has no Wind Trap -- player has no Wind Trap
if (player.PowerProvided <= 20 or player.PowerState ~= "Normal") and DateTime.GameTime % DateTime.Seconds(32) == 0 then if (Harkonnen.PowerProvided <= 20 or Harkonnen.PowerState ~= "Normal") and DateTime.GameTime % DateTime.Seconds(32) == 0 then
HasPower = false HasPower = false
Media.DisplayMessage(Messages[2], Mentat) Media.DisplayMessage(Messages[2], Mentat)
else else
@@ -78,40 +78,40 @@ Tick = function()
end end
-- player has no Refinery and no Silos -- player has no Refinery and no Silos
if HasPower and player.ResourceCapacity == 0 and DateTime.GameTime % DateTime.Seconds(32) == 0 then if HasPower and Harkonnen.ResourceCapacity == 0 and DateTime.GameTime % DateTime.Seconds(32) == 0 then
Media.DisplayMessage(Messages[3], Mentat) Media.DisplayMessage(Messages[3], Mentat)
end end
if HasPower and player.Resources > player.ResourceCapacity * 0.8 and DateTime.GameTime % DateTime.Seconds(32) == 0 then if HasPower and Harkonnen.Resources > Harkonnen.ResourceCapacity * 0.8 and DateTime.GameTime % DateTime.Seconds(32) == 0 then
Media.DisplayMessage(Messages[4], Mentat) Media.DisplayMessage(Messages[4], Mentat)
end end
if player.Resources ~= CachedResources then if Harkonnen.Resources ~= CachedResources then
local parameters = { ["harvested"] = player.Resources, ["goal"] = SpiceToHarvest } local parameters = { ["harvested"] = Harkonnen.Resources, ["goal"] = SpiceToHarvest }
local harvestedResources = UserInterface.Translate("harvested-resources", parameters) local harvestedResources = UserInterface.Translate("harvested-resources", parameters)
UserInterface.SetMissionText(harvestedResources) UserInterface.SetMissionText(harvestedResources)
CachedResources = player.Resources CachedResources = Harkonnen.Resources
end end
end end
WorldLoaded = function() WorldLoaded = function()
player = Player.GetPlayer("Harkonnen") Harkonnen = Player.GetPlayer("Harkonnen")
atreides = Player.GetPlayer("Atreides") Atreides = Player.GetPlayer("Atreides")
SpiceToHarvest = ToHarvest[Difficulty] SpiceToHarvest = ToHarvest[Difficulty]
InitObjectives(player) InitObjectives(Harkonnen)
KillHarkonnen = AddPrimaryObjective(atreides, "") KillHarkonnen = AddPrimaryObjective(Atreides, "")
local harvestSpice = UserInterface.Translate("harvest-spice", { ["spice"] = SpiceToHarvest }) local harvestSpice = UserInterface.Translate("harvest-spice", { ["spice"] = SpiceToHarvest })
GatherSpice = AddPrimaryObjective(player, harvestSpice) GatherSpice = AddPrimaryObjective(Harkonnen, harvestSpice)
KillAtreides = AddSecondaryObjective(player, "eliminate-atreides-units-reinforcements") KillAtreides = AddSecondaryObjective(Harkonnen, "eliminate-atreides-units-reinforcements")
local checkResourceCapacity = function() local checkResourceCapacity = function()
Trigger.AfterDelay(0, function() Trigger.AfterDelay(0, function()
if player.ResourceCapacity < SpiceToHarvest then if Harkonnen.ResourceCapacity < SpiceToHarvest then
Media.DisplayMessage(UserInterface.Translate("not-enough-silos"), Mentat) Media.DisplayMessage(UserInterface.Translate("not-enough-silos"), Mentat)
Trigger.AfterDelay(DateTime.Seconds(3), function() Trigger.AfterDelay(DateTime.Seconds(3), function()
harkonnen.MarkCompletedObjective(KillAtreides) Harkonnen.MarkCompletedObjective(KillAtreides)
end) end)
return true return true
@@ -126,16 +126,16 @@ WorldLoaded = function()
return return
end end
local refs = Utils.Where(Map.ActorsInWorld, function(actor) return actor.Type == "refinery" and actor.Owner == player end) local refs = Utils.Where(Map.ActorsInWorld, function(actor) return actor.Type == "refinery" and actor.Owner == Harkonnen end)
if #refs == 0 then if #refs == 0 then
atreides.MarkCompletedObjective(KillHarkonnen) Atreides.MarkCompletedObjective(KillHarkonnen)
else else
Trigger.OnAllRemovedFromWorld(refs, function() Trigger.OnAllRemovedFromWorld(refs, function()
atreides.MarkCompletedObjective(KillHarkonnen) Atreides.MarkCompletedObjective(KillHarkonnen)
end) end)
local silos = Utils.Where(Map.ActorsInWorld, function(actor) return actor.Type == "silo" and actor.Owner == player end) local silos = Utils.Where(Map.ActorsInWorld, function(actor) return actor.Type == "silo" and actor.Owner == Harkonnen end)
Utils.Do(refs, function(actor) Trigger.OnRemovedFromWorld(actor, checkResourceCapacity) end) Utils.Do(refs, function(actor) Trigger.OnRemovedFromWorld(actor, checkResourceCapacity) end)
Utils.Do(silos, function(actor) Trigger.OnRemovedFromWorld(actor, checkResourceCapacity) end) Utils.Do(silos, function(actor) Trigger.OnRemovedFromWorld(actor, checkResourceCapacity) end)
end end
@@ -144,8 +144,8 @@ WorldLoaded = function()
Media.DisplayMessage(Messages[1], Mentat) Media.DisplayMessage(Messages[1], Mentat)
Trigger.AfterDelay(DateTime.Seconds(25), function() Trigger.AfterDelay(DateTime.Seconds(25), function()
Media.PlaySpeechNotification(player, "Reinforce") Media.PlaySpeechNotification(Harkonnen, "Reinforce")
Reinforcements.Reinforce(player, HarkonnenReinforcements, HarkonnenEntryPath) Reinforcements.Reinforce(Harkonnen, HarkonnenReinforcements, HarkonnenEntryPath)
end) end)
WavesLeft = AtreidesAttackWaves[Difficulty] WavesLeft = AtreidesAttackWaves[Difficulty]
@@ -159,7 +159,7 @@ SendReinforcements = function()
if AtreidesAttackDelay < 0 then AtreidesAttackDelay = 0 end if AtreidesAttackDelay < 0 then AtreidesAttackDelay = 0 end
Trigger.AfterDelay(delay, function() Trigger.AfterDelay(delay, function()
Reinforcements.Reinforce(atreides, Utils.Random(units), { Utils.Random(AtreidesEntryWaypoints) }, 10, IdleHunt) Reinforcements.Reinforce(Atreides, Utils.Random(units), { Utils.Random(AtreidesEntryWaypoints) }, 10, IdleHunt)
WavesLeft = WavesLeft - 1 WavesLeft = WavesLeft - 1
if WavesLeft == 0 then if WavesLeft == 0 then

View File

@@ -24,11 +24,11 @@ AttackDelays =
AtreidesInfantryTypes = { "light_inf" } AtreidesInfantryTypes = { "light_inf" }
ActivateAI = function() ActivateAI = function()
IdlingUnits[atreides] = { } IdlingUnits[Atreides] = { }
local delay = function() return Utils.RandomInteger(AttackDelays[Difficulty][1], AttackDelays[Difficulty][2] + 1) end local delay = function() return Utils.RandomInteger(AttackDelays[Difficulty][1], AttackDelays[Difficulty][2] + 1) end
local toBuild = function() return AtreidesInfantryTypes end local toBuild = function() return AtreidesInfantryTypes end
local attackThresholdSize = AttackGroupSize[Difficulty] * 2.5 local attackThresholdSize = AttackGroupSize[Difficulty] * 2.5
DefendAndRepairBase(atreides, AtreidesBase, 0.75, AttackGroupSize[Difficulty]) DefendAndRepairBase(Atreides, AtreidesBase, 0.75, AttackGroupSize[Difficulty])
ProduceUnits(atreides, ABarracks, delay, toBuild, AttackGroupSize[Difficulty], attackThresholdSize) ProduceUnits(Atreides, ABarracks, delay, toBuild, AttackGroupSize[Difficulty], attackThresholdSize)
end end

View File

@@ -65,31 +65,31 @@ AtreidesAttackWaves =
} }
Tick = function() Tick = function()
if player.HasNoRequiredUnits() then if Harkonnen.HasNoRequiredUnits() then
atreides.MarkCompletedObjective(KillHarkonnen) Atreides.MarkCompletedObjective(KillHarkonnen)
end end
if atreides.HasNoRequiredUnits() and not player.IsObjectiveCompleted(KillAtreides) then if Atreides.HasNoRequiredUnits() and not Harkonnen.IsObjectiveCompleted(KillAtreides) then
Media.DisplayMessage(UserInterface.Translate("atreides-annihilated"), Mentat) Media.DisplayMessage(UserInterface.Translate("atreides-annihilated"), Mentat)
player.MarkCompletedObjective(KillAtreides) Harkonnen.MarkCompletedObjective(KillAtreides)
end end
end end
WorldLoaded = function() WorldLoaded = function()
atreides = Player.GetPlayer("Atreides") Atreides = Player.GetPlayer("Atreides")
player = Player.GetPlayer("Harkonnen") Harkonnen = Player.GetPlayer("Harkonnen")
InitObjectives(player) InitObjectives(Harkonnen)
KillHarkonnen = AddPrimaryObjective(atreides, "") KillHarkonnen = AddPrimaryObjective(Atreides, "")
KillAtreides = AddSecondaryObjective(player, "destroy-atreides-forces") KillAtreides = AddSecondaryObjective(Harkonnen, "destroy-atreides-forces")
Camera.Position = HConyard.CenterPosition Camera.Position = HConyard.CenterPosition
Trigger.OnAllKilled(AtreidesBase, function() Trigger.OnAllKilled(AtreidesBase, function()
Utils.Do(atreides.GetGroundAttackers(), IdleHunt) Utils.Do(Atreides.GetGroundAttackers(), IdleHunt)
end) end)
local path = function() return Utils.Random(AtreidesAttackPaths) end local path = function() return Utils.Random(AtreidesAttackPaths) end
SendCarryallReinforcements(atreides, 0, AtreidesAttackWaves[Difficulty], AtreidesAttackDelay[Difficulty], path, AtreidesReinforcements[Difficulty]) SendCarryallReinforcements(Atreides, 0, AtreidesAttackWaves[Difficulty], AtreidesAttackDelay[Difficulty], path, AtreidesReinforcements[Difficulty])
Trigger.AfterDelay(0, ActivateAI) Trigger.AfterDelay(0, ActivateAI)
end end

View File

@@ -25,13 +25,13 @@ AtreidesInfantryTypes = { "light_inf" }
AtreidesVehicleTypes = { "trike" } AtreidesVehicleTypes = { "trike" }
ActivateAI = function() ActivateAI = function()
IdlingUnits[atreides] = { } IdlingUnits[Atreides] = { }
local delay = function() return Utils.RandomInteger(AttackDelays[Difficulty][1], AttackDelays[Difficulty][2] + 1) end local delay = function() return Utils.RandomInteger(AttackDelays[Difficulty][1], AttackDelays[Difficulty][2] + 1) end
local infantryToBuild = function() return AtreidesInfantryTypes end local infantryToBuild = function() return AtreidesInfantryTypes end
local vehilcesToBuild = function() return AtreidesVehicleTypes end local vehilcesToBuild = function() return AtreidesVehicleTypes end
local attackThresholdSize = AttackGroupSize[Difficulty] * 2.5 local attackThresholdSize = AttackGroupSize[Difficulty] * 2.5
DefendAndRepairBase(atreides, AtreidesBase, 0.75, AttackGroupSize[Difficulty]) DefendAndRepairBase(Atreides, AtreidesBase, 0.75, AttackGroupSize[Difficulty])
ProduceUnits(atreides, ABarracks, delay, infantryToBuild, AttackGroupSize[Difficulty], attackThresholdSize) ProduceUnits(Atreides, ABarracks, delay, infantryToBuild, AttackGroupSize[Difficulty], attackThresholdSize)
ProduceUnits(atreides, ALightFactory, delay, vehilcesToBuild, AttackGroupSize[Difficulty], attackThresholdSize) ProduceUnits(Atreides, ALightFactory, delay, vehilcesToBuild, AttackGroupSize[Difficulty], attackThresholdSize)
end end

View File

@@ -65,31 +65,31 @@ AtreidesAttackWaves =
} }
Tick = function() Tick = function()
if player.HasNoRequiredUnits() then if Harkonnen.HasNoRequiredUnits() then
atreides.MarkCompletedObjective(KillHarkonnen) Atreides.MarkCompletedObjective(KillHarkonnen)
end end
if atreides.HasNoRequiredUnits() and not player.IsObjectiveCompleted(KillAtreides) then if Atreides.HasNoRequiredUnits() and not Harkonnen.IsObjectiveCompleted(KillAtreides) then
Media.DisplayMessage(UserInterface.Translate("atreides-annihilated"), Mentat) Media.DisplayMessage(UserInterface.Translate("atreides-annihilated"), Mentat)
player.MarkCompletedObjective(KillAtreides) Harkonnen.MarkCompletedObjective(KillAtreides)
end end
end end
WorldLoaded = function() WorldLoaded = function()
atreides = Player.GetPlayer("Atreides") Atreides = Player.GetPlayer("Atreides")
player = Player.GetPlayer("Harkonnen") Harkonnen = Player.GetPlayer("Harkonnen")
InitObjectives(player) InitObjectives(Harkonnen)
KillHarkonnen = AddPrimaryObjective(atreides, "") KillHarkonnen = AddPrimaryObjective(Atreides, "")
KillAtreides = AddSecondaryObjective(player, "destroy-atreides-forces") KillAtreides = AddSecondaryObjective(Harkonnen, "destroy-atreides-forces")
Camera.Position = HConyard.CenterPosition Camera.Position = HConyard.CenterPosition
Trigger.OnAllKilled(AtreidesBase, function() Trigger.OnAllKilled(AtreidesBase, function()
Utils.Do(atreides.GetGroundAttackers(), IdleHunt) Utils.Do(Atreides.GetGroundAttackers(), IdleHunt)
end) end)
local path = function() return Utils.Random(AtreidesAttackPaths) end local path = function() return Utils.Random(AtreidesAttackPaths) end
SendCarryallReinforcements(atreides, 0, AtreidesAttackWaves[Difficulty], AtreidesAttackDelay[Difficulty], path, AtreidesReinforcements[Difficulty]) SendCarryallReinforcements(Atreides, 0, AtreidesAttackWaves[Difficulty], AtreidesAttackDelay[Difficulty], path, AtreidesReinforcements[Difficulty])
Trigger.AfterDelay(0, ActivateAI) Trigger.AfterDelay(0, ActivateAI)
end end

View File

@@ -25,9 +25,9 @@ AtreidesInfantryTypes = { "light_inf", "light_inf", "light_inf", "trooper", "tro
AtreidesVehicleTypes = { "trike", "trike", "quad" } AtreidesVehicleTypes = { "trike", "trike", "quad" }
ActivateAI = function() ActivateAI = function()
IdlingUnits[atreides] = { } IdlingUnits[Atreides] = { }
LastHarvesterEaten[atreides] = true LastHarvesterEaten[Atreides] = true
DefendAndRepairBase(atreides, AtreidesBase, 0.75, AttackGroupSize[Difficulty]) DefendAndRepairBase(Atreides, AtreidesBase, 0.75, AttackGroupSize[Difficulty])
AConyard.Produce(HarkonnenUpgrades[1]) AConyard.Produce(HarkonnenUpgrades[1])
AConyard.Produce(HarkonnenUpgrades[2]) AConyard.Produce(HarkonnenUpgrades[2])
@@ -39,7 +39,7 @@ ActivateAI = function()
-- Finish the upgrades first before trying to build something -- Finish the upgrades first before trying to build something
Trigger.AfterDelay(DateTime.Seconds(14), function() Trigger.AfterDelay(DateTime.Seconds(14), function()
ProduceUnits(atreides, ABarracks, delay, infantryToBuild, AttackGroupSize[Difficulty], attackThresholdSize) ProduceUnits(Atreides, ABarracks, delay, infantryToBuild, AttackGroupSize[Difficulty], attackThresholdSize)
ProduceUnits(atreides, ALightFactory, delay, vehilcesToBuild, AttackGroupSize[Difficulty], attackThresholdSize) ProduceUnits(Atreides, ALightFactory, delay, vehilcesToBuild, AttackGroupSize[Difficulty], attackThresholdSize)
end) end)
end end

View File

@@ -94,25 +94,25 @@ HarkonnenBaseBuildings = { "barracks", "light_factory" }
HarkonnenUpgrades = { "upgrade.barracks", "upgrade.light" } HarkonnenUpgrades = { "upgrade.barracks", "upgrade.light" }
MessageCheck = function(index) MessageCheck = function(index)
return #player.GetActorsByType(HarkonnenBaseBuildings[index]) > 0 and not player.HasPrerequisites({ HarkonnenUpgrades[index] }) return #Harkonnen.GetActorsByType(HarkonnenBaseBuildings[index]) > 0 and not Harkonnen.HasPrerequisites({ HarkonnenUpgrades[index] })
end end
Tick = function() Tick = function()
if player.HasNoRequiredUnits() then if Harkonnen.HasNoRequiredUnits() then
atreides.MarkCompletedObjective(KillHarkonnen) Atreides.MarkCompletedObjective(KillHarkonnen)
end end
if atreides.HasNoRequiredUnits() and not player.IsObjectiveCompleted(KillAtreides) then if Atreides.HasNoRequiredUnits() and not Harkonnen.IsObjectiveCompleted(KillAtreides) then
Media.DisplayMessage(UserInterface.Translate("atreides-annihilated"), Mentat) Media.DisplayMessage(UserInterface.Translate("atreides-annihilated"), Mentat)
player.MarkCompletedObjective(KillAtreides) Harkonnen.MarkCompletedObjective(KillAtreides)
end end
if DateTime.GameTime % DateTime.Seconds(10) == 0 and LastHarvesterEaten[atreides] then if DateTime.GameTime % DateTime.Seconds(10) == 0 and LastHarvesterEaten[Atreides] then
local units = atreides.GetActorsByType("harvester") local units = Atreides.GetActorsByType("harvester")
if #units > 0 then if #units > 0 then
LastHarvesterEaten[atreides] = false LastHarvesterEaten[Atreides] = false
ProtectHarvester(units[1], atreides, AttackGroupSize[Difficulty]) ProtectHarvester(units[1], Atreides, AttackGroupSize[Difficulty])
end end
end end
@@ -122,31 +122,31 @@ Tick = function()
end end
WorldLoaded = function() WorldLoaded = function()
atreides = Player.GetPlayer("Atreides") Atreides = Player.GetPlayer("Atreides")
player = Player.GetPlayer("Harkonnen") Harkonnen = Player.GetPlayer("Harkonnen")
InitObjectives(player) InitObjectives(Harkonnen)
KillHarkonnen = AddPrimaryObjective(atreides, "") KillHarkonnen = AddPrimaryObjective(Atreides, "")
KillAtreides = AddPrimaryObjective(player, "eliminate-atreides-units-reinforcements") KillAtreides = AddPrimaryObjective(Harkonnen, "eliminate-atreides-units-reinforcements")
Camera.Position = HConyard.CenterPosition Camera.Position = HConyard.CenterPosition
Trigger.OnAllKilled(AtreidesBase, function() Trigger.OnAllKilled(AtreidesBase, function()
Utils.Do(atreides.GetGroundAttackers(), IdleHunt) Utils.Do(Atreides.GetGroundAttackers(), IdleHunt)
end) end)
local path = function() return Utils.Random(AtreidesPaths) end local path = function() return Utils.Random(AtreidesPaths) end
local waveCondition = function() return player.IsObjectiveCompleted(KillAtreides) end local waveCondition = function() return Harkonnen.IsObjectiveCompleted(KillAtreides) end
SendCarryallReinforcements(atreides, 0, AtreidesAttackWaves[Difficulty], AtreidesAttackDelay[Difficulty], path, AtreidesReinforcements[Difficulty], waveCondition) SendCarryallReinforcements(Atreides, 0, AtreidesAttackWaves[Difficulty], AtreidesAttackDelay[Difficulty], path, AtreidesReinforcements[Difficulty], waveCondition)
Trigger.AfterDelay(0, ActivateAI) Trigger.AfterDelay(0, ActivateAI)
Trigger.AfterDelay(DateTime.Minutes(2) + DateTime.Seconds(30), function() Trigger.AfterDelay(DateTime.Minutes(2) + DateTime.Seconds(30), function()
Reinforcements.ReinforceWithTransport(player, "carryall.reinforce", HarkonnenReinforcements, HarkonnenPath, { HarkonnenPath[1] }) Reinforcements.ReinforceWithTransport(Harkonnen, "carryall.reinforce", HarkonnenReinforcements, HarkonnenPath, { HarkonnenPath[1] })
end) end)
TriggerCarryallReinforcements(player, atreides, AtreidesBaseAreaTriggers[1], AtreidesHunters[1], AtreidesHunterPaths[1]) TriggerCarryallReinforcements(Harkonnen, Atreides, AtreidesBaseAreaTriggers[1], AtreidesHunters[1], AtreidesHunterPaths[1])
TriggerCarryallReinforcements(player, atreides, AtreidesBaseAreaTriggers[1], AtreidesHunters[2], AtreidesHunterPaths[2]) TriggerCarryallReinforcements(Harkonnen, Atreides, AtreidesBaseAreaTriggers[1], AtreidesHunters[2], AtreidesHunterPaths[2])
TriggerCarryallReinforcements(player, atreides, AtreidesBaseAreaTriggers[2], AtreidesHunters[3], AtreidesHunterPaths[3]) TriggerCarryallReinforcements(Harkonnen, Atreides, AtreidesBaseAreaTriggers[2], AtreidesHunters[3], AtreidesHunterPaths[3])
TriggerCarryallReinforcements(player, atreides, AtreidesBaseAreaTriggers[2], AtreidesHunters[4], AtreidesHunterPaths[4]) TriggerCarryallReinforcements(Harkonnen, Atreides, AtreidesBaseAreaTriggers[2], AtreidesHunters[4], AtreidesHunterPaths[4])
TriggerCarryallReinforcements(player, atreides, AtreidesBaseAreaTriggers[3], AtreidesHunters[5], AtreidesHunterPaths[5]) TriggerCarryallReinforcements(Harkonnen, Atreides, AtreidesBaseAreaTriggers[3], AtreidesHunters[5], AtreidesHunterPaths[5])
end end

View File

@@ -25,13 +25,13 @@ AtreidesInfantryTypes = { "light_inf", "light_inf", "light_inf", "trooper", "tro
AtreidesVehicleTypes = { "trike", "trike", "quad" } AtreidesVehicleTypes = { "trike", "trike", "quad" }
InitAIUnits = function() InitAIUnits = function()
IdlingUnits[atreides] = Reinforcements.Reinforce(atreides, AtreidesInitialReinforcements, AtreidesInitialPath) IdlingUnits[Atreides] = Reinforcements.Reinforce(Atreides, AtreidesInitialReinforcements, AtreidesInitialPath)
DefendAndRepairBase(atreides, AtreidesBase, 0.75, AttackGroupSize[Difficulty]) DefendAndRepairBase(Atreides, AtreidesBase, 0.75, AttackGroupSize[Difficulty])
end end
ActivateAI = function() ActivateAI = function()
LastHarvesterEaten[atreides] = true LastHarvesterEaten[Atreides] = true
Trigger.AfterDelay(0, InitAIUnits) Trigger.AfterDelay(0, InitAIUnits)
AConyard.Produce(HarkonnenUpgrades[1]) AConyard.Produce(HarkonnenUpgrades[1])
@@ -44,7 +44,7 @@ ActivateAI = function()
-- Finish the upgrades first before trying to build something -- Finish the upgrades first before trying to build something
Trigger.AfterDelay(DateTime.Seconds(14), function() Trigger.AfterDelay(DateTime.Seconds(14), function()
ProduceUnits(atreides, ABarracks, delay, infantryToBuild, AttackGroupSize[Difficulty], attackThresholdSize) ProduceUnits(Atreides, ABarracks, delay, infantryToBuild, AttackGroupSize[Difficulty], attackThresholdSize)
ProduceUnits(atreides, ALightFactory, delay, vehilcesToBuild, AttackGroupSize[Difficulty], attackThresholdSize) ProduceUnits(Atreides, ALightFactory, delay, vehilcesToBuild, AttackGroupSize[Difficulty], attackThresholdSize)
end) end)
end end

View File

@@ -96,25 +96,25 @@ HarkonnenBaseBuildings = { "barracks", "light_factory" }
HarkonnenUpgrades = { "upgrade.barracks", "upgrade.light" } HarkonnenUpgrades = { "upgrade.barracks", "upgrade.light" }
MessageCheck = function(index) MessageCheck = function(index)
return #player.GetActorsByType(HarkonnenBaseBuildings[index]) > 0 and not player.HasPrerequisites({ HarkonnenUpgrades[index] }) return #Harkonnen.GetActorsByType(HarkonnenBaseBuildings[index]) > 0 and not Harkonnen.HasPrerequisites({ HarkonnenUpgrades[index] })
end end
Tick = function() Tick = function()
if player.HasNoRequiredUnits() then if Harkonnen.HasNoRequiredUnits() then
atreides.MarkCompletedObjective(KillHarkonnen) Atreides.MarkCompletedObjective(KillHarkonnen)
end end
if atreides.HasNoRequiredUnits() and not player.IsObjectiveCompleted(KillAtreides) then if Atreides.HasNoRequiredUnits() and not Harkonnen.IsObjectiveCompleted(KillAtreides) then
Media.DisplayMessage(UserInterface.Translate("atreides-annihilated"), Mentat) Media.DisplayMessage(UserInterface.Translate("atreides-annihilated"), Mentat)
player.MarkCompletedObjective(KillAtreides) Harkonnen.MarkCompletedObjective(KillAtreides)
end end
if DateTime.GameTime % DateTime.Seconds(10) == 0 and LastHarvesterEaten[atreides] then if DateTime.GameTime % DateTime.Seconds(10) == 0 and LastHarvesterEaten[Atreides] then
local units = atreides.GetActorsByType("harvester") local units = Atreides.GetActorsByType("harvester")
if #units > 0 then if #units > 0 then
LastHarvesterEaten[atreides] = false LastHarvesterEaten[Atreides] = false
ProtectHarvester(units[1], atreides, AttackGroupSize[Difficulty]) ProtectHarvester(units[1], Atreides, AttackGroupSize[Difficulty])
end end
end end
@@ -124,30 +124,30 @@ Tick = function()
end end
WorldLoaded = function() WorldLoaded = function()
atreides = Player.GetPlayer("Atreides") Atreides = Player.GetPlayer("Atreides")
player = Player.GetPlayer("Harkonnen") Harkonnen = Player.GetPlayer("Harkonnen")
InitObjectives(player) InitObjectives(Harkonnen)
KillHarkonnen = AddPrimaryObjective(atreides, "") KillHarkonnen = AddPrimaryObjective(Atreides, "")
KillAtreides = AddPrimaryObjective(player, "eliminate-atreides-units-reinforcements") KillAtreides = AddPrimaryObjective(Harkonnen, "eliminate-atreides-units-reinforcements")
Camera.Position = HConyard.CenterPosition Camera.Position = HConyard.CenterPosition
Trigger.OnAllKilled(AtreidesBase, function() Trigger.OnAllKilled(AtreidesBase, function()
Utils.Do(atreides.GetGroundAttackers(), IdleHunt) Utils.Do(Atreides.GetGroundAttackers(), IdleHunt)
end) end)
local path = function() return Utils.Random(AtreidesPaths) end local path = function() return Utils.Random(AtreidesPaths) end
local waveCondition = function() return player.IsObjectiveCompleted(KillAtreides) end local waveCondition = function() return Harkonnen.IsObjectiveCompleted(KillAtreides) end
SendCarryallReinforcements(atreides, 0, AtreidesAttackWaves[Difficulty], AtreidesAttackDelay[Difficulty], path, AtreidesReinforcements[Difficulty], waveCondition) SendCarryallReinforcements(Atreides, 0, AtreidesAttackWaves[Difficulty], AtreidesAttackDelay[Difficulty], path, AtreidesReinforcements[Difficulty], waveCondition)
ActivateAI() ActivateAI()
Trigger.AfterDelay(DateTime.Minutes(2) + DateTime.Seconds(30), function() Trigger.AfterDelay(DateTime.Minutes(2) + DateTime.Seconds(30), function()
Reinforcements.ReinforceWithTransport(player, "carryall.reinforce", HarkonnenReinforcements, HarkonnenPath, { HarkonnenPath[1] }) Reinforcements.ReinforceWithTransport(Harkonnen, "carryall.reinforce", HarkonnenReinforcements, HarkonnenPath, { HarkonnenPath[1] })
end) end)
TriggerCarryallReinforcements(player, atreides, AtreidesBaseAreaTriggers[1], AtreidesHunters[1], AtreidesHunterPaths[1]) TriggerCarryallReinforcements(Harkonnen, Atreides, AtreidesBaseAreaTriggers[1], AtreidesHunters[1], AtreidesHunterPaths[1])
TriggerCarryallReinforcements(player, atreides, AtreidesBaseAreaTriggers[2], AtreidesHunters[2], AtreidesHunterPaths[2]) TriggerCarryallReinforcements(Harkonnen, Atreides, AtreidesBaseAreaTriggers[2], AtreidesHunters[2], AtreidesHunterPaths[2])
TriggerCarryallReinforcements(player, atreides, AtreidesBaseAreaTriggers[3], AtreidesHunters[3], AtreidesHunterPaths[3]) TriggerCarryallReinforcements(Harkonnen, Atreides, AtreidesBaseAreaTriggers[3], AtreidesHunters[3], AtreidesHunterPaths[3])
TriggerCarryallReinforcements(player, atreides, AtreidesBaseAreaTriggers[4], AtreidesHunters[4], AtreidesHunterPaths[4]) TriggerCarryallReinforcements(Harkonnen, Atreides, AtreidesBaseAreaTriggers[4], AtreidesHunters[4], AtreidesHunterPaths[4])
end end

View File

@@ -26,12 +26,12 @@ AtreidesVehicleTypes = { "trike", "trike", "quad" }
AtreidesTankType = { "combat_tank_a" } AtreidesTankType = { "combat_tank_a" }
ActivateAI = function() ActivateAI = function()
IdlingUnits[fremen] = { } IdlingUnits[Fremen] = { }
IdlingUnits[atreides] = Reinforcements.Reinforce(atreides, InitialAtreidesReinforcements[1], AtreidesPaths[2]), Reinforcements.Reinforce(atreides, InitialAtreidesReinforcements[2], AtreidesPaths[3]) IdlingUnits[Atreides] = Reinforcements.Reinforce(Atreides, InitialAtreidesReinforcements[1], AtreidesPaths[2]), Reinforcements.Reinforce(Atreides, InitialAtreidesReinforcements[2], AtreidesPaths[3])
FremenProduction() FremenProduction()
DefendAndRepairBase(atreides, AtreidesBase, 0.75, AttackGroupSize[Difficulty]) DefendAndRepairBase(Atreides, AtreidesBase, 0.75, AttackGroupSize[Difficulty])
DefendAndRepairBase(fremen, FremenBase, 0.75, AttackGroupSize[Difficulty]) DefendAndRepairBase(Fremen, FremenBase, 0.75, AttackGroupSize[Difficulty])
local delay = function() return Utils.RandomInteger(AttackDelays[Difficulty][1], AttackDelays[Difficulty][2] + 1) end local delay = function() return Utils.RandomInteger(AttackDelays[Difficulty][1], AttackDelays[Difficulty][2] + 1) end
local infantryToBuild = function() return { Utils.Random(AtreidesInfantryTypes) } end local infantryToBuild = function() return { Utils.Random(AtreidesInfantryTypes) } end
@@ -39,7 +39,7 @@ ActivateAI = function()
local tanksToBuild = function() return AtreidesTankType end local tanksToBuild = function() return AtreidesTankType end
local attackThresholdSize = AttackGroupSize[Difficulty] * 2.5 local attackThresholdSize = AttackGroupSize[Difficulty] * 2.5
ProduceUnits(atreides, ABarracks, delay, infantryToBuild, AttackGroupSize[Difficulty], attackThresholdSize) ProduceUnits(Atreides, ABarracks, delay, infantryToBuild, AttackGroupSize[Difficulty], attackThresholdSize)
ProduceUnits(atreides, ALightFactory, delay, vehilcesToBuild, AttackGroupSize[Difficulty], attackThresholdSize) ProduceUnits(Atreides, ALightFactory, delay, vehilcesToBuild, AttackGroupSize[Difficulty], attackThresholdSize)
ProduceUnits(atreides, AHeavyFactory, delay, tanksToBuild, AttackGroupSize[Difficulty], attackThresholdSize) ProduceUnits(Atreides, AHeavyFactory, delay, tanksToBuild, AttackGroupSize[Difficulty], attackThresholdSize)
end end

View File

@@ -122,51 +122,51 @@ FremenProduction = function()
end end
local delay = Utils.RandomInteger(FremenInterval[Difficulty][1], FremenInterval[Difficulty][2] + 1) local delay = Utils.RandomInteger(FremenInterval[Difficulty][1], FremenInterval[Difficulty][2] + 1)
fremen.Build({ "nsfremen" }, function() Fremen.Build({ "nsfremen" }, function()
Trigger.AfterDelay(delay, FremenProduction) Trigger.AfterDelay(delay, FremenProduction)
end) end)
end end
Tick = function() Tick = function()
if player.HasNoRequiredUnits() then if Harkonnen.HasNoRequiredUnits() then
atreides.MarkCompletedObjective(KillHarkonnen) Atreides.MarkCompletedObjective(KillHarkonnen)
end end
if atreides.HasNoRequiredUnits() and not player.IsObjectiveCompleted(KillAtreides) then if Atreides.HasNoRequiredUnits() and not Harkonnen.IsObjectiveCompleted(KillAtreides) then
Media.DisplayMessage(UserInterface.Translate("atreides-annihilated"), Mentat) Media.DisplayMessage(UserInterface.Translate("atreides-annihilated"), Mentat)
player.MarkCompletedObjective(KillAtreides) Harkonnen.MarkCompletedObjective(KillAtreides)
end end
if fremen.HasNoRequiredUnits() and not player.IsObjectiveCompleted(KillFremen) then if Fremen.HasNoRequiredUnits() and not Harkonnen.IsObjectiveCompleted(KillFremen) then
Media.DisplayMessage(UserInterface.Translate("fremen-annihilated"), Mentat) Media.DisplayMessage(UserInterface.Translate("fremen-annihilated"), Mentat)
player.MarkCompletedObjective(KillFremen) Harkonnen.MarkCompletedObjective(KillFremen)
end end
if DateTime.GameTime % DateTime.Seconds(10) == 0 and LastHarvesterEaten[atreides] then if DateTime.GameTime % DateTime.Seconds(10) == 0 and LastHarvesterEaten[Atreides] then
local units = atreides.GetActorsByType("harvester") local units = Atreides.GetActorsByType("harvester")
if #units > 0 then if #units > 0 then
LastHarvesterEaten[atreides] = false LastHarvesterEaten[Atreides] = false
ProtectHarvester(units[1], atreides, AttackGroupSize[Difficulty]) ProtectHarvester(units[1], Atreides, AttackGroupSize[Difficulty])
end end
end end
end end
WorldLoaded = function() WorldLoaded = function()
atreides = Player.GetPlayer("Atreides") Atreides = Player.GetPlayer("Atreides")
fremen = Player.GetPlayer("Fremen") Fremen = Player.GetPlayer("Fremen")
player = Player.GetPlayer("Harkonnen") Harkonnen = Player.GetPlayer("Harkonnen")
InitObjectives(player) InitObjectives(Harkonnen)
KillAtreides = AddPrimaryObjective(player, "destroy-atreides") KillAtreides = AddPrimaryObjective(Harkonnen, "destroy-atreides")
KillFremen = AddPrimaryObjective(player, "destroy-fremen") KillFremen = AddPrimaryObjective(Harkonnen, "destroy-fremen")
KillHarkonnen = AddPrimaryObjective(atreides, "") KillHarkonnen = AddPrimaryObjective(Atreides, "")
Camera.Position = HConyard.CenterPosition Camera.Position = HConyard.CenterPosition
FremenAttackLocation = HConyard.Location FremenAttackLocation = HConyard.Location
Trigger.OnAllKilledOrCaptured(AtreidesBase, function() Trigger.OnAllKilledOrCaptured(AtreidesBase, function()
Utils.Do(atreides.GetGroundAttackers(), IdleHunt) Utils.Do(Atreides.GetGroundAttackers(), IdleHunt)
end) end)
Trigger.OnAllKilled(Sietches, function() Trigger.OnAllKilled(Sietches, function()
@@ -174,31 +174,31 @@ WorldLoaded = function()
end) end)
local path = function() return Utils.Random(FremenPaths) end local path = function() return Utils.Random(FremenPaths) end
local waveCondition = function() return player.IsObjectiveCompleted(KillFremen) end local waveCondition = function() return Harkonnen.IsObjectiveCompleted(KillFremen) end
local huntFunction = function(unit) local huntFunction = function(unit)
unit.AttackMove(FremenAttackLocation) unit.AttackMove(FremenAttackLocation)
IdleHunt(unit) IdleHunt(unit)
end end
SendCarryallReinforcements(fremen, 0, FremenAttackWaves[Difficulty], FremenAttackDelay[Difficulty], path, FremenReinforcements[Difficulty], waveCondition, huntFunction) SendCarryallReinforcements(Fremen, 0, FremenAttackWaves[Difficulty], FremenAttackDelay[Difficulty], path, FremenReinforcements[Difficulty], waveCondition, huntFunction)
Actor.Create("upgrade.barracks", true, { Owner = atreides }) Actor.Create("upgrade.barracks", true, { Owner = Atreides })
Actor.Create("upgrade.light", true, { Owner = atreides }) Actor.Create("upgrade.light", true, { Owner = Atreides })
Trigger.AfterDelay(0, ActivateAI) Trigger.AfterDelay(0, ActivateAI)
Trigger.AfterDelay(DateTime.Minutes(1) + DateTime.Seconds(15), function() Trigger.AfterDelay(DateTime.Minutes(1) + DateTime.Seconds(15), function()
Media.PlaySpeechNotification(player, "Reinforce") Media.PlaySpeechNotification(Harkonnen, "Reinforce")
Reinforcements.Reinforce(player, HarkonnenReinforcements, HarkonnenPath) Reinforcements.Reinforce(Harkonnen, HarkonnenReinforcements, HarkonnenPath)
end) end)
Trigger.AfterDelay(DateTime.Seconds(15), function() Trigger.AfterDelay(DateTime.Seconds(15), function()
Media.DisplayMessage(UserInterface.Translate("fremen-spotted-north-southeast"), Mentat) Media.DisplayMessage(UserInterface.Translate("fremen-spotted-north-southeast"), Mentat)
end) end)
local atreidesCondition = function() return player.IsObjectiveCompleted(KillAtreides) end local atreidesCondition = function() return Harkonnen.IsObjectiveCompleted(KillAtreides) end
TriggerCarryallReinforcements(player, atreides, BaseAreaTriggers[1], AtreidesHunters, AtreidesPaths[1], atreidesCondition) TriggerCarryallReinforcements(Harkonnen, Atreides, BaseAreaTriggers[1], AtreidesHunters, AtreidesPaths[1], atreidesCondition)
local fremenCondition = function() return player.IsObjectiveCompleted(KillFremen) end local fremenCondition = function() return Harkonnen.IsObjectiveCompleted(KillFremen) end
TriggerCarryallReinforcements(player, fremen, BaseAreaTriggers[1], FremenHunters[1], FremenHunterPaths[3], fremenCondition) TriggerCarryallReinforcements(Harkonnen, Fremen, BaseAreaTriggers[1], FremenHunters[1], FremenHunterPaths[3], fremenCondition)
TriggerCarryallReinforcements(player, fremen, BaseAreaTriggers[2], FremenHunters[2], FremenHunterPaths[2], fremenCondition) TriggerCarryallReinforcements(Harkonnen, Fremen, BaseAreaTriggers[2], FremenHunters[2], FremenHunterPaths[2], fremenCondition)
TriggerCarryallReinforcements(player, fremen, BaseAreaTriggers[3], FremenHunters[3], FremenHunterPaths[1], fremenCondition) TriggerCarryallReinforcements(Harkonnen, Fremen, BaseAreaTriggers[3], FremenHunters[3], FremenHunterPaths[1], fremenCondition)
end end

View File

@@ -26,13 +26,13 @@ OrdosVehicleTypes = { "raider", "raider", "quad" }
OrdosTankType = { "combat_tank_o" } OrdosTankType = { "combat_tank_o" }
ActivateAI = function() ActivateAI = function()
IdlingUnits[ordos_main] = Reinforcements.Reinforce(ordos_main, InitialOrdosReinforcements[1], InitialOrdosPaths[1]), Reinforcements.Reinforce(ordos_main, InitialOrdosReinforcements[2], InitialOrdosPaths[2]) IdlingUnits[OrdosMain] = Reinforcements.Reinforce(OrdosMain, InitialOrdosReinforcements[1], InitialOrdosPaths[1]), Reinforcements.Reinforce(OrdosMain, InitialOrdosReinforcements[2], InitialOrdosPaths[2])
IdlingUnits[ordos_small] = Reinforcements.Reinforce(ordos_small, InitialOrdosReinforcements[1], InitialOrdosPaths[3]) IdlingUnits[OrdosSmall] = Reinforcements.Reinforce(OrdosSmall, InitialOrdosReinforcements[1], InitialOrdosPaths[3])
IdlingUnits[corrino] = { CSaraukar1, CSaraukar2, CSaraukar3, CSaraukar4, CSaraukar5 } IdlingUnits[Corrino] = { CSaraukar1, CSaraukar2, CSaraukar3, CSaraukar4, CSaraukar5 }
DefendAndRepairBase(ordos_main, OrdosMainBase, 0.75, AttackGroupSize[Difficulty]) DefendAndRepairBase(OrdosMain, OrdosMainBase, 0.75, AttackGroupSize[Difficulty])
DefendAndRepairBase(ordos_small, OrdosSmallBase, 0.75, AttackGroupSize[Difficulty]) DefendAndRepairBase(OrdosSmall, OrdosSmallBase, 0.75, AttackGroupSize[Difficulty])
DefendAndRepairBase(corrino, CorrinoBase, 0.75, AttackGroupSize[Difficulty]) DefendAndRepairBase(Corrino, CorrinoBase, 0.75, AttackGroupSize[Difficulty])
local delay = function() return Utils.RandomInteger(AttackDelays[Difficulty][1], AttackDelays[Difficulty][2] + 1) end local delay = function() return Utils.RandomInteger(AttackDelays[Difficulty][1], AttackDelays[Difficulty][2] + 1) end
local infantryToBuild = function() return { Utils.Random(OrdosInfantryTypes) } end local infantryToBuild = function() return { Utils.Random(OrdosInfantryTypes) } end
@@ -40,10 +40,10 @@ ActivateAI = function()
local tanksToBuild = function() return OrdosTankType end local tanksToBuild = function() return OrdosTankType end
local attackThresholdSize = AttackGroupSize[Difficulty] * 2.5 local attackThresholdSize = AttackGroupSize[Difficulty] * 2.5
ProduceUnits(ordos_main, OBarracks1, delay, infantryToBuild, AttackGroupSize[Difficulty], attackThresholdSize) ProduceUnits(OrdosMain, OBarracks1, delay, infantryToBuild, AttackGroupSize[Difficulty], attackThresholdSize)
ProduceUnits(ordos_main, OLightFactory1, delay, vehilcesToBuild, AttackGroupSize[Difficulty], attackThresholdSize) ProduceUnits(OrdosMain, OLightFactory1, delay, vehilcesToBuild, AttackGroupSize[Difficulty], attackThresholdSize)
ProduceUnits(ordos_main, OHeavyFactory, delay, tanksToBuild, AttackGroupSize[Difficulty], attackThresholdSize) ProduceUnits(OrdosMain, OHeavyFactory, delay, tanksToBuild, AttackGroupSize[Difficulty], attackThresholdSize)
ProduceUnits(ordos_small, OBarracks3, delay, infantryToBuild, AttackGroupSize[Difficulty], attackThresholdSize) ProduceUnits(OrdosSmall, OBarracks3, delay, infantryToBuild, AttackGroupSize[Difficulty], attackThresholdSize)
ProduceUnits(ordos_small, OLightFactory2, delay, vehilcesToBuild, AttackGroupSize[Difficulty], attackThresholdSize) ProduceUnits(OrdosSmall, OLightFactory2, delay, vehilcesToBuild, AttackGroupSize[Difficulty], attackThresholdSize)
end end

View File

@@ -131,11 +131,11 @@ HarkonnenPaths =
SendStarportReinforcements = function() SendStarportReinforcements = function()
Trigger.AfterDelay(CorrinoStarportDelay[Difficulty], function() Trigger.AfterDelay(CorrinoStarportDelay[Difficulty], function()
if CStarport.IsDead or CStarport.Owner ~= corrino then if CStarport.IsDead or CStarport.Owner ~= Corrino then
return return
end end
local units = Reinforcements.ReinforceWithTransport(corrino, "frigate", CorrinoStarportReinforcements[Difficulty], { CorrinoStarportEntry.Location, CStarport.Location + CVec.New(1, 1) }, { CorrinoStarportExit.Location })[2] local units = Reinforcements.ReinforceWithTransport(Corrino, "frigate", CorrinoStarportReinforcements[Difficulty], { CorrinoStarportEntry.Location, CStarport.Location + CVec.New(1, 1) }, { CorrinoStarportExit.Location })[2]
Utils.Do(units, function(unit) Utils.Do(units, function(unit)
unit.AttackMove(OrdosAttackLocation) unit.AttackMove(OrdosAttackLocation)
IdleHunt(unit) IdleHunt(unit)
@@ -143,7 +143,7 @@ SendStarportReinforcements = function()
SendStarportReinforcements() SendStarportReinforcements()
if player.IsObjectiveFailed(GuardOutpost) then if Harkonnen.IsObjectiveFailed(GuardOutpost) then
return return
end end
@@ -153,16 +153,16 @@ end
SendHarkonnenReinforcements = function(delay, number) SendHarkonnenReinforcements = function(delay, number)
Trigger.AfterDelay(delay, function() Trigger.AfterDelay(delay, function()
Reinforcements.ReinforceWithTransport(player, "carryall.reinforce", HarkonnenReinforcements[number], HarkonnenPaths[number], { HarkonnenPaths[number][1] }) Reinforcements.ReinforceWithTransport(Harkonnen, "carryall.reinforce", HarkonnenReinforcements[number], HarkonnenPaths[number], { HarkonnenPaths[number][1] })
Trigger.AfterDelay(DateTime.Seconds(5), function() Trigger.AfterDelay(DateTime.Seconds(5), function()
Media.PlaySpeechNotification(player, "Reinforce") Media.PlaySpeechNotification(Harkonnen, "Reinforce")
end) end)
end) end)
end end
OrdosReinforcementNotification = function(currentWave, totalWaves) OrdosReinforcementNotification = function(currentWave, totalWaves)
Trigger.AfterDelay(OrdosAttackDelay[Difficulty], function() Trigger.AfterDelay(OrdosAttackDelay[Difficulty], function()
if player.IsObjectiveFailed(GuardOutpost) or player.IsObjectiveCompleted(KillOrdos) then if Harkonnen.IsObjectiveFailed(GuardOutpost) or Harkonnen.IsObjectiveCompleted(KillOrdos) then
return return
end end
@@ -179,62 +179,62 @@ end
Tick = function() Tick = function()
if player.HasNoRequiredUnits() then if Harkonnen.HasNoRequiredUnits() then
ordos_main.MarkCompletedObjective(KillHarkonnen1) OrdosMain.MarkCompletedObjective(KillHarkonnen1)
ordos_small.MarkCompletedObjective(KillHarkonnen2) OrdosSmall.MarkCompletedObjective(KillHarkonnen2)
corrino.MarkCompletedObjective(KillHarkonnen3) Corrino.MarkCompletedObjective(KillHarkonnen3)
end end
if ordos_main.HasNoRequiredUnits() and ordos_small.HasNoRequiredUnits() and not player.IsObjectiveCompleted(KillOrdos) then if OrdosMain.HasNoRequiredUnits() and OrdosSmall.HasNoRequiredUnits() and not Harkonnen.IsObjectiveCompleted(KillOrdos) then
Media.DisplayMessage(UserInterface.Translate("ordos-annihilated"), Mentat) Media.DisplayMessage(UserInterface.Translate("ordos-annihilated"), Mentat)
player.MarkCompletedObjective(KillOrdos) Harkonnen.MarkCompletedObjective(KillOrdos)
end end
if corrino.HasNoRequiredUnits() and not player.IsObjectiveCompleted(KillCorrino) then if Corrino.HasNoRequiredUnits() and not Harkonnen.IsObjectiveCompleted(KillCorrino) then
Media.DisplayMessage(UserInterface.Translate("emperor-annihilated"), Mentat) Media.DisplayMessage(UserInterface.Translate("emperor-annihilated"), Mentat)
player.MarkCompletedObjective(KillCorrino) Harkonnen.MarkCompletedObjective(KillCorrino)
end end
if player.IsObjectiveCompleted(KillOrdos) and player.IsObjectiveCompleted(KillCorrino) and not player.IsObjectiveCompleted(GuardOutpost) then if Harkonnen.IsObjectiveCompleted(KillOrdos) and Harkonnen.IsObjectiveCompleted(KillCorrino) and not Harkonnen.IsObjectiveCompleted(GuardOutpost) then
player.MarkCompletedObjective(GuardOutpost) Harkonnen.MarkCompletedObjective(GuardOutpost)
end end
if (HOutpost.IsDead or HOutpost.Owner ~= player) and not player.IsObjectiveFailed(GuardOutpost) then if (HOutpost.IsDead or HOutpost.Owner ~= Harkonnen) and not Harkonnen.IsObjectiveFailed(GuardOutpost) then
player.MarkFailedObjective(GuardOutpost) Harkonnen.MarkFailedObjective(GuardOutpost)
end end
if DateTime.GameTime % DateTime.Seconds(10) == 0 and LastHarvesterEaten[ordos_main] then if DateTime.GameTime % DateTime.Seconds(10) == 0 and LastHarvesterEaten[OrdosMain] then
local units = ordos_main.GetActorsByType("harvester") local units = OrdosMain.GetActorsByType("harvester")
if #units > 0 then if #units > 0 then
LastHarvesterEaten[ordos_main] = false LastHarvesterEaten[OrdosMain] = false
ProtectHarvester(units[1], ordos_main, AttackGroupSize[Difficulty]) ProtectHarvester(units[1], OrdosMain, AttackGroupSize[Difficulty])
end end
end end
if DateTime.GameTime % DateTime.Seconds(10) == 0 and LastHarvesterEaten[ordos_small] then if DateTime.GameTime % DateTime.Seconds(10) == 0 and LastHarvesterEaten[OrdosSmall] then
local units = ordos_small.GetActorsByType("harvester") local units = OrdosSmall.GetActorsByType("harvester")
if #units > 0 then if #units > 0 then
LastHarvesterEaten[ordos_small] = false LastHarvesterEaten[OrdosSmall] = false
ProtectHarvester(units[1], ordos_small, AttackGroupSize[Difficulty]) ProtectHarvester(units[1], OrdosSmall, AttackGroupSize[Difficulty])
end end
end end
end end
WorldLoaded = function() WorldLoaded = function()
ordos_main = Player.GetPlayer("Ordos Main Base") OrdosMain = Player.GetPlayer("Ordos Main Base")
ordos_small = Player.GetPlayer("Ordos Small Base") OrdosSmall = Player.GetPlayer("Ordos Small Base")
corrino = Player.GetPlayer("Corrino") Corrino = Player.GetPlayer("Corrino")
player = Player.GetPlayer("Harkonnen") Harkonnen = Player.GetPlayer("Harkonnen")
InitObjectives(player) InitObjectives(Harkonnen)
KillOrdos = AddPrimaryObjective(player, "destroy-ordos") KillOrdos = AddPrimaryObjective(Harkonnen, "destroy-ordos")
KillCorrino = AddPrimaryObjective(player, "destroy-imperial-forces") KillCorrino = AddPrimaryObjective(Harkonnen, "destroy-imperial-forces")
GuardOutpost = AddSecondaryObjective(player, "keep-modified-outpost-intact") GuardOutpost = AddSecondaryObjective(Harkonnen, "keep-modified-outpost-intact")
KillHarkonnen1 = AddPrimaryObjective(ordos_main, "") KillHarkonnen1 = AddPrimaryObjective(OrdosMain, "")
KillHarkonnen2 = AddPrimaryObjective(ordos_small, "") KillHarkonnen2 = AddPrimaryObjective(OrdosSmall, "")
KillHarkonnen3 = AddPrimaryObjective(corrino, "") KillHarkonnen3 = AddPrimaryObjective(Corrino, "")
HOutpost.GrantCondition("modified") HOutpost.GrantCondition("modified")
@@ -242,15 +242,15 @@ WorldLoaded = function()
OrdosAttackLocation = HConYard.Location OrdosAttackLocation = HConYard.Location
Trigger.OnAllKilledOrCaptured(OrdosMainBase, function() Trigger.OnAllKilledOrCaptured(OrdosMainBase, function()
Utils.Do(ordos_main.GetGroundAttackers(), IdleHunt) Utils.Do(OrdosMain.GetGroundAttackers(), IdleHunt)
end) end)
Trigger.OnAllKilledOrCaptured(OrdosSmallBase, function() Trigger.OnAllKilledOrCaptured(OrdosSmallBase, function()
Utils.Do(ordos_small.GetGroundAttackers(), IdleHunt) Utils.Do(OrdosSmall.GetGroundAttackers(), IdleHunt)
end) end)
Trigger.OnAllKilledOrCaptured(CorrinoBase, function() Trigger.OnAllKilledOrCaptured(CorrinoBase, function()
Utils.Do(corrino.GetGroundAttackers(), IdleHunt) Utils.Do(Corrino.GetGroundAttackers(), IdleHunt)
end) end)
Trigger.AfterDelay(DateTime.Seconds(5), function() Trigger.AfterDelay(DateTime.Seconds(5), function()
@@ -258,28 +258,28 @@ WorldLoaded = function()
end) end)
local path = function() return Utils.Random(OrdosPaths) end local path = function() return Utils.Random(OrdosPaths) end
local waveCondition = function() return player.IsObjectiveCompleted(KillOrdos) end local waveCondition = function() return Harkonnen.IsObjectiveCompleted(KillOrdos) end
local huntFunction = function(unit) local huntFunction = function(unit)
unit.AttackMove(OrdosAttackLocation) unit.AttackMove(OrdosAttackLocation)
IdleHunt(unit) IdleHunt(unit)
end end
SendCarryallReinforcements(ordos_main, 0, OrdosAttackWaves[Difficulty], OrdosAttackDelay[Difficulty], path, OrdosReinforcements[Difficulty], waveCondition, huntFunction) SendCarryallReinforcements(OrdosMain, 0, OrdosAttackWaves[Difficulty], OrdosAttackDelay[Difficulty], path, OrdosReinforcements[Difficulty], waveCondition, huntFunction)
OrdosReinforcementNotification(0, OrdosAttackWaves[Difficulty]) OrdosReinforcementNotification(0, OrdosAttackWaves[Difficulty])
SendStarportReinforcements() SendStarportReinforcements()
Actor.Create("upgrade.barracks", true, { Owner = ordos_main }) Actor.Create("upgrade.barracks", true, { Owner = OrdosMain })
Actor.Create("upgrade.light", true, { Owner = ordos_main }) Actor.Create("upgrade.light", true, { Owner = OrdosMain })
Actor.Create("upgrade.heavy", true, { Owner = ordos_main }) Actor.Create("upgrade.heavy", true, { Owner = OrdosMain })
Actor.Create("upgrade.barracks", true, { Owner = ordos_small }) Actor.Create("upgrade.barracks", true, { Owner = OrdosSmall })
Actor.Create("upgrade.light", true, { Owner = ordos_small }) Actor.Create("upgrade.light", true, { Owner = OrdosSmall })
Trigger.AfterDelay(0, ActivateAI) Trigger.AfterDelay(0, ActivateAI)
SendHarkonnenReinforcements(DateTime.Seconds(15), 1) SendHarkonnenReinforcements(DateTime.Seconds(15), 1)
SendHarkonnenReinforcements(DateTime.Seconds(30), 1) SendHarkonnenReinforcements(DateTime.Seconds(30), 1)
SendHarkonnenReinforcements(DateTime.Seconds(35), 2) SendHarkonnenReinforcements(DateTime.Seconds(35), 2)
local ordosCondition = function() return player.IsObjectiveCompleted(KillOrdos) end local ordosCondition = function() return Harkonnen.IsObjectiveCompleted(KillOrdos) end
TriggerCarryallReinforcements(player, ordos_main, BaseAreaTriggers[1], OrdosHunters[1], OrdosHunterPaths[2], ordosCondition) TriggerCarryallReinforcements(Harkonnen, OrdosMain, BaseAreaTriggers[1], OrdosHunters[1], OrdosHunterPaths[2], ordosCondition)
TriggerCarryallReinforcements(player, ordos_main, BaseAreaTriggers[2], OrdosHunters[2], OrdosHunterPaths[1], ordosCondition) TriggerCarryallReinforcements(Harkonnen, OrdosMain, BaseAreaTriggers[2], OrdosHunters[2], OrdosHunterPaths[1], ordosCondition)
end end

View File

@@ -27,11 +27,11 @@ OrdosTankTypes = { "combat_tank_o", "combat_tank_o", "siege_tank" }
OrdosStarportTypes = { "trike.starport", "trike.starport", "quad.starport", "combat_tank_o.starport", "combat_tank_o.starport", "siege_tank.starport", "missile_tank.starport" } OrdosStarportTypes = { "trike.starport", "trike.starport", "quad.starport", "combat_tank_o.starport", "combat_tank_o.starport", "siege_tank.starport", "missile_tank.starport" }
ActivateAI = function() ActivateAI = function()
IdlingUnits[ordos_main] = Reinforcements.Reinforce(ordos_main, InitialOrdosReinforcements[1], InitialOrdosPaths[1]), Reinforcements.Reinforce(ordos_main, InitialOrdosReinforcements[2], InitialOrdosPaths[2]) IdlingUnits[OrdosMain] = Reinforcements.Reinforce(OrdosMain, InitialOrdosReinforcements[1], InitialOrdosPaths[1]), Reinforcements.Reinforce(OrdosMain, InitialOrdosReinforcements[2], InitialOrdosPaths[2])
IdlingUnits[ordos_small] = Reinforcements.Reinforce(ordos_small, InitialOrdosReinforcements[1], InitialOrdosPaths[3]) IdlingUnits[OrdosSmall] = Reinforcements.Reinforce(OrdosSmall, InitialOrdosReinforcements[1], InitialOrdosPaths[3])
DefendAndRepairBase(ordos_main, OrdosMainBase, 0.75, AttackGroupSize[Difficulty]) DefendAndRepairBase(OrdosMain, OrdosMainBase, 0.75, AttackGroupSize[Difficulty])
DefendAndRepairBase(ordos_small, OrdosSmallBase, 0.75, AttackGroupSize[Difficulty]) DefendAndRepairBase(OrdosSmall, OrdosSmallBase, 0.75, AttackGroupSize[Difficulty])
local delay = function() return Utils.RandomInteger(AttackDelays[Difficulty][1], AttackDelays[Difficulty][2] + 1) end local delay = function() return Utils.RandomInteger(AttackDelays[Difficulty][1], AttackDelays[Difficulty][2] + 1) end
local infantryToBuild = function() return { Utils.Random(OrdosInfantryTypes) } end local infantryToBuild = function() return { Utils.Random(OrdosInfantryTypes) } end
@@ -40,11 +40,11 @@ ActivateAI = function()
local unitsToBuy = function() return { Utils.Random(OrdosStarportTypes) } end local unitsToBuy = function() return { Utils.Random(OrdosStarportTypes) } end
local attackThresholdSize = AttackGroupSize[Difficulty] * 2.5 local attackThresholdSize = AttackGroupSize[Difficulty] * 2.5
ProduceUnits(ordos_main, OBarracks1, delay, infantryToBuild, AttackGroupSize[Difficulty], attackThresholdSize) ProduceUnits(OrdosMain, OBarracks1, delay, infantryToBuild, AttackGroupSize[Difficulty], attackThresholdSize)
ProduceUnits(ordos_main, OLightFactory1, delay, vehilcesToBuild, AttackGroupSize[Difficulty], attackThresholdSize) ProduceUnits(OrdosMain, OLightFactory1, delay, vehilcesToBuild, AttackGroupSize[Difficulty], attackThresholdSize)
ProduceUnits(ordos_main, OHeavyFactory1, delay, tanksToBuild, AttackGroupSize[Difficulty], attackThresholdSize) ProduceUnits(OrdosMain, OHeavyFactory1, delay, tanksToBuild, AttackGroupSize[Difficulty], attackThresholdSize)
ProduceUnits(ordos_main, OStarport, delay, unitsToBuy, AttackGroupSize[Difficulty], attackThresholdSize) ProduceUnits(OrdosMain, OStarport, delay, unitsToBuy, AttackGroupSize[Difficulty], attackThresholdSize)
ProduceUnits(ordos_small, OBarracks2, delay, infantryToBuild, AttackGroupSize[Difficulty], attackThresholdSize) ProduceUnits(OrdosSmall, OBarracks2, delay, infantryToBuild, AttackGroupSize[Difficulty], attackThresholdSize)
ProduceUnits(ordos_small, OLightFactory2, delay, vehilcesToBuild, AttackGroupSize[Difficulty], attackThresholdSize) ProduceUnits(OrdosSmall, OLightFactory2, delay, vehilcesToBuild, AttackGroupSize[Difficulty], attackThresholdSize)
end end

View File

@@ -115,11 +115,11 @@ HarkonnenPaths =
SendStarportReinforcements = function() SendStarportReinforcements = function()
Trigger.AfterDelay(OrdosStarportDelay[Difficulty], function() Trigger.AfterDelay(OrdosStarportDelay[Difficulty], function()
if OStarport.IsDead or OStarport.Owner ~= ordos_main then if OStarport.IsDead or OStarport.Owner ~= OrdosMain then
return return
end end
local units = Reinforcements.ReinforceWithTransport(ordos_main, "frigate", OrdosStarportReinforcements[Difficulty], { OrdosStarportEntry.Location, OStarport.Location + CVec.New(1, 1) }, { OrdosStarportExit.Location })[2] local units = Reinforcements.ReinforceWithTransport(OrdosMain, "frigate", OrdosStarportReinforcements[Difficulty], { OrdosStarportEntry.Location, OStarport.Location + CVec.New(1, 1) }, { OrdosStarportExit.Location })[2]
Utils.Do(units, function(unit) Utils.Do(units, function(unit)
unit.AttackMove(OrdosAttackLocation) unit.AttackMove(OrdosAttackLocation)
IdleHunt(unit) IdleHunt(unit)
@@ -133,9 +133,9 @@ end
SendHarkonnenReinforcements = function(delay, number) SendHarkonnenReinforcements = function(delay, number)
Trigger.AfterDelay(delay, function() Trigger.AfterDelay(delay, function()
Reinforcements.ReinforceWithTransport(player, "carryall.reinforce", HarkonnenReinforcements[number], HarkonnenPaths[number], { HarkonnenPaths[number][1] }) Reinforcements.ReinforceWithTransport(Harkonnen, "carryall.reinforce", HarkonnenReinforcements[number], HarkonnenPaths[number], { HarkonnenPaths[number][1] })
Trigger.AfterDelay(DateTime.Seconds(5), function() Trigger.AfterDelay(DateTime.Seconds(5), function()
Media.PlaySpeechNotification(player, "Reinforce") Media.PlaySpeechNotification(Harkonnen, "Reinforce")
end) end)
end) end)
end end
@@ -152,45 +152,45 @@ end
CheckSmugglerEnemies = function() CheckSmugglerEnemies = function()
Utils.Do(SmugglerUnits, function(unit) Utils.Do(SmugglerUnits, function(unit)
Trigger.OnDamaged(unit, function(self, attacker) Trigger.OnDamaged(unit, function(self, attacker)
if unit.Owner == smuggler_neutral and attacker.Owner == player then if unit.Owner == SmugglerNeutral and attacker.Owner == Harkonnen then
ChangeOwner(smuggler_neutral, smuggler_harkonnen) ChangeOwner(SmugglerNeutral, SmugglerHarkonnen)
-- Ensure that harvesters that was on a carryall switched sides. -- Ensure that harvesters that was on a carryall switched sides.
Trigger.AfterDelay(DateTime.Seconds(15), function() Trigger.AfterDelay(DateTime.Seconds(15), function()
ChangeOwner(smuggler_neutral, smuggler_harkonnen) ChangeOwner(SmugglerNeutral, SmugglerHarkonnen)
end) end)
end end
if unit.Owner == smuggler_ordos and attacker.Owner == player then if unit.Owner == SmugglerOrdos and attacker.Owner == Harkonnen then
ChangeOwner(smuggler_ordos, smuggler_both) ChangeOwner(SmugglerOrdos, SmugglerBoth)
-- Ensure that harvesters that was on a carryall switched sides. -- Ensure that harvesters that was on a carryall switched sides.
Trigger.AfterDelay(DateTime.Seconds(15), function() Trigger.AfterDelay(DateTime.Seconds(15), function()
ChangeOwner(smuggler_ordos, smuggler_both) ChangeOwner(SmugglerOrdos, SmugglerBoth)
end) end)
end end
if unit.Owner == smuggler_neutral and (attacker.Owner == ordos_main or attacker.Owner == ordos_small) then if unit.Owner == SmugglerNeutral and (attacker.Owner == OrdosMain or attacker.Owner == OrdosSmall) then
ChangeOwner(smuggler_neutral, smuggler_ordos) ChangeOwner(SmugglerNeutral, SmugglerOrdos)
-- Ensure that harvesters that was on a carryall switched sides. -- Ensure that harvesters that was on a carryall switched sides.
Trigger.AfterDelay(DateTime.Seconds(15), function() Trigger.AfterDelay(DateTime.Seconds(15), function()
ChangeOwner(smuggler_neutral, smuggler_ordos) ChangeOwner(SmugglerNeutral, SmugglerOrdos)
end) end)
end end
if unit.Owner == smuggler_harkonnen and (attacker.Owner == ordos_main or attacker.Owner == ordos_small) then if unit.Owner == SmugglerHarkonnen and (attacker.Owner == OrdosMain or attacker.Owner == OrdosSmall) then
ChangeOwner(smuggler_harkonnen, smuggler_both) ChangeOwner(SmugglerHarkonnen, SmugglerBoth)
-- Ensure that harvesters that was on a carryall switched sides. -- Ensure that harvesters that was on a carryall switched sides.
Trigger.AfterDelay(DateTime.Seconds(15), function() Trigger.AfterDelay(DateTime.Seconds(15), function()
ChangeOwner(smuggler_harkonnen, smuggler_both) ChangeOwner(SmugglerHarkonnen, SmugglerBoth)
end) end)
end end
if attacker.Owner == player and not message_check then if attacker.Owner == Harkonnen and not MessageCheck then
message_check = true MessageCheck = true
Media.DisplayMessage(UserInterface.Translate("smugglers-now-hostile"), Mentat) Media.DisplayMessage(UserInterface.Translate("smugglers-now-hostile"), Mentat)
end end
end) end)
@@ -198,61 +198,61 @@ CheckSmugglerEnemies = function()
end end
Tick = function() Tick = function()
if player.HasNoRequiredUnits() then if Harkonnen.HasNoRequiredUnits() then
ordos_main.MarkCompletedObjective(KillHarkonnen1) OrdosMain.MarkCompletedObjective(KillHarkonnen1)
ordos_small.MarkCompletedObjective(KillHarkonnen2) OrdosSmall.MarkCompletedObjective(KillHarkonnen2)
end end
if ordos_main.HasNoRequiredUnits() and ordos_small.HasNoRequiredUnits() and not OrdosKilled then if OrdosMain.HasNoRequiredUnits() and OrdosSmall.HasNoRequiredUnits() and not OrdosKilled then
Media.DisplayMessage(UserInterface.Translate("ordos-annihilated"), Mentat) Media.DisplayMessage(UserInterface.Translate("ordos-annihilated"), Mentat)
OrdosKilled = true OrdosKilled = true
end end
if smuggler_neutral.HasNoRequiredUnits() and smuggler_harkonnen.HasNoRequiredUnits() and smuggler_ordos.HasNoRequiredUnits() and smuggler_both.HasNoRequiredUnits() and not SmugglersKilled then if SmugglerNeutral.HasNoRequiredUnits() and SmugglerHarkonnen.HasNoRequiredUnits() and SmugglerOrdos.HasNoRequiredUnits() and SmugglerBoth.HasNoRequiredUnits() and not SmugglersKilled then
Media.DisplayMessage(UserInterface.Translate("smugglers-annihilated"), Mentat) Media.DisplayMessage(UserInterface.Translate("smugglers-annihilated"), Mentat)
SmugglersKilled = true SmugglersKilled = true
end end
if (OStarport.IsDead or OStarport.Owner == player) and not player.IsObjectiveCompleted(DestroyStarport) then if (OStarport.IsDead or OStarport.Owner == Harkonnen) and not Harkonnen.IsObjectiveCompleted(DestroyStarport) then
player.MarkCompletedObjective(DestroyStarport) Harkonnen.MarkCompletedObjective(DestroyStarport)
end end
if DateTime.GameTime % DateTime.Seconds(10) == 0 and LastHarvesterEaten[ordos_main] then if DateTime.GameTime % DateTime.Seconds(10) == 0 and LastHarvesterEaten[OrdosMain] then
local units = ordos_main.GetActorsByType("harvester") local units = OrdosMain.GetActorsByType("harvester")
if #units > 0 then if #units > 0 then
LastHarvesterEaten[ordos_main] = false LastHarvesterEaten[OrdosMain] = false
ProtectHarvester(units[1], ordos_main, AttackGroupSize[Difficulty]) ProtectHarvester(units[1], OrdosMain, AttackGroupSize[Difficulty])
end end
end end
if DateTime.GameTime % DateTime.Seconds(10) == 0 and LastHarvesterEaten[ordos_small] then if DateTime.GameTime % DateTime.Seconds(10) == 0 and LastHarvesterEaten[OrdosSmall] then
local units = ordos_small.GetActorsByType("harvester") local units = OrdosSmall.GetActorsByType("harvester")
if #units > 0 then if #units > 0 then
LastHarvesterEaten[ordos_small] = false LastHarvesterEaten[OrdosSmall] = false
ProtectHarvester(units[1], ordos_small, AttackGroupSize[Difficulty]) ProtectHarvester(units[1], OrdosSmall, AttackGroupSize[Difficulty])
end end
end end
end end
WorldLoaded = function() WorldLoaded = function()
ordos_main = Player.GetPlayer("Ordos Main Base") OrdosMain = Player.GetPlayer("Ordos Main Base")
ordos_small = Player.GetPlayer("Ordos Small Base") OrdosSmall = Player.GetPlayer("Ordos Small Base")
smuggler_neutral = Player.GetPlayer("Smugglers - Neutral") SmugglerNeutral = Player.GetPlayer("Smugglers - Neutral")
smuggler_harkonnen = Player.GetPlayer("Smugglers - Enemy to Harkonnen") SmugglerHarkonnen = Player.GetPlayer("Smugglers - Enemy to Harkonnen")
smuggler_ordos = Player.GetPlayer("Smugglers - Enemy to Ordos") SmugglerOrdos = Player.GetPlayer("Smugglers - Enemy to Ordos")
smuggler_both = Player.GetPlayer("Smugglers - Enemy to Both") SmugglerBoth = Player.GetPlayer("Smugglers - Enemy to Both")
player = Player.GetPlayer("Harkonnen") Harkonnen = Player.GetPlayer("Harkonnen")
InitObjectives(player) InitObjectives(Harkonnen)
DestroyStarport = AddPrimaryObjective(player, "capture-destroy-ordos-starport") DestroyStarport = AddPrimaryObjective(Harkonnen, "capture-destroy-ordos-starport")
KillHarkonnen1 = AddPrimaryObjective(ordos_main, "") KillHarkonnen1 = AddPrimaryObjective(OrdosMain, "")
KillHarkonnen2 = AddPrimaryObjective(ordos_small, "") KillHarkonnen2 = AddPrimaryObjective(OrdosSmall, "")
-- Wait for carryall drop -- Wait for carryall drop
Trigger.AfterDelay(DateTime.Seconds(10), function() Trigger.AfterDelay(DateTime.Seconds(10), function()
SmugglerUnits = smuggler_neutral.GetActors() SmugglerUnits = SmugglerNeutral.GetActors()
CheckSmugglerEnemies() CheckSmugglerEnemies()
end) end)
@@ -260,11 +260,11 @@ WorldLoaded = function()
OrdosAttackLocation = HMCV.Location OrdosAttackLocation = HMCV.Location
Trigger.OnAllKilledOrCaptured(OrdosMainBase, function() Trigger.OnAllKilledOrCaptured(OrdosMainBase, function()
Utils.Do(ordos_main.GetGroundAttackers(), IdleHunt) Utils.Do(OrdosMain.GetGroundAttackers(), IdleHunt)
end) end)
Trigger.OnAllKilledOrCaptured(OrdosSmallBase, function() Trigger.OnAllKilledOrCaptured(OrdosSmallBase, function()
Utils.Do(ordos_small.GetGroundAttackers(), IdleHunt) Utils.Do(OrdosSmall.GetGroundAttackers(), IdleHunt)
end) end)
local path = function() return Utils.Random(OrdosPaths) end local path = function() return Utils.Random(OrdosPaths) end
@@ -273,15 +273,15 @@ WorldLoaded = function()
unit.AttackMove(OrdosAttackLocation) unit.AttackMove(OrdosAttackLocation)
IdleHunt(unit) IdleHunt(unit)
end end
SendCarryallReinforcements(ordos_main, 0, OrdosAttackWaves[Difficulty], OrdosAttackDelay[Difficulty], path, OrdosReinforcements[Difficulty], waveCondition, huntFunction) SendCarryallReinforcements(OrdosMain, 0, OrdosAttackWaves[Difficulty], OrdosAttackDelay[Difficulty], path, OrdosReinforcements[Difficulty], waveCondition, huntFunction)
SendStarportReinforcements() SendStarportReinforcements()
Actor.Create("upgrade.barracks", true, { Owner = ordos_main }) Actor.Create("upgrade.barracks", true, { Owner = OrdosMain })
Actor.Create("upgrade.light", true, { Owner = ordos_main }) Actor.Create("upgrade.light", true, { Owner = OrdosMain })
Actor.Create("upgrade.heavy", true, { Owner = ordos_main }) Actor.Create("upgrade.heavy", true, { Owner = OrdosMain })
Actor.Create("upgrade.barracks", true, { Owner = ordos_small }) Actor.Create("upgrade.barracks", true, { Owner = OrdosSmall })
Actor.Create("upgrade.light", true, { Owner = ordos_small }) Actor.Create("upgrade.light", true, { Owner = OrdosSmall })
Trigger.AfterDelay(0, ActivateAI) Trigger.AfterDelay(0, ActivateAI)
SendHarkonnenReinforcements(DateTime.Minutes(2) + DateTime.Seconds(15), 2) SendHarkonnenReinforcements(DateTime.Minutes(2) + DateTime.Seconds(15), 2)

View File

@@ -27,11 +27,11 @@ OrdosTankTypes = { "combat_tank_o", "combat_tank_o", "siege_tank" }
OrdosStarportTypes = { "trike.starport", "trike.starport", "quad.starport", "combat_tank_o.starport", "combat_tank_o.starport", "siege_tank.starport", "missile_tank.starport" } OrdosStarportTypes = { "trike.starport", "trike.starport", "quad.starport", "combat_tank_o.starport", "combat_tank_o.starport", "siege_tank.starport", "missile_tank.starport" }
ActivateAI = function() ActivateAI = function()
IdlingUnits[ordos_main] = Reinforcements.Reinforce(ordos_main, InitialOrdosReinforcements[1], InitialOrdosPaths[1]), Reinforcements.Reinforce(ordos_main, InitialOrdosReinforcements[2], InitialOrdosPaths[2]) IdlingUnits[OrdosMain] = Reinforcements.Reinforce(OrdosMain, InitialOrdosReinforcements[1], InitialOrdosPaths[1]), Reinforcements.Reinforce(OrdosMain, InitialOrdosReinforcements[2], InitialOrdosPaths[2])
IdlingUnits[ordos_small] = Reinforcements.Reinforce(ordos_small, InitialOrdosReinforcements[1], InitialOrdosPaths[3]) IdlingUnits[OrdosSmall] = Reinforcements.Reinforce(OrdosSmall, InitialOrdosReinforcements[1], InitialOrdosPaths[3])
DefendAndRepairBase(ordos_main, OrdosMainBase, 0.75, AttackGroupSize[Difficulty]) DefendAndRepairBase(OrdosMain, OrdosMainBase, 0.75, AttackGroupSize[Difficulty])
DefendAndRepairBase(ordos_small, OrdosSmallBase, 0.75, AttackGroupSize[Difficulty]) DefendAndRepairBase(OrdosSmall, OrdosSmallBase, 0.75, AttackGroupSize[Difficulty])
local delay = function() return Utils.RandomInteger(AttackDelays[Difficulty][1], AttackDelays[Difficulty][2] + 1) end local delay = function() return Utils.RandomInteger(AttackDelays[Difficulty][1], AttackDelays[Difficulty][2] + 1) end
local infantryToBuild = function() return { Utils.Random(OrdosInfantryTypes) } end local infantryToBuild = function() return { Utils.Random(OrdosInfantryTypes) } end
@@ -40,11 +40,11 @@ ActivateAI = function()
local unitsToBuy = function() return { Utils.Random(OrdosStarportTypes) } end local unitsToBuy = function() return { Utils.Random(OrdosStarportTypes) } end
local attackThresholdSize = AttackGroupSize[Difficulty] * 2.5 local attackThresholdSize = AttackGroupSize[Difficulty] * 2.5
ProduceUnits(ordos_main, OBarracks1, delay, infantryToBuild, AttackGroupSize[Difficulty], attackThresholdSize) ProduceUnits(OrdosMain, OBarracks1, delay, infantryToBuild, AttackGroupSize[Difficulty], attackThresholdSize)
ProduceUnits(ordos_main, OLightFactory1, delay, vehilcesToBuild, AttackGroupSize[Difficulty], attackThresholdSize) ProduceUnits(OrdosMain, OLightFactory1, delay, vehilcesToBuild, AttackGroupSize[Difficulty], attackThresholdSize)
ProduceUnits(ordos_main, OHeavyFactory, delay, tanksToBuild, AttackGroupSize[Difficulty], attackThresholdSize) ProduceUnits(OrdosMain, OHeavyFactory, delay, tanksToBuild, AttackGroupSize[Difficulty], attackThresholdSize)
ProduceUnits(ordos_main, OStarport, delay, unitsToBuy, AttackGroupSize[Difficulty], attackThresholdSize) ProduceUnits(OrdosMain, OStarport, delay, unitsToBuy, AttackGroupSize[Difficulty], attackThresholdSize)
ProduceUnits(ordos_small, OBarracks2, delay, infantryToBuild, AttackGroupSize[Difficulty], attackThresholdSize) ProduceUnits(OrdosSmall, OBarracks2, delay, infantryToBuild, AttackGroupSize[Difficulty], attackThresholdSize)
ProduceUnits(ordos_small, OLightFactory2, delay, vehilcesToBuild, AttackGroupSize[Difficulty], attackThresholdSize) ProduceUnits(OrdosSmall, OLightFactory2, delay, vehilcesToBuild, AttackGroupSize[Difficulty], attackThresholdSize)
end end

View File

@@ -102,11 +102,11 @@ InitialOrdosPaths =
SendStarportReinforcements = function() SendStarportReinforcements = function()
Trigger.AfterDelay(OrdosStarportDelay[Difficulty], function() Trigger.AfterDelay(OrdosStarportDelay[Difficulty], function()
if OStarport.IsDead or OStarport.Owner ~= ordos_main then if OStarport.IsDead or OStarport.Owner ~= OrdosMain then
return return
end end
local units = Reinforcements.ReinforceWithTransport(ordos_main, "frigate", OrdosStarportReinforcements[Difficulty], { OrdosStarportEntry.Location, OStarport.Location + CVec.New(1, 1) }, { OrdosStarportExit.Location })[2] local units = Reinforcements.ReinforceWithTransport(OrdosMain, "frigate", OrdosStarportReinforcements[Difficulty], { OrdosStarportEntry.Location, OStarport.Location + CVec.New(1, 1) }, { OrdosStarportExit.Location })[2]
Utils.Do(units, function(unit) Utils.Do(units, function(unit)
unit.AttackMove(OrdosAttackLocation) unit.AttackMove(OrdosAttackLocation)
IdleHunt(unit) IdleHunt(unit)
@@ -130,25 +130,25 @@ end
CheckSmugglerEnemies = function() CheckSmugglerEnemies = function()
Utils.Do(SmugglerUnits, function(unit) Utils.Do(SmugglerUnits, function(unit)
Trigger.OnDamaged(unit, function(self, attacker) Trigger.OnDamaged(unit, function(self, attacker)
if unit.Owner == smuggler_neutral and attacker.Owner == player then if unit.Owner == SmugglerNeutral and attacker.Owner == Harkonnen then
ChangeOwner(smuggler_neutral, smuggler_harkonnen) ChangeOwner(SmugglerNeutral, SmugglerHarkonnen)
end end
if unit.Owner == smuggler_ordos and attacker.Owner == player then if unit.Owner == SmugglerOrdos and attacker.Owner == Harkonnen then
ChangeOwner(smuggler_ordos, smuggler_both) ChangeOwner(SmugglerOrdos, SmugglerBoth)
end end
if unit.Owner == smuggler_neutral and (attacker.Owner == ordos_main or attacker.Owner == ordos_small) then if unit.Owner == SmugglerNeutral and (attacker.Owner == OrdosMain or attacker.Owner == OrdosSmall) then
ChangeOwner(smuggler_neutral, smuggler_ordos) ChangeOwner(SmugglerNeutral, SmugglerOrdos)
end end
if unit.Owner == smuggler_harkonnen and (attacker.Owner == ordos_main or attacker.Owner == ordos_small) then if unit.Owner == SmugglerHarkonnen and (attacker.Owner == OrdosMain or attacker.Owner == OrdosSmall) then
ChangeOwner(smuggler_harkonnen, smuggler_both) ChangeOwner(SmugglerHarkonnen, SmugglerBoth)
end end
if attacker.Owner == player and not message_check then if attacker.Owner == Harkonnen and not MessageCheck then
message_check = true MessageCheck = true
Media.DisplayMessage(UserInterface.Translate("smugglers-now-hostile"), Mentat) Media.DisplayMessage(UserInterface.Translate("smugglers-now-hostile"), Mentat)
end end
end) end)
@@ -156,61 +156,61 @@ CheckSmugglerEnemies = function()
end end
Tick = function() Tick = function()
if player.HasNoRequiredUnits() then if Harkonnen.HasNoRequiredUnits() then
ordos_main.MarkCompletedObjective(KillHarkonnen1) OrdosMain.MarkCompletedObjective(KillHarkonnen1)
ordos_small.MarkCompletedObjective(KillHarkonnen2) OrdosSmall.MarkCompletedObjective(KillHarkonnen2)
end end
if ordos_main.HasNoRequiredUnits() and ordos_small.HasNoRequiredUnits() and not OrdosKilled then if OrdosMain.HasNoRequiredUnits() and OrdosSmall.HasNoRequiredUnits() and not OrdosKilled then
Media.DisplayMessage(UserInterface.Translate("ordos-annihilated"), Mentat) Media.DisplayMessage(UserInterface.Translate("ordos-annihilated"), Mentat)
OrdosKilled = true OrdosKilled = true
end end
if smuggler_neutral.HasNoRequiredUnits() and smuggler_harkonnen.HasNoRequiredUnits() and smuggler_ordos.HasNoRequiredUnits() and smuggler_both.HasNoRequiredUnits() and not SmugglersKilled then if SmugglerNeutral.HasNoRequiredUnits() and SmugglerHarkonnen.HasNoRequiredUnits() and SmugglerOrdos.HasNoRequiredUnits() and SmugglerBoth.HasNoRequiredUnits() and not SmugglersKilled then
Media.DisplayMessage(UserInterface.Translate("smugglers-annihilated"), Mentat) Media.DisplayMessage(UserInterface.Translate("smugglers-annihilated"), Mentat)
SmugglersKilled = true SmugglersKilled = true
end end
if (OStarport.IsDead or OStarport.Owner == player) and not player.IsObjectiveCompleted(DestroyStarport) then if (OStarport.IsDead or OStarport.Owner == Harkonnen) and not Harkonnen.IsObjectiveCompleted(DestroyStarport) then
player.MarkCompletedObjective(DestroyStarport) Harkonnen.MarkCompletedObjective(DestroyStarport)
end end
if DateTime.GameTime % DateTime.Seconds(10) == 0 and LastHarvesterEaten[ordos_main] then if DateTime.GameTime % DateTime.Seconds(10) == 0 and LastHarvesterEaten[OrdosMain] then
local units = ordos_main.GetActorsByType("harvester") local units = OrdosMain.GetActorsByType("harvester")
if #units > 0 then if #units > 0 then
LastHarvesterEaten[ordos_main] = false LastHarvesterEaten[OrdosMain] = false
ProtectHarvester(units[1], ordos_main, AttackGroupSize[Difficulty]) ProtectHarvester(units[1], OrdosMain, AttackGroupSize[Difficulty])
end end
end end
if DateTime.GameTime % DateTime.Seconds(10) == 0 and LastHarvesterEaten[ordos_small] then if DateTime.GameTime % DateTime.Seconds(10) == 0 and LastHarvesterEaten[OrdosSmall] then
local units = ordos_small.GetActorsByType("harvester") local units = OrdosSmall.GetActorsByType("harvester")
if #units > 0 then if #units > 0 then
LastHarvesterEaten[ordos_small] = false LastHarvesterEaten[OrdosSmall] = false
ProtectHarvester(units[1], ordos_small, AttackGroupSize[Difficulty]) ProtectHarvester(units[1], OrdosSmall, AttackGroupSize[Difficulty])
end end
end end
end end
WorldLoaded = function() WorldLoaded = function()
ordos_main = Player.GetPlayer("Ordos Main Base") OrdosMain = Player.GetPlayer("Ordos Main Base")
ordos_small = Player.GetPlayer("Ordos Small Base") OrdosSmall = Player.GetPlayer("Ordos Small Base")
smuggler_neutral = Player.GetPlayer("Smugglers - Neutral") SmugglerNeutral = Player.GetPlayer("Smugglers - Neutral")
smuggler_harkonnen = Player.GetPlayer("Smugglers - Enemy to Harkonnen") SmugglerHarkonnen = Player.GetPlayer("Smugglers - Enemy to Harkonnen")
smuggler_ordos = Player.GetPlayer("Smugglers - Enemy to Ordos") SmugglerOrdos = Player.GetPlayer("Smugglers - Enemy to Ordos")
smuggler_both = Player.GetPlayer("Smugglers - Enemy to Both") SmugglerBoth = Player.GetPlayer("Smugglers - Enemy to Both")
player = Player.GetPlayer("Harkonnen") Harkonnen = Player.GetPlayer("Harkonnen")
InitObjectives(player) InitObjectives(Harkonnen)
DestroyStarport = AddPrimaryObjective(player, "capture-destroy-ordos-starport") DestroyStarport = AddPrimaryObjective(Harkonnen, "capture-destroy-ordos-starport")
KillHarkonnen1 = AddPrimaryObjective(ordos_main, "") KillHarkonnen1 = AddPrimaryObjective(OrdosMain, "")
KillHarkonnen2 = AddPrimaryObjective(ordos_small, "") KillHarkonnen2 = AddPrimaryObjective(OrdosSmall, "")
-- Wait for carryall drop -- Wait for carryall drop
Trigger.AfterDelay(DateTime.Seconds(15), function() Trigger.AfterDelay(DateTime.Seconds(15), function()
SmugglerUnits = smuggler_neutral.GetActors() SmugglerUnits = SmugglerNeutral.GetActors()
CheckSmugglerEnemies() CheckSmugglerEnemies()
end) end)
@@ -218,11 +218,11 @@ WorldLoaded = function()
OrdosAttackLocation = HConYard.Location OrdosAttackLocation = HConYard.Location
Trigger.OnAllKilledOrCaptured(OrdosMainBase, function() Trigger.OnAllKilledOrCaptured(OrdosMainBase, function()
Utils.Do(ordos_main.GetGroundAttackers(), IdleHunt) Utils.Do(OrdosMain.GetGroundAttackers(), IdleHunt)
end) end)
Trigger.OnAllKilledOrCaptured(OrdosSmallBase, function() Trigger.OnAllKilledOrCaptured(OrdosSmallBase, function()
Utils.Do(ordos_small.GetGroundAttackers(), IdleHunt) Utils.Do(OrdosSmall.GetGroundAttackers(), IdleHunt)
end) end)
local path = function() return Utils.Random(OrdosPaths) end local path = function() return Utils.Random(OrdosPaths) end
@@ -231,14 +231,14 @@ WorldLoaded = function()
unit.AttackMove(OrdosAttackLocation) unit.AttackMove(OrdosAttackLocation)
IdleHunt(unit) IdleHunt(unit)
end end
SendCarryallReinforcements(ordos_main, 0, OrdosAttackWaves[Difficulty], OrdosAttackDelay[Difficulty], path, OrdosReinforcements[Difficulty], waveCondition, huntFunction) SendCarryallReinforcements(OrdosMain, 0, OrdosAttackWaves[Difficulty], OrdosAttackDelay[Difficulty], path, OrdosReinforcements[Difficulty], waveCondition, huntFunction)
SendStarportReinforcements() SendStarportReinforcements()
Actor.Create("upgrade.barracks", true, { Owner = ordos_main }) Actor.Create("upgrade.barracks", true, { Owner = OrdosMain })
Actor.Create("upgrade.light", true, { Owner = ordos_main }) Actor.Create("upgrade.light", true, { Owner = OrdosMain })
Actor.Create("upgrade.heavy", true, { Owner = ordos_main }) Actor.Create("upgrade.heavy", true, { Owner = OrdosMain })
Actor.Create("upgrade.barracks", true, { Owner = ordos_small }) Actor.Create("upgrade.barracks", true, { Owner = OrdosSmall })
Actor.Create("upgrade.light", true, { Owner = ordos_small }) Actor.Create("upgrade.light", true, { Owner = OrdosSmall })
Trigger.AfterDelay(0, ActivateAI) Trigger.AfterDelay(0, ActivateAI)
end end

View File

@@ -37,13 +37,13 @@ AtreidesStarportTypes = { "trike.starport", "trike.starport", "quad.starport", "
CorrinoInfantryTypes = { "light_inf", "trooper", "sardaukar" } CorrinoInfantryTypes = { "light_inf", "trooper", "sardaukar" }
ActivateAI = function() ActivateAI = function()
IdlingUnits[atreides_main] = Reinforcements.Reinforce(atreides_main, InitialAtreidesReinforcements[Difficulty][1], InitialAtreidesPaths[1]), Reinforcements.Reinforce(atreides_main, InitialAtreidesReinforcements[Difficulty][2], InitialAtreidesPaths[2]) IdlingUnits[AtreidesMain] = Reinforcements.Reinforce(AtreidesMain, InitialAtreidesReinforcements[Difficulty][1], InitialAtreidesPaths[1]), Reinforcements.Reinforce(AtreidesMain, InitialAtreidesReinforcements[Difficulty][2], InitialAtreidesPaths[2])
IdlingUnits[atreides_small] = Reinforcements.Reinforce(atreides_small, InitialAtreidesReinforcements[Difficulty][1], InitialAtreidesPaths[3]) IdlingUnits[AtreidesSmall] = Reinforcements.Reinforce(AtreidesSmall, InitialAtreidesReinforcements[Difficulty][1], InitialAtreidesPaths[3])
IdlingUnits[corrino] = Reinforcements.Reinforce(corrino, InitialCorrinoReinforcements, InitialCorrinoPath) IdlingUnits[Corrino] = Reinforcements.Reinforce(Corrino, InitialCorrinoReinforcements, InitialCorrinoPath)
DefendAndRepairBase(atreides_main, AtreidesMainBase, 0.75, AttackGroupSize[Difficulty]) DefendAndRepairBase(AtreidesMain, AtreidesMainBase, 0.75, AttackGroupSize[Difficulty])
DefendAndRepairBase(atreides_small, AtreidesSmallBase, 0.75, AttackGroupSize[Difficulty]) DefendAndRepairBase(AtreidesSmall, AtreidesSmallBase, 0.75, AttackGroupSize[Difficulty])
DefendAndRepairBase(corrino, CorrinoBase, 0.75, AttackGroupSize[Difficulty]) DefendAndRepairBase(Corrino, CorrinoBase, 0.75, AttackGroupSize[Difficulty])
local delay = function() return Utils.RandomInteger(AttackDelays[Difficulty][1], AttackDelays[Difficulty][2] + 1) end local delay = function() return Utils.RandomInteger(AttackDelays[Difficulty][1], AttackDelays[Difficulty][2] + 1) end
local infantryToBuildAtreides = function() return { Utils.Random(AtreidesInfantryTypes) } end local infantryToBuildAtreides = function() return { Utils.Random(AtreidesInfantryTypes) } end
@@ -55,13 +55,13 @@ ActivateAI = function()
local attackThresholdSize = AttackGroupSize[Difficulty] * 2.5 local attackThresholdSize = AttackGroupSize[Difficulty] * 2.5
Trigger.AfterDelay(InitialProductionDelay[Difficulty], function() Trigger.AfterDelay(InitialProductionDelay[Difficulty], function()
ProduceUnits(atreides_main, ALightFactory1, delay, vehilcesToBuild, AttackGroupSize[Difficulty], attackThresholdSize) ProduceUnits(AtreidesMain, ALightFactory1, delay, vehilcesToBuild, AttackGroupSize[Difficulty], attackThresholdSize)
ProduceUnits(atreides_main, AHeavyFactory1, delay, tanksToBuildMain, AttackGroupSize[Difficulty], attackThresholdSize) ProduceUnits(AtreidesMain, AHeavyFactory1, delay, tanksToBuildMain, AttackGroupSize[Difficulty], attackThresholdSize)
ProduceUnits(atreides_main, AStarport, delay, unitsToBuy, AttackGroupSize[Difficulty], attackThresholdSize) ProduceUnits(AtreidesMain, AStarport, delay, unitsToBuy, AttackGroupSize[Difficulty], attackThresholdSize)
ProduceUnits(atreides_small, ABarracks, delay, infantryToBuildAtreides, AttackGroupSize[Difficulty], attackThresholdSize) ProduceUnits(AtreidesSmall, ABarracks, delay, infantryToBuildAtreides, AttackGroupSize[Difficulty], attackThresholdSize)
ProduceUnits(atreides_small, AHeavyFactory2, delay, tanksToBuildSmall, AttackGroupSize[Difficulty], attackThresholdSize) ProduceUnits(AtreidesSmall, AHeavyFactory2, delay, tanksToBuildSmall, AttackGroupSize[Difficulty], attackThresholdSize)
ProduceUnits(corrino, CBarracks, delay, infantryToBuildCorrino, AttackGroupSize[Difficulty], attackThresholdSize) ProduceUnits(Corrino, CBarracks, delay, infantryToBuildCorrino, AttackGroupSize[Difficulty], attackThresholdSize)
end) end)
end end

View File

@@ -124,9 +124,9 @@ HarkonnenPaths =
} }
SendHarkonnenReinforcements = function(number) SendHarkonnenReinforcements = function(number)
Reinforcements.ReinforceWithTransport(player, "carryall.reinforce", HarkonnenReinforcements[Difficulty][number], HarkonnenPaths[number], { HarkonnenPaths[number][1] }) Reinforcements.ReinforceWithTransport(Harkonnen, "carryall.reinforce", HarkonnenReinforcements[Difficulty][number], HarkonnenPaths[number], { HarkonnenPaths[number][1] })
Trigger.AfterDelay(DateTime.Seconds(9), function() Trigger.AfterDelay(DateTime.Seconds(9), function()
Media.PlaySpeechNotification(player, "Reinforce") Media.PlaySpeechNotification(Harkonnen, "Reinforce")
end) end)
end end
@@ -152,7 +152,7 @@ SendAirStrike = function()
return return
end end
local targets = Utils.Where(player.GetActors(), function(actor) local targets = Utils.Where(Harkonnen.GetActors(), function(actor)
return return
actor.HasProperty("Sell") and actor.HasProperty("Sell") and
actor.Type ~= "wall" and actor.Type ~= "wall" and
@@ -170,63 +170,63 @@ SendAirStrike = function()
end end
Tick = function() Tick = function()
if player.HasNoRequiredUnits() then if Harkonnen.HasNoRequiredUnits() then
atreides_main.MarkCompletedObjective(KillHarkonnen1) AtreidesMain.MarkCompletedObjective(KillHarkonnen1)
atreides_small.MarkCompletedObjective(KillHarkonnen2) AtreidesSmall.MarkCompletedObjective(KillHarkonnen2)
corrino.MarkCompletedObjective(KillHarkonnen3) Corrino.MarkCompletedObjective(KillHarkonnen3)
end end
if atreides_main.HasNoRequiredUnits() and atreides_small.HasNoRequiredUnits() and not player.IsObjectiveCompleted(KillAtreides) then if AtreidesMain.HasNoRequiredUnits() and AtreidesSmall.HasNoRequiredUnits() and not Harkonnen.IsObjectiveCompleted(KillAtreides) then
Media.DisplayMessage(UserInterface.Translate("atreides-annihilated"), Mentat) Media.DisplayMessage(UserInterface.Translate("atreides-annihilated"), Mentat)
player.MarkCompletedObjective(KillAtreides) Harkonnen.MarkCompletedObjective(KillAtreides)
end end
if corrino.HasNoRequiredUnits() and not player.IsObjectiveCompleted(KillCorrino) then if Corrino.HasNoRequiredUnits() and not Harkonnen.IsObjectiveCompleted(KillCorrino) then
Media.DisplayMessage(UserInterface.Translate("emperor-annihilated"), Mentat) Media.DisplayMessage(UserInterface.Translate("emperor-annihilated"), Mentat)
player.MarkCompletedObjective(KillCorrino) Harkonnen.MarkCompletedObjective(KillCorrino)
end end
if (HEngineer.IsDead or AConYard2.IsDead) and not player.IsObjectiveCompleted(CaptureAtreidesConYard) then if (HEngineer.IsDead or AConYard2.IsDead) and not Harkonnen.IsObjectiveCompleted(CaptureAtreidesConYard) then
player.MarkFailedObjective(CaptureAtreidesConYard) Harkonnen.MarkFailedObjective(CaptureAtreidesConYard)
end end
if (AHiTechFactory.IsDead or AHiTechFactory.Owner ~= atreides_main) and not HiTechIsDead then if (AHiTechFactory.IsDead or AHiTechFactory.Owner ~= AtreidesMain) and not HiTechIsDead then
Media.DisplayMessage(UserInterface.Translate("high-tech-factory-neutralized-imperial-reinforcements"), Mentat) Media.DisplayMessage(UserInterface.Translate("high-tech-factory-neutralized-imperial-reinforcements"), Mentat)
HiTechIsDead = true HiTechIsDead = true
end end
if DateTime.GameTime % DateTime.Seconds(10) == 0 and LastHarvesterEaten[ordos_main] then if DateTime.GameTime % DateTime.Seconds(10) == 0 and LastHarvesterEaten[OrdosMain] then
local units = ordos_main.GetActorsByType("harvester") local units = OrdosMain.GetActorsByType("harvester")
if #units > 0 then if #units > 0 then
LastHarvesterEaten[ordos_main] = false LastHarvesterEaten[OrdosMain] = false
ProtectHarvester(units[1], ordos_main, AttackGroupSize[Difficulty]) ProtectHarvester(units[1], OrdosMain, AttackGroupSize[Difficulty])
end end
end end
if DateTime.GameTime % DateTime.Seconds(10) == 0 and LastHarvesterEaten[ordos_small] then if DateTime.GameTime % DateTime.Seconds(10) == 0 and LastHarvesterEaten[OrdosSmall] then
local units = ordos_small.GetActorsByType("harvester") local units = OrdosSmall.GetActorsByType("harvester")
if #units > 0 then if #units > 0 then
LastHarvesterEaten[ordos_small] = false LastHarvesterEaten[OrdosSmall] = false
ProtectHarvester(units[1], ordos_small, AttackGroupSize[Difficulty]) ProtectHarvester(units[1], OrdosSmall, AttackGroupSize[Difficulty])
end end
end end
end end
WorldLoaded = function() WorldLoaded = function()
atreides_main = Player.GetPlayer("Atreides Main Base") AtreidesMain = Player.GetPlayer("Atreides Main Base")
atreides_small = Player.GetPlayer("Atreides Small Base") AtreidesSmall = Player.GetPlayer("Atreides Small Base")
corrino = Player.GetPlayer("Corrino") Corrino = Player.GetPlayer("Corrino")
player = Player.GetPlayer("Harkonnen") Harkonnen = Player.GetPlayer("Harkonnen")
InitObjectives(player) InitObjectives(Harkonnen)
CaptureAtreidesConYard = AddPrimaryObjective(player, "capture-atreides-construction-yard-south") CaptureAtreidesConYard = AddPrimaryObjective(Harkonnen, "capture-atreides-construction-yard-south")
KillAtreides = AddPrimaryObjective(player, "destroy-atreides") KillAtreides = AddPrimaryObjective(Harkonnen, "destroy-atreides")
KillCorrino = AddPrimaryObjective(player, "destroy-corrino") KillCorrino = AddPrimaryObjective(Harkonnen, "destroy-corrino")
KillHarkonnen1 = AddPrimaryObjective(atreides_main, "") KillHarkonnen1 = AddPrimaryObjective(AtreidesMain, "")
KillHarkonnen2 = AddPrimaryObjective(atreides_small, "") KillHarkonnen2 = AddPrimaryObjective(AtreidesSmall, "")
KillHarkonnen3 = AddPrimaryObjective(corrino, "") KillHarkonnen3 = AddPrimaryObjective(Corrino, "")
Media.DisplayMessage(UserInterface.Translate("destroy-atreides-high-tech-factory-imperial-reinforcements"), Mentat) Media.DisplayMessage(UserInterface.Translate("destroy-atreides-high-tech-factory-imperial-reinforcements"), Mentat)
@@ -236,39 +236,39 @@ WorldLoaded = function()
Trigger.AfterDelay(DateTime.Minutes(5), SendAirStrike) Trigger.AfterDelay(DateTime.Minutes(5), SendAirStrike)
Trigger.OnCapture(AConYard2, function() Trigger.OnCapture(AConYard2, function()
player.MarkCompletedObjective(CaptureAtreidesConYard) Harkonnen.MarkCompletedObjective(CaptureAtreidesConYard)
end) end)
Trigger.OnAllKilledOrCaptured(AtreidesMainBase, function() Trigger.OnAllKilledOrCaptured(AtreidesMainBase, function()
Utils.Do(atreides_main.GetGroundAttackers(), IdleHunt) Utils.Do(AtreidesMain.GetGroundAttackers(), IdleHunt)
end) end)
Trigger.OnAllKilledOrCaptured(AtreidesSmallBase, function() Trigger.OnAllKilledOrCaptured(AtreidesSmallBase, function()
Utils.Do(atreides_small.GetGroundAttackers(), IdleHunt) Utils.Do(AtreidesSmall.GetGroundAttackers(), IdleHunt)
end) end)
Trigger.OnAllKilledOrCaptured(CorrinoBase, function() Trigger.OnAllKilledOrCaptured(CorrinoBase, function()
Utils.Do(corrino.GetGroundAttackers(), IdleHunt) Utils.Do(Corrino.GetGroundAttackers(), IdleHunt)
end) end)
local atreidesWaveCondition = function() return player.IsObjectiveCompleted(KillAtreides) or HiTechIsDead end local atreidesWaveCondition = function() return Harkonnen.IsObjectiveCompleted(KillAtreides) or HiTechIsDead end
local corrinoWaveCondition = function() return player.IsObjectiveCompleted(KillCorrino) or HiTechIsDead end local corrinoWaveCondition = function() return Harkonnen.IsObjectiveCompleted(KillCorrino) or HiTechIsDead end
local huntFunction = function(unit) local huntFunction = function(unit)
unit.AttackMove(AtreidesAttackLocation) unit.AttackMove(AtreidesAttackLocation)
IdleHunt(unit) IdleHunt(unit)
end end
SendEnemyReinforcements(atreides_main, EnemyAttackDelay[Difficulty], AtreidesPath, AtreidesReinforcements[Difficulty], atreidesWaveCondition, huntFunction) SendEnemyReinforcements(AtreidesMain, EnemyAttackDelay[Difficulty], AtreidesPath, AtreidesReinforcements[Difficulty], atreidesWaveCondition, huntFunction)
Trigger.AfterDelay(CorrinoInitialAttackDelay[Difficulty], function() Trigger.AfterDelay(CorrinoInitialAttackDelay[Difficulty], function()
SendEnemyReinforcements(corrino, EnemyAttackDelay[Difficulty], CorrinoPaths[1], CorrinoReinforcements[Difficulty][1], corrinoWaveCondition, huntFunction) SendEnemyReinforcements(Corrino, EnemyAttackDelay[Difficulty], CorrinoPaths[1], CorrinoReinforcements[Difficulty][1], corrinoWaveCondition, huntFunction)
SendEnemyReinforcements(corrino, EnemyAttackDelay[Difficulty], CorrinoPaths[2], CorrinoReinforcements[Difficulty][2], corrinoWaveCondition, huntFunction) SendEnemyReinforcements(Corrino, EnemyAttackDelay[Difficulty], CorrinoPaths[2], CorrinoReinforcements[Difficulty][2], corrinoWaveCondition, huntFunction)
end) end)
Actor.Create("upgrade.light", true, { Owner = atreides_main }) Actor.Create("upgrade.light", true, { Owner = AtreidesMain })
Actor.Create("upgrade.heavy", true, { Owner = atreides_main }) Actor.Create("upgrade.heavy", true, { Owner = AtreidesMain })
Actor.Create("upgrade.hightech", true, { Owner = atreides_main }) Actor.Create("upgrade.hightech", true, { Owner = AtreidesMain })
Actor.Create("upgrade.barracks", true, { Owner = atreides_small }) Actor.Create("upgrade.barracks", true, { Owner = AtreidesSmall })
Actor.Create("upgrade.heavy", true, { Owner = atreides_small }) Actor.Create("upgrade.heavy", true, { Owner = AtreidesSmall })
Actor.Create("upgrade.barracks", true, { Owner = corrino }) Actor.Create("upgrade.barracks", true, { Owner = Corrino })
Trigger.AfterDelay(0, ActivateAI) Trigger.AfterDelay(0, ActivateAI)
SendHarkonnenReinforcements(1) SendHarkonnenReinforcements(1)

View File

@@ -34,15 +34,15 @@ AtreidesStarportTypes = { "trike.starport", "trike.starport", "quad.starport", "
MercenaryTankTypes = { "combat_tank_o", "combat_tank_o", "siege_tank" } MercenaryTankTypes = { "combat_tank_o", "combat_tank_o", "siege_tank" }
ActivateAI = function() ActivateAI = function()
IdlingUnits[ordos] = Reinforcements.Reinforce(ordos, InitialOrdosReinforcements[1], InitialOrdosPaths[1]), Reinforcements.Reinforce(ordos, InitialOrdosReinforcements[2], InitialOrdosPaths[2]) IdlingUnits[Ordos] = Reinforcements.Reinforce(Ordos, InitialOrdosReinforcements[1], InitialOrdosPaths[1]), Reinforcements.Reinforce(Ordos, InitialOrdosReinforcements[2], InitialOrdosPaths[2])
IdlingUnits[atreides_enemy] = Reinforcements.Reinforce(atreides_enemy, InitialAtreidesReinforcements, InitialAtreidesPath) IdlingUnits[AtreidesEnemy] = Reinforcements.Reinforce(AtreidesEnemy, InitialAtreidesReinforcements, InitialAtreidesPath)
IdlingUnits[atreides_neutral] = { } IdlingUnits[AtreidesNeutral] = { }
IdlingUnits[mercenary_enemy] = Reinforcements.Reinforce(mercenary_enemy, InitialMercenaryReinforcements, InitialMercenaryPath) IdlingUnits[MercenaryEnemy] = Reinforcements.Reinforce(MercenaryEnemy, InitialMercenaryReinforcements, InitialMercenaryPath)
IdlingUnits[mercenary_ally] = { } IdlingUnits[MercenaryAlly] = { }
DefendAndRepairBase(ordos, OrdosBase, 0.75, AttackGroupSize[Difficulty]) DefendAndRepairBase(Ordos, OrdosBase, 0.75, AttackGroupSize[Difficulty])
DefendAndRepairBase(atreides_enemy, AtreidesBase, 0.75, AttackGroupSize[Difficulty]) DefendAndRepairBase(AtreidesEnemy, AtreidesBase, 0.75, AttackGroupSize[Difficulty])
DefendAndRepairBase(mercenary_enemy, MercenaryBase, 0.75, AttackGroupSize[Difficulty]) DefendAndRepairBase(MercenaryEnemy, MercenaryBase, 0.75, AttackGroupSize[Difficulty])
local delay = function() return Utils.RandomInteger(AttackDelays[Difficulty][1], AttackDelays[Difficulty][2] + 1) end local delay = function() return Utils.RandomInteger(AttackDelays[Difficulty][1], AttackDelays[Difficulty][2] + 1) end
local infantryToBuild = function() return { Utils.Random(EnemyInfantryTypes) } end local infantryToBuild = function() return { Utils.Random(EnemyInfantryTypes) } end
@@ -55,15 +55,15 @@ ActivateAI = function()
local unitsToBuyAtreides = function() return { Utils.Random(AtreidesStarportTypes) } end local unitsToBuyAtreides = function() return { Utils.Random(AtreidesStarportTypes) } end
local attackThresholdSize = AttackGroupSize[Difficulty] * 2.5 local attackThresholdSize = AttackGroupSize[Difficulty] * 2.5
ProduceUnits(ordos, OBarracks1, delay, infantryToBuild, AttackGroupSize[Difficulty], attackThresholdSize) ProduceUnits(Ordos, OBarracks1, delay, infantryToBuild, AttackGroupSize[Difficulty], attackThresholdSize)
ProduceUnits(ordos, OLightFactory, delay, vehilcesToBuildOrdos, AttackGroupSize[Difficulty], attackThresholdSize) ProduceUnits(Ordos, OLightFactory, delay, vehilcesToBuildOrdos, AttackGroupSize[Difficulty], attackThresholdSize)
ProduceUnits(ordos, OHeavyFactory, delay, tanksToBuildOrdos, AttackGroupSize[Difficulty], attackThresholdSize) ProduceUnits(Ordos, OHeavyFactory, delay, tanksToBuildOrdos, AttackGroupSize[Difficulty], attackThresholdSize)
ProduceUnits(ordos, OStarport, delay, unitsToBuyOrdos, AttackGroupSize[Difficulty], attackThresholdSize) ProduceUnits(Ordos, OStarport, delay, unitsToBuyOrdos, AttackGroupSize[Difficulty], attackThresholdSize)
ProduceUnits(atreides_enemy, ABarracks1, delay, infantryToBuild, AttackGroupSize[Difficulty], attackThresholdSize) ProduceUnits(AtreidesEnemy, ABarracks1, delay, infantryToBuild, AttackGroupSize[Difficulty], attackThresholdSize)
ProduceUnits(atreides_enemy, ALightFactory, delay, vehilcesToBuildAtreides, AttackGroupSize[Difficulty], attackThresholdSize) ProduceUnits(AtreidesEnemy, ALightFactory, delay, vehilcesToBuildAtreides, AttackGroupSize[Difficulty], attackThresholdSize)
ProduceUnits(atreides_enemy, AHeavyFactory, delay, tanksToBuildAtreides, AttackGroupSize[Difficulty], attackThresholdSize) ProduceUnits(AtreidesEnemy, AHeavyFactory, delay, tanksToBuildAtreides, AttackGroupSize[Difficulty], attackThresholdSize)
ProduceUnits(atreides_enemy, AStarport, delay, unitsToBuyAtreides, AttackGroupSize[Difficulty], attackThresholdSize) ProduceUnits(AtreidesEnemy, AStarport, delay, unitsToBuyAtreides, AttackGroupSize[Difficulty], attackThresholdSize)
ProduceUnits(mercenary_enemy, MHeavyFactory, delay, tanksToBuildMercenary, AttackGroupSize[Difficulty], attackThresholdSize) ProduceUnits(MercenaryEnemy, MHeavyFactory, delay, tanksToBuildMercenary, AttackGroupSize[Difficulty], attackThresholdSize)
end end

View File

@@ -105,7 +105,7 @@ SendStarportReinforcements = function(faction)
return return
end end
reinforcements = Utils.Random(MercenaryStarportReinforcements) local reinforcements = Utils.Random(MercenaryStarportReinforcements)
local units = Reinforcements.ReinforceWithTransport(faction, "frigate", reinforcements, { MercenaryStarportEntry.Location, MStarport.Location + CVec.New(1, 1) }, { MercenaryStarportExit.Location })[2] local units = Reinforcements.ReinforceWithTransport(faction, "frigate", reinforcements, { MercenaryStarportEntry.Location, MStarport.Location + CVec.New(1, 1) }, { MercenaryStarportExit.Location })[2]
Utils.Do(units, function(unit) Utils.Do(units, function(unit)
@@ -118,11 +118,11 @@ SendStarportReinforcements = function(faction)
end end
SendAirStrike = function() SendAirStrike = function()
if AHiTechFactory.IsDead or AHiTechFactory.Owner ~= atreides_enemy then if AHiTechFactory.IsDead or AHiTechFactory.Owner ~= AtreidesEnemy then
return return
end end
local targets = Utils.Where(player.GetActors(), function(actor) local targets = Utils.Where(Harkonnen.GetActors(), function(actor)
return return
actor.HasProperty("Sell") and actor.HasProperty("Sell") and
actor.Type ~= "wall" and actor.Type ~= "wall" and
@@ -151,13 +151,13 @@ GetSaboteurTargets = function(player)
end end
BuildSaboteur = function() BuildSaboteur = function()
if OPalace.IsDead or OPalace.Owner ~= ordos then if OPalace.IsDead or OPalace.Owner ~= Ordos then
return return
end end
local targets = GetSaboteurTargets(player) local targets = GetSaboteurTargets(Harkonnen)
if #targets > 0 then if #targets > 0 then
local saboteur = Actor.Create("saboteur", true, { Owner = ordos, Location = OPalace.Location + CVec.New(0, 2) }) local saboteur = Actor.Create("saboteur", true, { Owner = Ordos, Location = OPalace.Location + CVec.New(0, 2) })
saboteur.Move(saboteur.Location + CVec.New(0, 1)) saboteur.Move(saboteur.Location + CVec.New(0, 1))
saboteur.Wait(DateTime.Seconds(5)) saboteur.Wait(DateTime.Seconds(5))
@@ -173,7 +173,7 @@ BuildSaboteur = function()
end end
SendSaboteur = function(saboteur) SendSaboteur = function(saboteur)
local targets = GetSaboteurTargets(player) local targets = GetSaboteurTargets(Harkonnen)
if #targets < 1 then if #targets < 1 then
return return
end end
@@ -188,19 +188,19 @@ SendSaboteur = function(saboteur)
end end
CheckAttackToAtreides = function() CheckAttackToAtreides = function()
AtreidesUnits = atreides_neutral.GetActors() AtreidesUnits = AtreidesNeutral.GetActors()
Utils.Do(AtreidesUnits, function(unit) Utils.Do(AtreidesUnits, function(unit)
Trigger.OnDamaged(unit, function(self, attacker) Trigger.OnDamaged(unit, function(self, attacker)
if attacker.Owner == player and not check then if attacker.Owner == Harkonnen and not Check then
ChangeOwner(atreides_neutral, atreides_enemy) ChangeOwner(AtreidesNeutral, AtreidesEnemy)
-- Ensure that harvesters that was on a carryall switched sides. -- Ensure that harvesters that was on a carryall switched sides.
Trigger.AfterDelay(DateTime.Seconds(15), function() Trigger.AfterDelay(DateTime.Seconds(15), function()
ChangeOwner(atreides_neutral, atreides_enemy) ChangeOwner(AtreidesNeutral, AtreidesEnemy)
end) end)
check = true Check = true
Media.DisplayMessage(UserInterface.Translate("atreides-hostile"), Mentat) Media.DisplayMessage(UserInterface.Translate("atreides-hostile"), Mentat)
end end
end) end)
@@ -217,59 +217,59 @@ ChangeOwner = function(old_owner, new_owner)
end end
Tick = function() Tick = function()
if player.HasNoRequiredUnits() then if Harkonnen.HasNoRequiredUnits() then
ordos.MarkCompletedObjective(KillHarkonnen1) Ordos.MarkCompletedObjective(KillHarkonnen1)
atreides_enemy.MarkCompletedObjective(KillHarkonnen2) AtreidesEnemy.MarkCompletedObjective(KillHarkonnen2)
end end
if ordos.HasNoRequiredUnits() and not player.IsObjectiveCompleted(KillOrdos) then if Ordos.HasNoRequiredUnits() and not Harkonnen.IsObjectiveCompleted(KillOrdos) then
Media.DisplayMessage(UserInterface.Translate("ordos-annihilated"), Mentat) Media.DisplayMessage(UserInterface.Translate("ordos-annihilated"), Mentat)
player.MarkCompletedObjective(KillOrdos) Harkonnen.MarkCompletedObjective(KillOrdos)
end end
if atreides_enemy.HasNoRequiredUnits() and atreides_neutral.HasNoRequiredUnits() and not player.IsObjectiveCompleted(KillAtreides) then if AtreidesEnemy.HasNoRequiredUnits() and AtreidesNeutral.HasNoRequiredUnits() and not Harkonnen.IsObjectiveCompleted(KillAtreides) then
Media.DisplayMessage(UserInterface.Translate("atreides-annihilated"), Mentat) Media.DisplayMessage(UserInterface.Translate("atreides-annihilated"), Mentat)
player.MarkCompletedObjective(KillAtreides) Harkonnen.MarkCompletedObjective(KillAtreides)
end end
if mercenary_enemy.HasNoRequiredUnits() and mercenary_ally.HasNoRequiredUnits() and not MercenariesDestroyed then if MercenaryEnemy.HasNoRequiredUnits() and MercenaryAlly.HasNoRequiredUnits() and not MercenariesDestroyed then
Media.DisplayMessage(UserInterface.Translate("mercenaries-annihilated"), Mentat) Media.DisplayMessage(UserInterface.Translate("mercenaries-annihilated"), Mentat)
MercenariesDestroyed = true MercenariesDestroyed = true
end end
if DateTime.GameTime % DateTime.Seconds(10) == 0 and LastHarvesterEaten[ordos] then if DateTime.GameTime % DateTime.Seconds(10) == 0 and LastHarvesterEaten[Ordos] then
local units = ordos.GetActorsByType("harvester") local units = Ordos.GetActorsByType("harvester")
if #units > 0 then if #units > 0 then
LastHarvesterEaten[ordos] = false LastHarvesterEaten[Ordos] = false
ProtectHarvester(units[1], ordos, AttackGroupSize[Difficulty]) ProtectHarvester(units[1], Ordos, AttackGroupSize[Difficulty])
end end
end end
if DateTime.GameTime % DateTime.Seconds(10) == 0 and LastHarvesterEaten[atreides_enemy] then if DateTime.GameTime % DateTime.Seconds(10) == 0 and LastHarvesterEaten[AtreidesEnemy] then
local units = atreides_enemy.GetActorsByType("harvester") local units = AtreidesEnemy.GetActorsByType("harvester")
if #units > 0 then if #units > 0 then
LastHarvesterEaten[atreides_enemy] = false LastHarvesterEaten[AtreidesEnemy] = false
ProtectHarvester(units[1], atreides_enemy, AttackGroupSize[Difficulty]) ProtectHarvester(units[1], AtreidesEnemy, AttackGroupSize[Difficulty])
end end
end end
end end
WorldLoaded = function() WorldLoaded = function()
ordos = Player.GetPlayer("Ordos") Ordos = Player.GetPlayer("Ordos")
atreides_enemy = Player.GetPlayer("Ordos Aligned Atreides") AtreidesEnemy = Player.GetPlayer("Ordos Aligned Atreides")
atreides_neutral = Player.GetPlayer("Neutral Atreides") AtreidesNeutral = Player.GetPlayer("Neutral Atreides")
mercenary_enemy = Player.GetPlayer("Ordos Aligned Mercenaries") MercenaryEnemy = Player.GetPlayer("Ordos Aligned Mercenaries")
mercenary_ally = Player.GetPlayer("Harkonnen Aligned Mercenaries") MercenaryAlly = Player.GetPlayer("Harkonnen Aligned Mercenaries")
player = Player.GetPlayer("Harkonnen") Harkonnen = Player.GetPlayer("Harkonnen")
InitObjectives(player) InitObjectives(Harkonnen)
KillOrdos = AddPrimaryObjective(player, "destroy-ordos") KillOrdos = AddPrimaryObjective(Harkonnen, "destroy-ordos")
KillAtreides = AddSecondaryObjective(player, "destroy-atreides") KillAtreides = AddSecondaryObjective(Harkonnen, "destroy-atreides")
AllyWithMercenaries = AddSecondaryObjective(player, "ally-mercenaries") AllyWithMercenaries = AddSecondaryObjective(Harkonnen, "ally-mercenaries")
KillHarkonnen1 = AddPrimaryObjective(ordos, "") KillHarkonnen1 = AddPrimaryObjective(Ordos, "")
KillHarkonnen2 = AddPrimaryObjective(atreides_enemy, "") KillHarkonnen2 = AddPrimaryObjective(AtreidesEnemy, "")
Camera.Position = HMCV.CenterPosition Camera.Position = HMCV.CenterPosition
OrdosAttackLocation = HMCV.Location OrdosAttackLocation = HMCV.Location
@@ -279,66 +279,66 @@ WorldLoaded = function()
Trigger.AfterDelay(DateTime.Minutes(1) + DateTime.Seconds(30), BuildSaboteur) Trigger.AfterDelay(DateTime.Minutes(1) + DateTime.Seconds(30), BuildSaboteur)
Trigger.OnCapture(MHeavyFactory, function() Trigger.OnCapture(MHeavyFactory, function()
player.MarkCompletedObjective(AllyWithMercenaries) Harkonnen.MarkCompletedObjective(AllyWithMercenaries)
Media.DisplayMessage(UserInterface.Translate("mercenary-leader-captured-allied"), Mentat) Media.DisplayMessage(UserInterface.Translate("mercenary-leader-captured-allied"), Mentat)
MercenaryAttackLocation = MercenaryAttackPoint.Location MercenaryAttackLocation = MercenaryAttackPoint.Location
ChangeOwner(mercenary_enemy, mercenary_ally) ChangeOwner(MercenaryEnemy, MercenaryAlly)
SendStarportReinforcements(mercenary_ally) SendStarportReinforcements(MercenaryAlly)
DefendAndRepairBase(mercenary_ally, MercenaryBase, 0.75, AttackGroupSize[Difficulty]) DefendAndRepairBase(MercenaryAlly, MercenaryBase, 0.75, AttackGroupSize[Difficulty])
IdlingUnits[mercenary_ally] = IdlingUnits[mercenary_enemy] IdlingUnits[MercenaryAlly] = IdlingUnits[MercenaryEnemy]
end) end)
Trigger.OnKilled(MHeavyFactory, function() Trigger.OnKilled(MHeavyFactory, function()
if not player.IsObjectiveCompleted(AllyWithMercenaries) then if not Harkonnen.IsObjectiveCompleted(AllyWithMercenaries) then
player.MarkFailedObjective(AllyWithMercenaries) Harkonnen.MarkFailedObjective(AllyWithMercenaries)
end end
end) end)
Trigger.OnKilledOrCaptured(OPalace, function() Trigger.OnKilledOrCaptured(OPalace, function()
Media.DisplayMessage(UserInterface.Translate("can-not-stand-harkonnen-must-become-neutral"), UserInterface.Translate("atreides-commander")) Media.DisplayMessage(UserInterface.Translate("can-not-stand-harkonnen-must-become-neutral"), UserInterface.Translate("atreides-commander"))
ChangeOwner(atreides_enemy, atreides_neutral) ChangeOwner(AtreidesEnemy, AtreidesNeutral)
DefendAndRepairBase(atreides_neutral, AtreidesBase, 0.75, AttackGroupSize[Difficulty]) DefendAndRepairBase(AtreidesNeutral, AtreidesBase, 0.75, AttackGroupSize[Difficulty])
IdlingUnits[atreides_neutral] = IdlingUnits[atreides_enemy] IdlingUnits[AtreidesNeutral] = IdlingUnits[AtreidesEnemy]
-- Ensure that harvesters that was on a carryall switched sides. -- Ensure that harvesters that was on a carryall switched sides.
Trigger.AfterDelay(DateTime.Seconds(15), function() Trigger.AfterDelay(DateTime.Seconds(15), function()
ChangeOwner(atreides_enemy, atreides_neutral) ChangeOwner(AtreidesEnemy, AtreidesNeutral)
CheckAttackToAtreides() CheckAttackToAtreides()
end) end)
end) end)
Trigger.OnAllKilledOrCaptured(OrdosBase, function() Trigger.OnAllKilledOrCaptured(OrdosBase, function()
Utils.Do(ordos.GetGroundAttackers(), IdleHunt) Utils.Do(Ordos.GetGroundAttackers(), IdleHunt)
end) end)
Trigger.OnAllKilledOrCaptured(AtreidesBase, function() Trigger.OnAllKilledOrCaptured(AtreidesBase, function()
Utils.Do(atreides_enemy.GetGroundAttackers(), IdleHunt) Utils.Do(AtreidesEnemy.GetGroundAttackers(), IdleHunt)
end) end)
Trigger.OnAllKilledOrCaptured(MercenaryBase, function() Trigger.OnAllKilledOrCaptured(MercenaryBase, function()
Utils.Do(mercenary_enemy.GetGroundAttackers(), IdleHunt) Utils.Do(MercenaryEnemy.GetGroundAttackers(), IdleHunt)
Utils.Do(mercenary_ally.GetGroundAttackers(), IdleHunt) Utils.Do(MercenaryAlly.GetGroundAttackers(), IdleHunt)
end) end)
local path = function() return Utils.Random(OrdosPaths) end local path = function() return Utils.Random(OrdosPaths) end
local waveCondition = function() return player.IsObjectiveCompleted(KillOrdos) end local waveCondition = function() return Harkonnen.IsObjectiveCompleted(KillOrdos) end
local huntFunction = function(unit) local huntFunction = function(unit)
unit.AttackMove(OrdosAttackLocation) unit.AttackMove(OrdosAttackLocation)
IdleHunt(unit) IdleHunt(unit)
end end
SendCarryallReinforcements(ordos, 0, OrdosAttackWaves[Difficulty], OrdosAttackDelay[Difficulty], path, OrdosReinforcements[Difficulty], waveCondition, huntFunction) SendCarryallReinforcements(Ordos, 0, OrdosAttackWaves[Difficulty], OrdosAttackDelay[Difficulty], path, OrdosReinforcements[Difficulty], waveCondition, huntFunction)
SendStarportReinforcements(mercenary_enemy) SendStarportReinforcements(MercenaryEnemy)
Actor.Create("upgrade.barracks", true, { Owner = ordos }) Actor.Create("upgrade.barracks", true, { Owner = Ordos })
Actor.Create("upgrade.light", true, { Owner = ordos }) Actor.Create("upgrade.light", true, { Owner = Ordos })
Actor.Create("upgrade.heavy", true, { Owner = ordos }) Actor.Create("upgrade.heavy", true, { Owner = Ordos })
Actor.Create("upgrade.barracks", true, { Owner = atreides_enemy }) Actor.Create("upgrade.barracks", true, { Owner = AtreidesEnemy })
Actor.Create("upgrade.light", true, { Owner = atreides_enemy }) Actor.Create("upgrade.light", true, { Owner = AtreidesEnemy })
Actor.Create("upgrade.heavy", true, { Owner = atreides_enemy }) Actor.Create("upgrade.heavy", true, { Owner = AtreidesEnemy })
Actor.Create("upgrade.hightech", true, { Owner = atreides_enemy }) Actor.Create("upgrade.hightech", true, { Owner = AtreidesEnemy })
Actor.Create("upgrade.heavy", true, { Owner = mercenary_enemy }) Actor.Create("upgrade.heavy", true, { Owner = MercenaryEnemy })
Trigger.AfterDelay(0, ActivateAI) Trigger.AfterDelay(0, ActivateAI)
end end

View File

@@ -34,17 +34,17 @@ CorrinoSmallTankTypes = { "combat_tank_h", "combat_tank_h", "siege_tank" }
CorrinoStarportTypes = { "trike.starport", "trike.starport", "quad.starport", "combat_tank_h.starport", "combat_tank_h.starport", "siege_tank.starport", "missile_tank.starport" } CorrinoStarportTypes = { "trike.starport", "trike.starport", "quad.starport", "combat_tank_h.starport", "combat_tank_h.starport", "siege_tank.starport", "missile_tank.starport" }
ActivateAI = function() ActivateAI = function()
IdlingUnits[atreides_main] = Reinforcements.Reinforce(atreides_main, InitialAtreidesReinforcements[1], InitialAtreidesPaths[1]), Reinforcements.Reinforce(atreides_main, InitialAtreidesReinforcements[2], InitialAtreidesPaths[2]), Reinforcements.Reinforce(atreides_main, InitialAtreidesReinforcements[3], InitialAtreidesPaths[3]) IdlingUnits[AtreidesMain] = Reinforcements.Reinforce(AtreidesMain, InitialAtreidesReinforcements[1], InitialAtreidesPaths[1]), Reinforcements.Reinforce(AtreidesMain, InitialAtreidesReinforcements[2], InitialAtreidesPaths[2]), Reinforcements.Reinforce(AtreidesMain, InitialAtreidesReinforcements[3], InitialAtreidesPaths[3])
IdlingUnits[atreides_small_1] = Reinforcements.Reinforce(atreides_small_1, InitialAtreidesReinforcements[4], InitialAtreidesPaths[4]), Reinforcements.Reinforce(atreides_small_1, InitialAtreidesReinforcements[5], InitialAtreidesPaths[5]) IdlingUnits[AtreidesSmall1] = Reinforcements.Reinforce(AtreidesSmall1, InitialAtreidesReinforcements[4], InitialAtreidesPaths[4]), Reinforcements.Reinforce(AtreidesSmall1, InitialAtreidesReinforcements[5], InitialAtreidesPaths[5])
IdlingUnits[atreides_small_2] = Reinforcements.Reinforce(atreides_small_2, InitialAtreidesReinforcements[6], InitialAtreidesPaths[6]) IdlingUnits[AtreidesSmall2] = Reinforcements.Reinforce(AtreidesSmall2, InitialAtreidesReinforcements[6], InitialAtreidesPaths[6])
IdlingUnits[corrino_main] = Reinforcements.Reinforce(corrino_main, InitialCorrinoReinforcements, InitialCorrinoPaths[1]) IdlingUnits[CorrinoMain] = Reinforcements.Reinforce(CorrinoMain, InitialCorrinoReinforcements, InitialCorrinoPaths[1])
IdlingUnits[corrino_small] = Reinforcements.Reinforce(corrino_main, InitialCorrinoReinforcements, InitialCorrinoPaths[2]) IdlingUnits[CorrinoSmall] = Reinforcements.Reinforce(CorrinoMain, InitialCorrinoReinforcements, InitialCorrinoPaths[2])
DefendAndRepairBase(atreides_main, AtreidesMainBase, 0.75, AttackGroupSize[Difficulty]) DefendAndRepairBase(AtreidesMain, AtreidesMainBase, 0.75, AttackGroupSize[Difficulty])
DefendAndRepairBase(atreides_small_1, AtreidesSmall1Base, 0.75, AttackGroupSize[Difficulty]) DefendAndRepairBase(AtreidesSmall1, AtreidesSmall1Base, 0.75, AttackGroupSize[Difficulty])
DefendAndRepairBase(atreides_small_2, AtreidesSmall2Base, 0.75, AttackGroupSize[Difficulty]) DefendAndRepairBase(AtreidesSmall2, AtreidesSmall2Base, 0.75, AttackGroupSize[Difficulty])
DefendAndRepairBase(corrino_main, CorrinoMainBase, 0.75, AttackGroupSize[Difficulty]) DefendAndRepairBase(CorrinoMain, CorrinoMainBase, 0.75, AttackGroupSize[Difficulty])
DefendAndRepairBase(corrino_small, CorrinoSmallBase, 0.75, AttackGroupSize[Difficulty]) DefendAndRepairBase(CorrinoSmall, CorrinoSmallBase, 0.75, AttackGroupSize[Difficulty])
local delay = function() return Utils.RandomInteger(AttackDelays[Difficulty][1], AttackDelays[Difficulty][2] + 1) end local delay = function() return Utils.RandomInteger(AttackDelays[Difficulty][1], AttackDelays[Difficulty][2] + 1) end
local infantryToBuild = function() return { Utils.Random(EnemyInfantryTypes) } end local infantryToBuild = function() return { Utils.Random(EnemyInfantryTypes) } end
@@ -58,23 +58,23 @@ ActivateAI = function()
local unitsToBuyCorrino = function() return { Utils.Random(CorrinoStarportTypes) } end local unitsToBuyCorrino = function() return { Utils.Random(CorrinoStarportTypes) } end
local attackThresholdSize = AttackGroupSize[Difficulty] * 2.5 local attackThresholdSize = AttackGroupSize[Difficulty] * 2.5
ProduceUnits(atreides_main, ABarracks1, delay, infantryToBuild, AttackGroupSize[Difficulty], attackThresholdSize) ProduceUnits(AtreidesMain, ABarracks1, delay, infantryToBuild, AttackGroupSize[Difficulty], attackThresholdSize)
ProduceUnits(atreides_main, ALightFactory1, delay, vehilcesToBuild, AttackGroupSize[Difficulty], attackThresholdSize) ProduceUnits(AtreidesMain, ALightFactory1, delay, vehilcesToBuild, AttackGroupSize[Difficulty], attackThresholdSize)
ProduceUnits(atreides_main, AHeavyFactory1, delay, tanksToBuildAtreidesMain, AttackGroupSize[Difficulty], attackThresholdSize) ProduceUnits(AtreidesMain, AHeavyFactory1, delay, tanksToBuildAtreidesMain, AttackGroupSize[Difficulty], attackThresholdSize)
ProduceUnits(atreides_main, AStarport, delay, unitsToBuyAtreides, AttackGroupSize[Difficulty], attackThresholdSize) ProduceUnits(AtreidesMain, AStarport, delay, unitsToBuyAtreides, AttackGroupSize[Difficulty], attackThresholdSize)
ProduceUnits(atreides_small_1, ABarracks3, delay, infantryToBuild, AttackGroupSize[Difficulty], attackThresholdSize) ProduceUnits(AtreidesSmall1, ABarracks3, delay, infantryToBuild, AttackGroupSize[Difficulty], attackThresholdSize)
ProduceUnits(atreides_small_1, ALightFactory2, delay, vehilcesToBuild, AttackGroupSize[Difficulty], attackThresholdSize) ProduceUnits(AtreidesSmall1, ALightFactory2, delay, vehilcesToBuild, AttackGroupSize[Difficulty], attackThresholdSize)
ProduceUnits(atreides_small_1, AHeavyFactory2, delay, tanksToBuildAtreidesSmall, AttackGroupSize[Difficulty], attackThresholdSize) ProduceUnits(AtreidesSmall1, AHeavyFactory2, delay, tanksToBuildAtreidesSmall, AttackGroupSize[Difficulty], attackThresholdSize)
ProduceUnits(atreides_small_2, ABarracks4, delay, infantryToBuild, AttackGroupSize[Difficulty], attackThresholdSize) ProduceUnits(AtreidesSmall2, ABarracks4, delay, infantryToBuild, AttackGroupSize[Difficulty], attackThresholdSize)
ProduceUnits(corrino_main, CBarracks1, delay, infantryToBuildCorrinoMain, AttackGroupSize[Difficulty], attackThresholdSize) ProduceUnits(CorrinoMain, CBarracks1, delay, infantryToBuildCorrinoMain, AttackGroupSize[Difficulty], attackThresholdSize)
ProduceUnits(corrino_main, CLightFactory1, delay, vehilcesToBuild, AttackGroupSize[Difficulty], attackThresholdSize) ProduceUnits(CorrinoMain, CLightFactory1, delay, vehilcesToBuild, AttackGroupSize[Difficulty], attackThresholdSize)
ProduceUnits(corrino_main, CHeavyFactory1, delay, tanksToBuildCorrinoMain, AttackGroupSize[Difficulty], attackThresholdSize) ProduceUnits(CorrinoMain, CHeavyFactory1, delay, tanksToBuildCorrinoMain, AttackGroupSize[Difficulty], attackThresholdSize)
ProduceUnits(corrino_main, CStarport, delay, unitsToBuyCorrino, AttackGroupSize[Difficulty], attackThresholdSize) ProduceUnits(CorrinoMain, CStarport, delay, unitsToBuyCorrino, AttackGroupSize[Difficulty], attackThresholdSize)
ProduceUnits(corrino_small, CBarracks2, delay, infantryToBuild, AttackGroupSize[Difficulty], attackThresholdSize) ProduceUnits(CorrinoSmall, CBarracks2, delay, infantryToBuild, AttackGroupSize[Difficulty], attackThresholdSize)
ProduceUnits(corrino_small, CLightFactory2, delay, vehilcesToBuild, AttackGroupSize[Difficulty], attackThresholdSize) ProduceUnits(CorrinoSmall, CLightFactory2, delay, vehilcesToBuild, AttackGroupSize[Difficulty], attackThresholdSize)
ProduceUnits(corrino_small, CHeavyFactory2, delay, tanksToBuildCorrinoSmall, AttackGroupSize[Difficulty], attackThresholdSize) ProduceUnits(CorrinoSmall, CHeavyFactory2, delay, tanksToBuildCorrinoSmall, AttackGroupSize[Difficulty], attackThresholdSize)
end end

View File

@@ -137,13 +137,13 @@ HarkonnenPath = { HarkonnenEntry.Location, HarkonnenRally.Location }
SendStarportReinforcements = function() SendStarportReinforcements = function()
Trigger.AfterDelay(CorrinoStarportDelay[Difficulty], function() Trigger.AfterDelay(CorrinoStarportDelay[Difficulty], function()
if CStarport.IsDead or CStarport.Owner ~= corrino_main then if CStarport.IsDead or CStarport.Owner ~= CorrinoMain then
return return
end end
reinforcements = Utils.Random(CorrinoStarportReinforcements[Difficulty]) local reinforcements = Utils.Random(CorrinoStarportReinforcements[Difficulty])
local units = Reinforcements.ReinforceWithTransport(corrino_main, "frigate", reinforcements, { CorrinoStarportEntry.Location, CStarport.Location + CVec.New(1, 1) }, { CorrinoStarportExit.Location })[2] local units = Reinforcements.ReinforceWithTransport(CorrinoMain, "frigate", reinforcements, { CorrinoStarportEntry.Location, CStarport.Location + CVec.New(1, 1) }, { CorrinoStarportExit.Location })[2]
Utils.Do(units, function(unit) Utils.Do(units, function(unit)
unit.AttackMove(AtreidesAttackLocation) unit.AttackMove(AtreidesAttackLocation)
IdleHunt(unit) IdleHunt(unit)
@@ -155,19 +155,19 @@ end
SendHarkonnenReinforcements = function(delay) SendHarkonnenReinforcements = function(delay)
Trigger.AfterDelay(delay, function() Trigger.AfterDelay(delay, function()
Reinforcements.ReinforceWithTransport(player, "carryall.reinforce", HarkonnenReinforcements, HarkonnenPath, { HarkonnenPath[1] }) Reinforcements.ReinforceWithTransport(Harkonnen, "carryall.reinforce", HarkonnenReinforcements, HarkonnenPath, { HarkonnenPath[1] })
Trigger.AfterDelay(DateTime.Seconds(5), function() Trigger.AfterDelay(DateTime.Seconds(5), function()
Media.PlaySpeechNotification(player, "Reinforce") Media.PlaySpeechNotification(Harkonnen, "Reinforce")
end) end)
end) end)
end end
SendAirStrike = function() SendAirStrike = function()
if AHiTechFactory.IsDead or AHiTechFactory.Owner ~= atreides_main then if AHiTechFactory.IsDead or AHiTechFactory.Owner ~= AtreidesMain then
return return
end end
local targets = Utils.Where(player.GetActors(), function(actor) local targets = Utils.Where(Harkonnen.GetActors(), function(actor)
return return
actor.HasProperty("Sell") and actor.HasProperty("Sell") and
actor.Type ~= "wall" and actor.Type ~= "wall" and
@@ -185,7 +185,7 @@ SendAirStrike = function()
end end
BuildFremen = function() BuildFremen = function()
if APalace.IsDead or APalace.Owner ~= atreides_main then if APalace.IsDead or APalace.Owner ~= AtreidesMain then
return return
end end
@@ -193,7 +193,7 @@ BuildFremen = function()
APalace.Produce("fremen") APalace.Produce("fremen")
Trigger.AfterDelay(DateTime.Seconds(5), function() Trigger.AfterDelay(DateTime.Seconds(5), function()
IdleFremen = Utils.Where(atreides_main.GetActorsByType('fremen'), function(actor) return actor.IsIdle end) IdleFremen = Utils.Where(AtreidesMain.GetActorsByType('fremen'), function(actor) return actor.IsIdle end)
if #IdleFremen >= FremenGroupSize[Difficulty] then if #IdleFremen >= FremenGroupSize[Difficulty] then
SendFremen() SendFremen()
@@ -211,77 +211,77 @@ SendFremen = function()
end end
Tick = function() Tick = function()
if player.HasNoRequiredUnits() then if Harkonnen.HasNoRequiredUnits() then
atreides_main.MarkCompletedObjective(KillHarkonnen1) AtreidesMain.MarkCompletedObjective(KillHarkonnen1)
atreides_small_1.MarkCompletedObjective(KillHarkonnen2) AtreidesSmall1.MarkCompletedObjective(KillHarkonnen2)
atreides_small_2.MarkCompletedObjective(KillHarkonnen3) AtreidesSmall2.MarkCompletedObjective(KillHarkonnen3)
corrino_main.MarkCompletedObjective(KillHarkonnen4) CorrinoMain.MarkCompletedObjective(KillHarkonnen4)
corrino_small.MarkCompletedObjective(KillHarkonnen5) CorrinoSmall.MarkCompletedObjective(KillHarkonnen5)
end end
if atreides_main.HasNoRequiredUnits() and atreides_small_1.HasNoRequiredUnits() and atreides_small_2.HasNoRequiredUnits() and not player.IsObjectiveCompleted(KillAtreides) then if AtreidesMain.HasNoRequiredUnits() and AtreidesSmall1.HasNoRequiredUnits() and AtreidesSmall2.HasNoRequiredUnits() and not Harkonnen.IsObjectiveCompleted(KillAtreides) then
Media.DisplayMessage(UserInterface.Translate("atreides-annihilated"), Mentat) Media.DisplayMessage(UserInterface.Translate("atreides-annihilated"), Mentat)
player.MarkCompletedObjective(KillAtreides) Harkonnen.MarkCompletedObjective(KillAtreides)
end end
if corrino_main.HasNoRequiredUnits() and corrino_small.HasNoRequiredUnits() and not player.IsObjectiveCompleted(KillCorrino) then if CorrinoMain.HasNoRequiredUnits() and CorrinoSmall.HasNoRequiredUnits() and not Harkonnen.IsObjectiveCompleted(KillCorrino) then
Media.DisplayMessage(UserInterface.Translate("emperor-annihilated"), Mentat) Media.DisplayMessage(UserInterface.Translate("emperor-annihilated"), Mentat)
player.MarkCompletedObjective(KillCorrino) Harkonnen.MarkCompletedObjective(KillCorrino)
end end
if DateTime.GameTime % DateTime.Seconds(10) == 0 and LastHarvesterEaten[atreides_main] then if DateTime.GameTime % DateTime.Seconds(10) == 0 and LastHarvesterEaten[AtreidesMain] then
local units = atreides_main.GetActorsByType("harvester") local units = AtreidesMain.GetActorsByType("harvester")
if #units > 0 then if #units > 0 then
LastHarvesterEaten[atreides_main] = false LastHarvesterEaten[AtreidesMain] = false
ProtectHarvester(units[1], atreides_main, AttackGroupSize[Difficulty]) ProtectHarvester(units[1], AtreidesMain, AttackGroupSize[Difficulty])
end end
end end
if DateTime.GameTime % DateTime.Seconds(10) == 0 and LastHarvesterEaten[atreides_small_1] then if DateTime.GameTime % DateTime.Seconds(10) == 0 and LastHarvesterEaten[AtreidesSmall1] then
local units = atreides_small_1.GetActorsByType("harvester") local units = AtreidesSmall1.GetActorsByType("harvester")
if #units > 0 then if #units > 0 then
LastHarvesterEaten[atreides_small_1] = false LastHarvesterEaten[AtreidesSmall1] = false
ProtectHarvester(units[1], atreides_small_1, AttackGroupSize[Difficulty]) ProtectHarvester(units[1], AtreidesSmall1, AttackGroupSize[Difficulty])
end end
end end
if DateTime.GameTime % DateTime.Seconds(10) == 0 and LastHarvesterEaten[corrino_main] then if DateTime.GameTime % DateTime.Seconds(10) == 0 and LastHarvesterEaten[CorrinoMain] then
local units = corrino_main.GetActorsByType("harvester") local units = CorrinoMain.GetActorsByType("harvester")
if #units > 0 then if #units > 0 then
LastHarvesterEaten[corrino_main] = false LastHarvesterEaten[CorrinoMain] = false
ProtectHarvester(units[1], corrino_main, AttackGroupSize[Difficulty]) ProtectHarvester(units[1], CorrinoMain, AttackGroupSize[Difficulty])
end end
end end
if DateTime.GameTime % DateTime.Seconds(10) == 0 and LastHarvesterEaten[corrino_small] then if DateTime.GameTime % DateTime.Seconds(10) == 0 and LastHarvesterEaten[CorrinoSmall] then
local units = corrino_small.GetActorsByType("harvester") local units = CorrinoSmall.GetActorsByType("harvester")
if #units > 0 then if #units > 0 then
LastHarvesterEaten[corrino_small] = false LastHarvesterEaten[CorrinoSmall] = false
ProtectHarvester(units[1], corrino_small, AttackGroupSize[Difficulty]) ProtectHarvester(units[1], CorrinoSmall, AttackGroupSize[Difficulty])
end end
end end
end end
WorldLoaded = function() WorldLoaded = function()
atreides_main = Player.GetPlayer("Atreides Main Base") AtreidesMain = Player.GetPlayer("Atreides Main Base")
atreides_small_1 = Player.GetPlayer("Atreides Small Base 1") AtreidesSmall1 = Player.GetPlayer("Atreides Small Base 1")
atreides_small_2 = Player.GetPlayer("Atreides Small Base 2") AtreidesSmall2 = Player.GetPlayer("Atreides Small Base 2")
corrino_main = Player.GetPlayer("Corrino Main Base") CorrinoMain = Player.GetPlayer("Corrino Main Base")
corrino_small = Player.GetPlayer("Corrino Small Base") CorrinoSmall = Player.GetPlayer("Corrino Small Base")
player = Player.GetPlayer("Harkonnen") Harkonnen = Player.GetPlayer("Harkonnen")
InitObjectives(player) InitObjectives(Harkonnen)
KillAtreides = AddPrimaryObjective(player, "destroy-atreides") KillAtreides = AddPrimaryObjective(Harkonnen, "destroy-atreides")
KillCorrino = AddPrimaryObjective(player, "destroy-imperial-forces") KillCorrino = AddPrimaryObjective(Harkonnen, "destroy-imperial-forces")
KillHarkonnen1 = AddPrimaryObjective(atreides_main, "") KillHarkonnen1 = AddPrimaryObjective(AtreidesMain, "")
KillHarkonnen2 = AddPrimaryObjective(atreides_small_1, "") KillHarkonnen2 = AddPrimaryObjective(AtreidesSmall1, "")
KillHarkonnen3 = AddPrimaryObjective(atreides_small_2, "") KillHarkonnen3 = AddPrimaryObjective(AtreidesSmall2, "")
KillHarkonnen4 = AddPrimaryObjective(corrino_main, "") KillHarkonnen4 = AddPrimaryObjective(CorrinoMain, "")
KillHarkonnen5 = AddPrimaryObjective(corrino_small, "") KillHarkonnen5 = AddPrimaryObjective(CorrinoSmall, "")
Camera.Position = HMCV.CenterPosition Camera.Position = HMCV.CenterPosition
AtreidesAttackLocation = HarkonnenRally.Location AtreidesAttackLocation = HarkonnenRally.Location
@@ -290,49 +290,49 @@ WorldLoaded = function()
Trigger.AfterDelay(DateTime.Minutes(1) + DateTime.Seconds (30), BuildFremen) Trigger.AfterDelay(DateTime.Minutes(1) + DateTime.Seconds (30), BuildFremen)
Trigger.OnAllKilledOrCaptured(AtreidesMainBase, function() Trigger.OnAllKilledOrCaptured(AtreidesMainBase, function()
Utils.Do(atreides_main.GetGroundAttackers(), IdleHunt) Utils.Do(AtreidesMain.GetGroundAttackers(), IdleHunt)
end) end)
Trigger.OnAllKilledOrCaptured(AtreidesSmall1Base, function() Trigger.OnAllKilledOrCaptured(AtreidesSmall1Base, function()
Utils.Do(atreides_small_1.GetGroundAttackers(), IdleHunt) Utils.Do(AtreidesSmall1.GetGroundAttackers(), IdleHunt)
end) end)
Trigger.OnAllKilledOrCaptured(AtreidesSmall2Base, function() Trigger.OnAllKilledOrCaptured(AtreidesSmall2Base, function()
Utils.Do(atreides_small_2.GetGroundAttackers(), IdleHunt) Utils.Do(AtreidesSmall2.GetGroundAttackers(), IdleHunt)
end) end)
Trigger.OnAllKilledOrCaptured(CorrinoMainBase, function() Trigger.OnAllKilledOrCaptured(CorrinoMainBase, function()
Utils.Do(corrino_main.GetGroundAttackers(), IdleHunt) Utils.Do(CorrinoMain.GetGroundAttackers(), IdleHunt)
end) end)
Trigger.OnAllKilledOrCaptured(CorrinoSmallBase, function() Trigger.OnAllKilledOrCaptured(CorrinoSmallBase, function()
Utils.Do(corrino_small.GetGroundAttackers(), IdleHunt) Utils.Do(CorrinoSmall.GetGroundAttackers(), IdleHunt)
end) end)
local path = function() return Utils.Random(AtreidesPaths) end local path = function() return Utils.Random(AtreidesPaths) end
local waveCondition = function() return player.IsObjectiveCompleted(KillAtreides) end local waveCondition = function() return Harkonnen.IsObjectiveCompleted(KillAtreides) end
local huntFunction = function(unit) local huntFunction = function(unit)
unit.AttackMove(AtreidesAttackLocation) unit.AttackMove(AtreidesAttackLocation)
IdleHunt(unit) IdleHunt(unit)
end end
SendCarryallReinforcements(atreides_main, 0, AtreidesAttackWaves[Difficulty], AtreidesAttackDelay[Difficulty], path, AtreidesReinforcements[Difficulty], waveCondition, huntFunction) SendCarryallReinforcements(AtreidesMain, 0, AtreidesAttackWaves[Difficulty], AtreidesAttackDelay[Difficulty], path, AtreidesReinforcements[Difficulty], waveCondition, huntFunction)
SendStarportReinforcements() SendStarportReinforcements()
Actor.Create("upgrade.barracks", true, { Owner = atreides_main }) Actor.Create("upgrade.barracks", true, { Owner = AtreidesMain })
Actor.Create("upgrade.light", true, { Owner = atreides_main }) Actor.Create("upgrade.light", true, { Owner = AtreidesMain })
Actor.Create("upgrade.heavy", true, { Owner = atreides_main }) Actor.Create("upgrade.heavy", true, { Owner = AtreidesMain })
Actor.Create("upgrade.hightech", true, { Owner = atreides_main }) Actor.Create("upgrade.hightech", true, { Owner = AtreidesMain })
Actor.Create("upgrade.barracks", true, { Owner = atreides_small_1 }) Actor.Create("upgrade.barracks", true, { Owner = AtreidesSmall1 })
Actor.Create("upgrade.light", true, { Owner = atreides_small_1 }) Actor.Create("upgrade.light", true, { Owner = AtreidesSmall1 })
Actor.Create("upgrade.heavy", true, { Owner = atreides_small_1 }) Actor.Create("upgrade.heavy", true, { Owner = AtreidesSmall1 })
Actor.Create("upgrade.barracks", true, { Owner = atreides_small_2 }) Actor.Create("upgrade.barracks", true, { Owner = AtreidesSmall2 })
Actor.Create("upgrade.barracks", true, { Owner = corrino_main }) Actor.Create("upgrade.barracks", true, { Owner = CorrinoMain })
Actor.Create("upgrade.light", true, { Owner = corrino_main }) Actor.Create("upgrade.light", true, { Owner = CorrinoMain })
Actor.Create("upgrade.heavy", true, { Owner = corrino_main }) Actor.Create("upgrade.heavy", true, { Owner = CorrinoMain })
Actor.Create("upgrade.barracks", true, { Owner = corrino_small }) Actor.Create("upgrade.barracks", true, { Owner = CorrinoSmall })
Actor.Create("upgrade.light", true, { Owner = corrino_small }) Actor.Create("upgrade.light", true, { Owner = CorrinoSmall })
Actor.Create("upgrade.heavy", true, { Owner = corrino_small }) Actor.Create("upgrade.heavy", true, { Owner = CorrinoSmall })
Trigger.AfterDelay(0, ActivateAI) Trigger.AfterDelay(0, ActivateAI)
SendHarkonnenReinforcements(DateTime.Minutes(2) + DateTime.Seconds(30)) SendHarkonnenReinforcements(DateTime.Minutes(2) + DateTime.Seconds(30))

View File

@@ -33,15 +33,15 @@ CorrinoTankTypes = { "combat_tank_h", "combat_tank_h", "siege_tank", "missile_ta
CorrinoStarportTypes = { "trike.starport", "trike.starport", "quad.starport", "combat_tank_h.starport", "combat_tank_h.starport", "siege_tank.starport", "missile_tank.starport" } CorrinoStarportTypes = { "trike.starport", "trike.starport", "quad.starport", "combat_tank_h.starport", "combat_tank_h.starport", "siege_tank.starport", "missile_tank.starport" }
ActivateAI = function() ActivateAI = function()
IdlingUnits[atreides_main] = Reinforcements.Reinforce(atreides_main, InitialAtreidesReinforcements[1], InitialAtreidesPaths[1]), Reinforcements.Reinforce(atreides_main, InitialAtreidesReinforcements[2], InitialAtreidesPaths[2]) IdlingUnits[AtreidesMain] = Reinforcements.Reinforce(AtreidesMain, InitialAtreidesReinforcements[1], InitialAtreidesPaths[1]), Reinforcements.Reinforce(AtreidesMain, InitialAtreidesReinforcements[2], InitialAtreidesPaths[2])
IdlingUnits[atreides_small] = Reinforcements.Reinforce(atreides_small, InitialAtreidesReinforcements[3], InitialAtreidesPaths[3]) IdlingUnits[AtreidesSmall] = Reinforcements.Reinforce(AtreidesSmall, InitialAtreidesReinforcements[3], InitialAtreidesPaths[3])
IdlingUnits[corrino_main] = Reinforcements.Reinforce(corrino_main, InitialCorrinoReinforcements[1], InitialCorrinoPaths[1]), Reinforcements.Reinforce(corrino_main, InitialCorrinoReinforcements[2], InitialCorrinoPaths[2]) IdlingUnits[CorrinoMain] = Reinforcements.Reinforce(CorrinoMain, InitialCorrinoReinforcements[1], InitialCorrinoPaths[1]), Reinforcements.Reinforce(CorrinoMain, InitialCorrinoReinforcements[2], InitialCorrinoPaths[2])
IdlingUnits[corrino_small] = Reinforcements.Reinforce(corrino_main, InitialCorrinoReinforcements[3], InitialCorrinoPaths[3]) IdlingUnits[CorrinoSmall] = Reinforcements.Reinforce(CorrinoMain, InitialCorrinoReinforcements[3], InitialCorrinoPaths[3])
DefendAndRepairBase(atreides_main, AtreidesMainBase, 0.75, AttackGroupSize[Difficulty]) DefendAndRepairBase(AtreidesMain, AtreidesMainBase, 0.75, AttackGroupSize[Difficulty])
DefendAndRepairBase(atreides_small, AtreidesSmallBase, 0.75, AttackGroupSize[Difficulty]) DefendAndRepairBase(AtreidesSmall, AtreidesSmallBase, 0.75, AttackGroupSize[Difficulty])
DefendAndRepairBase(corrino_main, CorrinoMainBase, 0.75, AttackGroupSize[Difficulty]) DefendAndRepairBase(CorrinoMain, CorrinoMainBase, 0.75, AttackGroupSize[Difficulty])
DefendAndRepairBase(corrino_small, CorrinoSmallBase, 0.75, AttackGroupSize[Difficulty]) DefendAndRepairBase(CorrinoSmall, CorrinoSmallBase, 0.75, AttackGroupSize[Difficulty])
local delay = function() return Utils.RandomInteger(AttackDelays[Difficulty][1], AttackDelays[Difficulty][2] + 1) end local delay = function() return Utils.RandomInteger(AttackDelays[Difficulty][1], AttackDelays[Difficulty][2] + 1) end
local infantryToBuild = function() return { Utils.Random(EnemyInfantryTypes) } end local infantryToBuild = function() return { Utils.Random(EnemyInfantryTypes) } end
@@ -54,20 +54,20 @@ ActivateAI = function()
local unitsToBuyCorrino = function() return { Utils.Random(CorrinoStarportTypes) } end local unitsToBuyCorrino = function() return { Utils.Random(CorrinoStarportTypes) } end
local attackThresholdSize = AttackGroupSize[Difficulty] * 2.5 local attackThresholdSize = AttackGroupSize[Difficulty] * 2.5
ProduceUnits(atreides_main, ABarracks1, delay, infantryToBuild, AttackGroupSize[Difficulty], attackThresholdSize) ProduceUnits(AtreidesMain, ABarracks1, delay, infantryToBuild, AttackGroupSize[Difficulty], attackThresholdSize)
ProduceUnits(atreides_main, ALightFactory1, delay, vehilcesToBuild, AttackGroupSize[Difficulty], attackThresholdSize) ProduceUnits(AtreidesMain, ALightFactory1, delay, vehilcesToBuild, AttackGroupSize[Difficulty], attackThresholdSize)
ProduceUnits(atreides_main, AHeavyFactory1, delay, tanksToBuildAtreidesMain, AttackGroupSize[Difficulty], attackThresholdSize) ProduceUnits(AtreidesMain, AHeavyFactory1, delay, tanksToBuildAtreidesMain, AttackGroupSize[Difficulty], attackThresholdSize)
ProduceUnits(atreides_main, AStarport1, delay, unitsToBuyAtreides, AttackGroupSize[Difficulty], attackThresholdSize) ProduceUnits(AtreidesMain, AStarport1, delay, unitsToBuyAtreides, AttackGroupSize[Difficulty], attackThresholdSize)
ProduceUnits(atreides_small, ABarracks3, delay, infantryToBuild, AttackGroupSize[Difficulty], attackThresholdSize) ProduceUnits(AtreidesSmall, ABarracks3, delay, infantryToBuild, AttackGroupSize[Difficulty], attackThresholdSize)
ProduceUnits(atreides_small, ALightFactory2, delay, vehilcesToBuild, AttackGroupSize[Difficulty], attackThresholdSize) ProduceUnits(AtreidesSmall, ALightFactory2, delay, vehilcesToBuild, AttackGroupSize[Difficulty], attackThresholdSize)
ProduceUnits(atreides_small, AHeavyFactory2, delay, tanksToBuildAtreidesSmall, AttackGroupSize[Difficulty], attackThresholdSize) ProduceUnits(AtreidesSmall, AHeavyFactory2, delay, tanksToBuildAtreidesSmall, AttackGroupSize[Difficulty], attackThresholdSize)
ProduceUnits(atreides_small, AStarport2, delay, unitsToBuyAtreides, AttackGroupSize[Difficulty], attackThresholdSize) ProduceUnits(AtreidesSmall, AStarport2, delay, unitsToBuyAtreides, AttackGroupSize[Difficulty], attackThresholdSize)
ProduceUnits(corrino_main, CBarracks1, delay, infantryToBuildCorrinoMain, AttackGroupSize[Difficulty], attackThresholdSize) ProduceUnits(CorrinoMain, CBarracks1, delay, infantryToBuildCorrinoMain, AttackGroupSize[Difficulty], attackThresholdSize)
ProduceUnits(corrino_main, CHeavyFactory, delay, tanksToBuildCorrino, AttackGroupSize[Difficulty], attackThresholdSize) ProduceUnits(CorrinoMain, CHeavyFactory, delay, tanksToBuildCorrino, AttackGroupSize[Difficulty], attackThresholdSize)
ProduceUnits(corrino_small, CBarracks3, delay, infantryToBuild, AttackGroupSize[Difficulty], attackThresholdSize) ProduceUnits(CorrinoSmall, CBarracks3, delay, infantryToBuild, AttackGroupSize[Difficulty], attackThresholdSize)
ProduceUnits(corrino_small, CLightFactory, delay, vehilcesToBuild, AttackGroupSize[Difficulty], attackThresholdSize) ProduceUnits(CorrinoSmall, CLightFactory, delay, vehilcesToBuild, AttackGroupSize[Difficulty], attackThresholdSize)
ProduceUnits(corrino_small, CStarport, delay, unitsToBuyCorrino, AttackGroupSize[Difficulty], attackThresholdSize) ProduceUnits(CorrinoSmall, CStarport, delay, unitsToBuyCorrino, AttackGroupSize[Difficulty], attackThresholdSize)
end end

View File

@@ -143,13 +143,13 @@ HarkonnenPath = { HarkonnenEntry.Location, HarkonnenRally.Location }
SendStarportReinforcements = function() SendStarportReinforcements = function()
Trigger.AfterDelay(CorrinoStarportDelay[Difficulty], function() Trigger.AfterDelay(CorrinoStarportDelay[Difficulty], function()
if CStarport.IsDead or CStarport.Owner ~= corrino_small then if CStarport.IsDead or CStarport.Owner ~= CorrinoSmall then
return return
end end
reinforcements = Utils.Random(CorrinoStarportReinforcements[Difficulty]) local reinforcements = Utils.Random(CorrinoStarportReinforcements[Difficulty])
local units = Reinforcements.ReinforceWithTransport(corrino_small, "frigate", reinforcements, { CorrinoStarportEntry.Location, CStarport.Location + CVec.New(1, 1) }, { CorrinoStarportExit.Location })[2] local units = Reinforcements.ReinforceWithTransport(CorrinoSmall, "frigate", reinforcements, { CorrinoStarportEntry.Location, CStarport.Location + CVec.New(1, 1) }, { CorrinoStarportExit.Location })[2]
Utils.Do(units, function(unit) Utils.Do(units, function(unit)
unit.AttackMove(AtreidesAttackLocation) unit.AttackMove(AtreidesAttackLocation)
IdleHunt(unit) IdleHunt(unit)
@@ -161,19 +161,19 @@ end
SendHarkonnenReinforcements = function(delay) SendHarkonnenReinforcements = function(delay)
Trigger.AfterDelay(delay, function() Trigger.AfterDelay(delay, function()
Reinforcements.ReinforceWithTransport(player, "carryall.reinforce", HarkonnenReinforcements, HarkonnenPath, { HarkonnenPath[1] }) Reinforcements.ReinforceWithTransport(Harkonnen, "carryall.reinforce", HarkonnenReinforcements, HarkonnenPath, { HarkonnenPath[1] })
Trigger.AfterDelay(DateTime.Seconds(5), function() Trigger.AfterDelay(DateTime.Seconds(5), function()
Media.PlaySpeechNotification(player, "Reinforce") Media.PlaySpeechNotification(Harkonnen, "Reinforce")
end) end)
end) end)
end end
SendAirStrike = function() SendAirStrike = function()
if AHiTechFactory.IsDead or AHiTechFactory.Owner ~= atreides_main then if AHiTechFactory.IsDead or AHiTechFactory.Owner ~= AtreidesMain then
return return
end end
local targets = Utils.Where(player.GetActors(), function(actor) local targets = Utils.Where(Harkonnen.GetActors(), function(actor)
return return
actor.HasProperty("Sell") and actor.HasProperty("Sell") and
actor.Type ~= "wall" and actor.Type ~= "wall" and
@@ -191,7 +191,7 @@ SendAirStrike = function()
end end
BuildFremen = function() BuildFremen = function()
if APalace.IsDead or APalace.Owner ~= atreides_main then if APalace.IsDead or APalace.Owner ~= AtreidesMain then
return return
end end
@@ -199,7 +199,7 @@ BuildFremen = function()
APalace.Produce("fremen") APalace.Produce("fremen")
Trigger.AfterDelay(DateTime.Seconds(5), function() Trigger.AfterDelay(DateTime.Seconds(5), function()
IdleFremen = Utils.Where(atreides_main.GetActorsByType('fremen'), function(actor) return actor.IsIdle end) IdleFremen = Utils.Where(AtreidesMain.GetActorsByType('fremen'), function(actor) return actor.IsIdle end)
if #IdleFremen >= FremenGroupSize[Difficulty] then if #IdleFremen >= FremenGroupSize[Difficulty] then
SendFremen() SendFremen()
@@ -228,44 +228,44 @@ end
CheckSmugglerEnemies = function() CheckSmugglerEnemies = function()
Utils.Do(SmugglerUnits, function(unit) Utils.Do(SmugglerUnits, function(unit)
Trigger.OnDamaged(unit, function(self, attacker) Trigger.OnDamaged(unit, function(self, attacker)
if unit.Owner == smuggler_neutral and attacker.Owner == player then if unit.Owner == SmugglerNeutral and attacker.Owner == Harkonnen then
ChangeOwner(smuggler_neutral, smuggler_harkonnen) ChangeOwner(SmugglerNeutral, SmugglerHarkonnen)
-- Ensure that harvesters that was on a carryall switched sides. -- Ensure that harvesters that was on a carryall switched sides.
Trigger.AfterDelay(DateTime.Seconds(15), function() Trigger.AfterDelay(DateTime.Seconds(15), function()
ChangeOwner(smuggler_neutral, smuggler_harkonnen) ChangeOwner(SmugglerNeutral, SmugglerHarkonnen)
end) end)
end end
if unit.Owner == smuggler_ai and attacker.Owner == player then if unit.Owner == SmugglerAI and attacker.Owner == Harkonnen then
ChangeOwner(smuggler_ai, smuggler_both) ChangeOwner(SmugglerAI, SmugglerBoth)
-- Ensure that harvesters that was on a carryall switched sides. -- Ensure that harvesters that was on a carryall switched sides.
Trigger.AfterDelay(DateTime.Seconds(15), function() Trigger.AfterDelay(DateTime.Seconds(15), function()
ChangeOwner(smuggler_ai, smuggler_both) ChangeOwner(SmugglerAI, SmugglerBoth)
end) end)
end end
if unit.Owner == smuggler_neutral and (attacker.Owner == atreides_main or attacker.Owner == atreides_small or attacker.Owner == corrino_main or attacker.Owner == corrino_small) then if unit.Owner == SmugglerNeutral and (attacker.Owner == AtreidesMain or attacker.Owner == AtreidesSmall or attacker.Owner == CorrinoMain or attacker.Owner == CorrinoSmall) then
ChangeOwner(smuggler_neutral, smuggler_ai) ChangeOwner(SmugglerNeutral, SmugglerAI)
-- Ensure that harvesters that was on a carryall switched sides. -- Ensure that harvesters that was on a carryall switched sides.
Trigger.AfterDelay(DateTime.Seconds(15), function() Trigger.AfterDelay(DateTime.Seconds(15), function()
ChangeOwner(smuggler_neutral, smuggler_ai) ChangeOwner(SmugglerNeutral, SmugglerAI)
end) end)
end end
if unit.Owner == smuggler_harkonnen and (attacker.Owner == atreides_main or attacker.Owner == atreides_small or attacker.Owner == corrino_main or attacker.Owner == corrino_small) then if unit.Owner == SmugglerHarkonnen and (attacker.Owner == AtreidesMain or attacker.Owner == AtreidesSmall or attacker.Owner == CorrinoMain or attacker.Owner == CorrinoSmall) then
ChangeOwner(smuggler_harkonnen, smuggler_both) ChangeOwner(SmugglerHarkonnen, SmugglerBoth)
-- Ensure that harvesters that was on a carryall switched sides. -- Ensure that harvesters that was on a carryall switched sides.
Trigger.AfterDelay(DateTime.Seconds(15), function() Trigger.AfterDelay(DateTime.Seconds(15), function()
ChangeOwner(smuggler_harkonnen, smuggler_both) ChangeOwner(SmugglerHarkonnen, SmugglerBoth)
end) end)
end end
if attacker.Owner == player and not message_check then if attacker.Owner == Harkonnen and not MessageCheck then
message_check = true MessageCheck = true
Media.DisplayMessage(UserInterface.Translate("smugglers-now-hostile"), Mentat) Media.DisplayMessage(UserInterface.Translate("smugglers-now-hostile"), Mentat)
end end
end) end)
@@ -273,93 +273,93 @@ CheckSmugglerEnemies = function()
end end
Tick = function() Tick = function()
if player.HasNoRequiredUnits() then if Harkonnen.HasNoRequiredUnits() then
atreides_main.MarkCompletedObjective(KillHarkonnen1) AtreidesMain.MarkCompletedObjective(KillHarkonnen1)
atreides_small.MarkCompletedObjective(KillHarkonnen2) AtreidesSmall.MarkCompletedObjective(KillHarkonnen2)
corrino_main.MarkCompletedObjective(KillHarkonnen3) CorrinoMain.MarkCompletedObjective(KillHarkonnen3)
corrino_small.MarkCompletedObjective(KillHarkonnen4) CorrinoSmall.MarkCompletedObjective(KillHarkonnen4)
end end
if atreides_main.HasNoRequiredUnits() and atreides_small.HasNoRequiredUnits() and not player.IsObjectiveCompleted(KillAtreides) then if AtreidesMain.HasNoRequiredUnits() and AtreidesSmall.HasNoRequiredUnits() and not Harkonnen.IsObjectiveCompleted(KillAtreides) then
Media.DisplayMessage(UserInterface.Translate("atreides-annihilated"), Mentat) Media.DisplayMessage(UserInterface.Translate("atreides-annihilated"), Mentat)
player.MarkCompletedObjective(KillAtreides) Harkonnen.MarkCompletedObjective(KillAtreides)
end end
if corrino_main.HasNoRequiredUnits() and corrino_small.HasNoRequiredUnits() and not player.IsObjectiveCompleted(KillCorrino) then if CorrinoMain.HasNoRequiredUnits() and CorrinoSmall.HasNoRequiredUnits() and not Harkonnen.IsObjectiveCompleted(KillCorrino) then
Media.DisplayMessage(UserInterface.Translate("emperor-annihilated"), Mentat) Media.DisplayMessage(UserInterface.Translate("emperor-annihilated"), Mentat)
player.MarkCompletedObjective(KillCorrino) Harkonnen.MarkCompletedObjective(KillCorrino)
end end
if smuggler_neutral.HasNoRequiredUnits() and smuggler_harkonnen.HasNoRequiredUnits() and smuggler_ai.HasNoRequiredUnits() and smuggler_both.HasNoRequiredUnits() and not SmugglersKilled then if SmugglerNeutral.HasNoRequiredUnits() and SmugglerHarkonnen.HasNoRequiredUnits() and SmugglerAI.HasNoRequiredUnits() and SmugglerBoth.HasNoRequiredUnits() and not SmugglersKilled then
Media.DisplayMessage(UserInterface.Translate("smugglers-annihilated"), Mentat) Media.DisplayMessage(UserInterface.Translate("smugglers-annihilated"), Mentat)
SmugglersKilled = true SmugglersKilled = true
end end
local playerConYards = player.GetActorsByType("construction_yard") local playerConYards = Harkonnen.GetActorsByType("construction_yard")
if #playerConYards > 0 and not player.IsObjectiveCompleted(DeployMCV) then if #playerConYards > 0 and not Harkonnen.IsObjectiveCompleted(DeployMCV) then
player.MarkCompletedObjective(DeployMCV) Harkonnen.MarkCompletedObjective(DeployMCV)
end end
if DateTime.GameTime % DateTime.Seconds(10) == 0 and LastHarvesterEaten[atreides_main] then if DateTime.GameTime % DateTime.Seconds(10) == 0 and LastHarvesterEaten[AtreidesMain] then
local units = atreides_main.GetActorsByType("harvester") local units = AtreidesMain.GetActorsByType("harvester")
if #units > 0 then if #units > 0 then
LastHarvesterEaten[atreides_main] = false LastHarvesterEaten[AtreidesMain] = false
ProtectHarvester(units[1], atreides_main, AttackGroupSize[Difficulty]) ProtectHarvester(units[1], AtreidesMain, AttackGroupSize[Difficulty])
end end
end end
if DateTime.GameTime % DateTime.Seconds(10) == 0 and LastHarvesterEaten[atreides_small] then if DateTime.GameTime % DateTime.Seconds(10) == 0 and LastHarvesterEaten[AtreidesSmall] then
local units = atreides_small.GetActorsByType("harvester") local units = AtreidesSmall.GetActorsByType("harvester")
if #units > 0 then if #units > 0 then
LastHarvesterEaten[atreides_small] = false LastHarvesterEaten[AtreidesSmall] = false
ProtectHarvester(units[1], atreides_small, AttackGroupSize[Difficulty]) ProtectHarvester(units[1], AtreidesSmall, AttackGroupSize[Difficulty])
end end
end end
if DateTime.GameTime % DateTime.Seconds(10) == 0 and LastHarvesterEaten[corrino_main] then if DateTime.GameTime % DateTime.Seconds(10) == 0 and LastHarvesterEaten[CorrinoMain] then
local units = corrino_main.GetActorsByType("harvester") local units = CorrinoMain.GetActorsByType("harvester")
if #units > 0 then if #units > 0 then
LastHarvesterEaten[corrino_main] = false LastHarvesterEaten[CorrinoMain] = false
ProtectHarvester(units[1], corrino_main, AttackGroupSize[Difficulty]) ProtectHarvester(units[1], CorrinoMain, AttackGroupSize[Difficulty])
end end
end end
if DateTime.GameTime % DateTime.Seconds(10) == 0 and LastHarvesterEaten[corrino_small] then if DateTime.GameTime % DateTime.Seconds(10) == 0 and LastHarvesterEaten[CorrinoSmall] then
local units = corrino_small.GetActorsByType("harvester") local units = CorrinoSmall.GetActorsByType("harvester")
if #units > 0 then if #units > 0 then
LastHarvesterEaten[corrino_small] = false LastHarvesterEaten[CorrinoSmall] = false
ProtectHarvester(units[1], corrino_small, AttackGroupSize[Difficulty]) ProtectHarvester(units[1], CorrinoSmall, AttackGroupSize[Difficulty])
end end
end end
end end
WorldLoaded = function() WorldLoaded = function()
atreides_main = Player.GetPlayer("Atreides Main Base") AtreidesMain = Player.GetPlayer("Atreides Main Base")
atreides_small = Player.GetPlayer("Atreides Small Base") AtreidesSmall = Player.GetPlayer("Atreides Small Base")
corrino_main = Player.GetPlayer("Corrino Main Base") CorrinoMain = Player.GetPlayer("Corrino Main Base")
corrino_small = Player.GetPlayer("Corrino Small Base") CorrinoSmall = Player.GetPlayer("Corrino Small Base")
smuggler_neutral = Player.GetPlayer("Smugglers - Neutral") SmugglerNeutral = Player.GetPlayer("Smugglers - Neutral")
smuggler_harkonnen = Player.GetPlayer("Smugglers - Enemy to Harkonnen") SmugglerHarkonnen = Player.GetPlayer("Smugglers - Enemy to Harkonnen")
smuggler_ai = Player.GetPlayer("Smugglers - Enemy to AI") SmugglerAI = Player.GetPlayer("Smugglers - Enemy to AI")
smuggler_both = Player.GetPlayer("Smugglers - Enemy to Both") SmugglerBoth = Player.GetPlayer("Smugglers - Enemy to Both")
player = Player.GetPlayer("Harkonnen") Harkonnen = Player.GetPlayer("Harkonnen")
InitObjectives(player) InitObjectives(Harkonnen)
DeployMCV = AddSecondaryObjective(player, "build-deploy-mcv") DeployMCV = AddSecondaryObjective(Harkonnen, "build-deploy-mcv")
KillAtreides = AddPrimaryObjective(player, "destroy-atreides") KillAtreides = AddPrimaryObjective(Harkonnen, "destroy-atreides")
KillCorrino = AddPrimaryObjective(player, "destroy-imperial-forces") KillCorrino = AddPrimaryObjective(Harkonnen, "destroy-imperial-forces")
KillHarkonnen1 = AddPrimaryObjective(atreides_main, "") KillHarkonnen1 = AddPrimaryObjective(AtreidesMain, "")
KillHarkonnen2 = AddPrimaryObjective(atreides_small, "") KillHarkonnen2 = AddPrimaryObjective(AtreidesSmall, "")
KillHarkonnen3 = AddPrimaryObjective(corrino_main, "") KillHarkonnen3 = AddPrimaryObjective(CorrinoMain, "")
KillHarkonnen4 = AddPrimaryObjective(corrino_small, "") KillHarkonnen4 = AddPrimaryObjective(CorrinoSmall, "")
-- Wait for carryall drop -- Wait for carryall drop
Trigger.AfterDelay(DateTime.Seconds(10), function() Trigger.AfterDelay(DateTime.Seconds(10), function()
SmugglerUnits = smuggler_neutral.GetActors() SmugglerUnits = SmugglerNeutral.GetActors()
CheckSmugglerEnemies() CheckSmugglerEnemies()
end) end)
@@ -370,42 +370,42 @@ WorldLoaded = function()
Trigger.AfterDelay(DateTime.Minutes(1) + DateTime.Seconds (30), BuildFremen) Trigger.AfterDelay(DateTime.Minutes(1) + DateTime.Seconds (30), BuildFremen)
Trigger.OnAllKilledOrCaptured(AtreidesMainBase, function() Trigger.OnAllKilledOrCaptured(AtreidesMainBase, function()
Utils.Do(atreides_main.GetGroundAttackers(), IdleHunt) Utils.Do(AtreidesMain.GetGroundAttackers(), IdleHunt)
end) end)
Trigger.OnAllKilledOrCaptured(AtreidesSmallBase, function() Trigger.OnAllKilledOrCaptured(AtreidesSmallBase, function()
Utils.Do(atreides_small.GetGroundAttackers(), IdleHunt) Utils.Do(AtreidesSmall.GetGroundAttackers(), IdleHunt)
end) end)
Trigger.OnAllKilledOrCaptured(CorrinoMainBase, function() Trigger.OnAllKilledOrCaptured(CorrinoMainBase, function()
Utils.Do(corrino_main.GetGroundAttackers(), IdleHunt) Utils.Do(CorrinoMain.GetGroundAttackers(), IdleHunt)
end) end)
Trigger.OnAllKilledOrCaptured(CorrinoSmallBase, function() Trigger.OnAllKilledOrCaptured(CorrinoSmallBase, function()
Utils.Do(corrino_small.GetGroundAttackers(), IdleHunt) Utils.Do(CorrinoSmall.GetGroundAttackers(), IdleHunt)
end) end)
local path = function() return Utils.Random(AtreidesPaths) end local path = function() return Utils.Random(AtreidesPaths) end
local waveCondition = function() return player.IsObjectiveCompleted(KillAtreides) end local waveCondition = function() return Harkonnen.IsObjectiveCompleted(KillAtreides) end
local huntFunction = function(unit) local huntFunction = function(unit)
unit.AttackMove(AtreidesAttackLocation) unit.AttackMove(AtreidesAttackLocation)
IdleHunt(unit) IdleHunt(unit)
end end
SendCarryallReinforcements(atreides_main, 0, AtreidesAttackWaves[Difficulty], AtreidesAttackDelay[Difficulty], path, AtreidesReinforcements[Difficulty], waveCondition, huntFunction) SendCarryallReinforcements(AtreidesMain, 0, AtreidesAttackWaves[Difficulty], AtreidesAttackDelay[Difficulty], path, AtreidesReinforcements[Difficulty], waveCondition, huntFunction)
SendStarportReinforcements() SendStarportReinforcements()
Actor.Create("upgrade.barracks", true, { Owner = atreides_main }) Actor.Create("upgrade.barracks", true, { Owner = AtreidesMain })
Actor.Create("upgrade.light", true, { Owner = atreides_main }) Actor.Create("upgrade.light", true, { Owner = AtreidesMain })
Actor.Create("upgrade.heavy", true, { Owner = atreides_main }) Actor.Create("upgrade.heavy", true, { Owner = AtreidesMain })
Actor.Create("upgrade.hightech", true, { Owner = atreides_main }) Actor.Create("upgrade.hightech", true, { Owner = AtreidesMain })
Actor.Create("upgrade.barracks", true, { Owner = atreides_small }) Actor.Create("upgrade.barracks", true, { Owner = AtreidesSmall })
Actor.Create("upgrade.light", true, { Owner = atreides_small }) Actor.Create("upgrade.light", true, { Owner = AtreidesSmall })
Actor.Create("upgrade.heavy", true, { Owner = atreides_small }) Actor.Create("upgrade.heavy", true, { Owner = AtreidesSmall })
Actor.Create("upgrade.barracks", true, { Owner = corrino_main }) Actor.Create("upgrade.barracks", true, { Owner = CorrinoMain })
Actor.Create("upgrade.heavy", true, { Owner = corrino_main }) Actor.Create("upgrade.heavy", true, { Owner = CorrinoMain })
Actor.Create("upgrade.barracks", true, { Owner = corrino_small }) Actor.Create("upgrade.barracks", true, { Owner = CorrinoSmall })
Actor.Create("upgrade.light", true, { Owner = corrino_small }) Actor.Create("upgrade.light", true, { Owner = CorrinoSmall })
Trigger.AfterDelay(0, ActivateAI) Trigger.AfterDelay(0, ActivateAI)
SendHarkonnenReinforcements(DateTime.Minutes(2)) SendHarkonnenReinforcements(DateTime.Minutes(2))

View File

@@ -61,16 +61,16 @@ Messages =
CachedResources = -1 CachedResources = -1
Tick = function() Tick = function()
if HarkonnenArrived and harkonnen.HasNoRequiredUnits() then if HarkonnenArrived and Harkonnen.HasNoRequiredUnits() then
player.MarkCompletedObjective(KillHarkonnen) Ordos.MarkCompletedObjective(KillHarkonnen)
end end
if player.Resources > SpiceToHarvest - 1 then if Ordos.Resources > SpiceToHarvest - 1 then
player.MarkCompletedObjective(GatherSpice) Ordos.MarkCompletedObjective(GatherSpice)
end end
-- player has no Wind Trap -- player has no Wind Trap
if (player.PowerProvided <= 20 or player.PowerState ~= "Normal") and DateTime.GameTime % DateTime.Seconds(32) == 0 then if (Ordos.PowerProvided <= 20 or Ordos.PowerState ~= "Normal") and DateTime.GameTime % DateTime.Seconds(32) == 0 then
HasPower = false HasPower = false
Media.DisplayMessage(Messages[2], Mentat) Media.DisplayMessage(Messages[2], Mentat)
else else
@@ -78,40 +78,40 @@ Tick = function()
end end
-- player has no Refinery and no Silos -- player has no Refinery and no Silos
if HasPower and player.ResourceCapacity == 0 and DateTime.GameTime % DateTime.Seconds(32) == 0 then if HasPower and Ordos.ResourceCapacity == 0 and DateTime.GameTime % DateTime.Seconds(32) == 0 then
Media.DisplayMessage(Messages[3], Mentat) Media.DisplayMessage(Messages[3], Mentat)
end end
if HasPower and player.Resources > player.ResourceCapacity * 0.8 and DateTime.GameTime % DateTime.Seconds(32) == 0 then if HasPower and Ordos.Resources > Ordos.ResourceCapacity * 0.8 and DateTime.GameTime % DateTime.Seconds(32) == 0 then
Media.DisplayMessage(Messages[4], Mentat) Media.DisplayMessage(Messages[4], Mentat)
end end
if player.Resources ~= CachedResources then if Ordos.Resources ~= CachedResources then
local parameters = { ["harvested"] = player.Resources, ["goal"] = SpiceToHarvest } local parameters = { ["harvested"] = Ordos.Resources, ["goal"] = SpiceToHarvest }
local harvestedResources = UserInterface.Translate("harvested-resources", parameters) local harvestedResources = UserInterface.Translate("harvested-resources", parameters)
UserInterface.SetMissionText(harvestedResources) UserInterface.SetMissionText(harvestedResources)
CachedResources = player.Resources CachedResources = Ordos.Resources
end end
end end
WorldLoaded = function() WorldLoaded = function()
player = Player.GetPlayer("Ordos") Ordos = Player.GetPlayer("Ordos")
harkonnen = Player.GetPlayer("Harkonnen") Harkonnen = Player.GetPlayer("Harkonnen")
SpiceToHarvest = ToHarvest[Difficulty] SpiceToHarvest = ToHarvest[Difficulty]
InitObjectives(player) InitObjectives(Ordos)
KillOrdos = AddPrimaryObjective(harkonnen, "") KillOrdos = AddPrimaryObjective(Harkonnen, "")
local harvestSpice = UserInterface.Translate("harvest-spice", { ["spice"] = SpiceToHarvest }) local harvestSpice = UserInterface.Translate("harvest-spice", { ["spice"] = SpiceToHarvest })
GatherSpice = AddPrimaryObjective(player, harvestSpice) GatherSpice = AddPrimaryObjective(Ordos, harvestSpice)
KillHarkonnen = AddSecondaryObjective(player, "eliminate-harkonnen-units-reinforcements") KillHarkonnen = AddSecondaryObjective(Ordos, "eliminate-harkonnen-units-reinforcements")
local checkResourceCapacity = function() local checkResourceCapacity = function()
Trigger.AfterDelay(0, function() Trigger.AfterDelay(0, function()
if player.ResourceCapacity < SpiceToHarvest then if Ordos.ResourceCapacity < SpiceToHarvest then
Media.DisplayMessage(UserInterface.Translate("not-enough-silos"), Mentat) Media.DisplayMessage(UserInterface.Translate("not-enough-silos"), Mentat)
Trigger.AfterDelay(DateTime.Seconds(3), function() Trigger.AfterDelay(DateTime.Seconds(3), function()
harkonnen.MarkCompletedObjective(KillAtreides) Harkonnen.MarkCompletedObjective(KillAtreides)
end) end)
return true return true
@@ -126,16 +126,16 @@ WorldLoaded = function()
return return
end end
local refs = Utils.Where(Map.ActorsInWorld, function(actor) return actor.Type == "refinery" and actor.Owner == player end) local refs = Utils.Where(Map.ActorsInWorld, function(actor) return actor.Type == "refinery" and actor.Owner == Ordos end)
if #refs == 0 then if #refs == 0 then
harkonnen.MarkCompletedObjective(KillOrdos) Harkonnen.MarkCompletedObjective(KillOrdos)
else else
Trigger.OnAllRemovedFromWorld(refs, function() Trigger.OnAllRemovedFromWorld(refs, function()
harkonnen.MarkCompletedObjective(KillOrdos) Harkonnen.MarkCompletedObjective(KillOrdos)
end) end)
local silos = Utils.Where(Map.ActorsInWorld, function(actor) return actor.Type == "silo" and actor.Owner == player end) local silos = Utils.Where(Map.ActorsInWorld, function(actor) return actor.Type == "silo" and actor.Owner == Ordos end)
Utils.Do(refs, function(actor) Trigger.OnRemovedFromWorld(actor, checkResourceCapacity) end) Utils.Do(refs, function(actor) Trigger.OnRemovedFromWorld(actor, checkResourceCapacity) end)
Utils.Do(silos, function(actor) Trigger.OnRemovedFromWorld(actor, checkResourceCapacity) end) Utils.Do(silos, function(actor) Trigger.OnRemovedFromWorld(actor, checkResourceCapacity) end)
end end
@@ -144,8 +144,8 @@ WorldLoaded = function()
Media.DisplayMessage(Messages[1], Mentat) Media.DisplayMessage(Messages[1], Mentat)
Trigger.AfterDelay(DateTime.Seconds(25), function() Trigger.AfterDelay(DateTime.Seconds(25), function()
Media.PlaySpeechNotification(player, "Reinforce") Media.PlaySpeechNotification(Ordos, "Reinforce")
Reinforcements.Reinforce(player, OrdosReinforcements, OrdosEntryPath) Reinforcements.Reinforce(Ordos, OrdosReinforcements, OrdosEntryPath)
end) end)
WavesLeft = HarkonnenAttackWaves[Difficulty] WavesLeft = HarkonnenAttackWaves[Difficulty]
@@ -159,7 +159,7 @@ SendReinforcements = function()
if HarkonnenAttackDelay < 0 then HarkonnenAttackDelay = 0 end if HarkonnenAttackDelay < 0 then HarkonnenAttackDelay = 0 end
Trigger.AfterDelay(delay, function() Trigger.AfterDelay(delay, function()
Reinforcements.Reinforce(harkonnen, Utils.Random(units), { Utils.Random(HarkonnenEntryWaypoints) }, 10, IdleHunt) Reinforcements.Reinforce(Harkonnen, Utils.Random(units), { Utils.Random(HarkonnenEntryWaypoints) }, 10, IdleHunt)
WavesLeft = WavesLeft - 1 WavesLeft = WavesLeft - 1
if WavesLeft == 0 then if WavesLeft == 0 then

View File

@@ -61,16 +61,16 @@ Messages =
CachedResources = -1 CachedResources = -1
Tick = function() Tick = function()
if HarkonnenArrived and harkonnen.HasNoRequiredUnits() then if HarkonnenArrived and Harkonnen.HasNoRequiredUnits() then
player.MarkCompletedObjective(KillHarkonnen) Ordos.MarkCompletedObjective(KillHarkonnen)
end end
if player.Resources > SpiceToHarvest - 1 then if Ordos.Resources > SpiceToHarvest - 1 then
player.MarkCompletedObjective(GatherSpice) Ordos.MarkCompletedObjective(GatherSpice)
end end
-- player has no Wind Trap -- player has no Wind Trap
if (player.PowerProvided <= 20 or player.PowerState ~= "Normal") and DateTime.GameTime % DateTime.Seconds(32) == 0 then if (Ordos.PowerProvided <= 20 or Ordos.PowerState ~= "Normal") and DateTime.GameTime % DateTime.Seconds(32) == 0 then
HasPower = false HasPower = false
Media.DisplayMessage(Messages[2], Mentat) Media.DisplayMessage(Messages[2], Mentat)
else else
@@ -78,40 +78,40 @@ Tick = function()
end end
-- player has no Refinery and no Silos -- player has no Refinery and no Silos
if HasPower and player.ResourceCapacity == 0 and DateTime.GameTime % DateTime.Seconds(32) == 0 then if HasPower and Ordos.ResourceCapacity == 0 and DateTime.GameTime % DateTime.Seconds(32) == 0 then
Media.DisplayMessage(Messages[3], Mentat) Media.DisplayMessage(Messages[3], Mentat)
end end
if HasPower and player.Resources > player.ResourceCapacity * 0.8 and DateTime.GameTime % DateTime.Seconds(32) == 0 then if HasPower and Ordos.Resources > Ordos.ResourceCapacity * 0.8 and DateTime.GameTime % DateTime.Seconds(32) == 0 then
Media.DisplayMessage(Messages[4], Mentat) Media.DisplayMessage(Messages[4], Mentat)
end end
if player.Resources ~= CachedResources then if Ordos.Resources ~= CachedResources then
local parameters = { ["harvested"] = player.Resources, ["goal"] = SpiceToHarvest } local parameters = { ["harvested"] = Ordos.Resources, ["goal"] = SpiceToHarvest }
local harvestedResources = UserInterface.Translate("harvested-resources", parameters) local harvestedResources = UserInterface.Translate("harvested-resources", parameters)
UserInterface.SetMissionText(harvestedResources) UserInterface.SetMissionText(harvestedResources)
CachedResources = player.Resources CachedResources = Ordos.Resources
end end
end end
WorldLoaded = function() WorldLoaded = function()
player = Player.GetPlayer("Ordos") Ordos = Player.GetPlayer("Ordos")
harkonnen = Player.GetPlayer("Harkonnen") Harkonnen = Player.GetPlayer("Harkonnen")
SpiceToHarvest = ToHarvest[Difficulty] SpiceToHarvest = ToHarvest[Difficulty]
InitObjectives(player) InitObjectives(Ordos)
KillOrdos = AddPrimaryObjective(harkonnen, "") KillOrdos = AddPrimaryObjective(Harkonnen, "")
local harvestSpice = UserInterface.Translate("harvest-spice", { ["spice"] = SpiceToHarvest }) local harvestSpice = UserInterface.Translate("harvest-spice", { ["spice"] = SpiceToHarvest })
GatherSpice = AddPrimaryObjective(player, harvestSpice) GatherSpice = AddPrimaryObjective(Ordos, harvestSpice)
KillHarkonnen = AddSecondaryObjective(player, "eliminate-harkonnen-units-reinforcements") KillHarkonnen = AddSecondaryObjective(Ordos, "eliminate-harkonnen-units-reinforcements")
local checkResourceCapacity = function() local checkResourceCapacity = function()
Trigger.AfterDelay(0, function() Trigger.AfterDelay(0, function()
if player.ResourceCapacity < SpiceToHarvest then if Ordos.ResourceCapacity < SpiceToHarvest then
Media.DisplayMessage(UserInterface.Translate("not-enough-silos"), Mentat) Media.DisplayMessage(UserInterface.Translate("not-enough-silos"), Mentat)
Trigger.AfterDelay(DateTime.Seconds(3), function() Trigger.AfterDelay(DateTime.Seconds(3), function()
harkonnen.MarkCompletedObjective(KillOrdos) Harkonnen.MarkCompletedObjective(KillOrdos)
end) end)
return true return true
@@ -126,16 +126,16 @@ WorldLoaded = function()
return return
end end
local refs = Utils.Where(Map.ActorsInWorld, function(actor) return actor.Type == "refinery" and actor.Owner == player end) local refs = Utils.Where(Map.ActorsInWorld, function(actor) return actor.Type == "refinery" and actor.Owner == Ordos end)
if #refs == 0 then if #refs == 0 then
harkonnen.MarkCompletedObjective(KillOrdos) Harkonnen.MarkCompletedObjective(KillOrdos)
else else
Trigger.OnAllRemovedFromWorld(refs, function() Trigger.OnAllRemovedFromWorld(refs, function()
harkonnen.MarkCompletedObjective(KillOrdos) Harkonnen.MarkCompletedObjective(KillOrdos)
end) end)
local silos = Utils.Where(Map.ActorsInWorld, function(actor) return actor.Type == "silo" and actor.Owner == player end) local silos = Utils.Where(Map.ActorsInWorld, function(actor) return actor.Type == "silo" and actor.Owner == Ordos end)
Utils.Do(refs, function(actor) Trigger.OnRemovedFromWorld(actor, checkResourceCapacity) end) Utils.Do(refs, function(actor) Trigger.OnRemovedFromWorld(actor, checkResourceCapacity) end)
Utils.Do(silos, function(actor) Trigger.OnRemovedFromWorld(actor, checkResourceCapacity) end) Utils.Do(silos, function(actor) Trigger.OnRemovedFromWorld(actor, checkResourceCapacity) end)
end end
@@ -144,8 +144,8 @@ WorldLoaded = function()
Media.DisplayMessage(Messages[1], Mentat) Media.DisplayMessage(Messages[1], Mentat)
Trigger.AfterDelay(DateTime.Seconds(25), function() Trigger.AfterDelay(DateTime.Seconds(25), function()
Media.PlaySpeechNotification(player, "Reinforce") Media.PlaySpeechNotification(Ordos, "Reinforce")
Reinforcements.Reinforce(player, OrdosReinforcements, OrdosEntryPath) Reinforcements.Reinforce(Ordos, OrdosReinforcements, OrdosEntryPath)
end) end)
WavesLeft = HarkonnenAttackWaves[Difficulty] WavesLeft = HarkonnenAttackWaves[Difficulty]
@@ -159,7 +159,7 @@ SendReinforcements = function()
if HarkonnenAttackDelay < 0 then HarkonnenAttackDelay = 0 end if HarkonnenAttackDelay < 0 then HarkonnenAttackDelay = 0 end
Trigger.AfterDelay(delay, function() Trigger.AfterDelay(delay, function()
Reinforcements.Reinforce(harkonnen, Utils.Random(units), { Utils.Random(HarkonnenEntryWaypoints) }, 10, IdleHunt) Reinforcements.Reinforce(Harkonnen, Utils.Random(units), { Utils.Random(HarkonnenEntryWaypoints) }, 10, IdleHunt)
WavesLeft = WavesLeft - 1 WavesLeft = WavesLeft - 1
if WavesLeft == 0 then if WavesLeft == 0 then

View File

@@ -24,11 +24,11 @@ AttackDelays =
HarkonnenInfantryTypes = { "light_inf" } HarkonnenInfantryTypes = { "light_inf" }
ActivateAI = function() ActivateAI = function()
IdlingUnits[harkonnen] = { } IdlingUnits[Harkonnen] = { }
local delay = function() return Utils.RandomInteger(AttackDelays[Difficulty][1], AttackDelays[Difficulty][2] + 1) end local delay = function() return Utils.RandomInteger(AttackDelays[Difficulty][1], AttackDelays[Difficulty][2] + 1) end
local toBuild = function() return HarkonnenInfantryTypes end local toBuild = function() return HarkonnenInfantryTypes end
local attackThresholdSize = AttackGroupSize[Difficulty] * 2.5 local attackThresholdSize = AttackGroupSize[Difficulty] * 2.5
DefendAndRepairBase(harkonnen, HarkonnenBase, 0.75, AttackGroupSize[Difficulty]) DefendAndRepairBase(Harkonnen, HarkonnenBase, 0.75, AttackGroupSize[Difficulty])
ProduceUnits(harkonnen, HBarracks, delay, toBuild, AttackGroupSize[Difficulty], attackThresholdSize) ProduceUnits(Harkonnen, HBarracks, delay, toBuild, AttackGroupSize[Difficulty], attackThresholdSize)
end end

View File

@@ -81,39 +81,39 @@ OrdosReinforcements = { "light_inf", "light_inf", "raider" }
OrdosEntryPath = { OrdosEntry.Location, OrdosRally.Location } OrdosEntryPath = { OrdosEntry.Location, OrdosRally.Location }
Tick = function() Tick = function()
if player.HasNoRequiredUnits() then if Ordos.HasNoRequiredUnits() then
harkonnen.MarkCompletedObjective(KillOrdos) Harkonnen.MarkCompletedObjective(KillOrdos)
end end
if harkonnen.HasNoRequiredUnits() and not player.IsObjectiveCompleted(KillHarkonnen) then if Harkonnen.HasNoRequiredUnits() and not Ordos.IsObjectiveCompleted(KillHarkonnen) then
Media.DisplayMessage(UserInterface.Translate("harkonnen-annihilated"), Mentat) Media.DisplayMessage(UserInterface.Translate("harkonnen-annihilated"), Mentat)
player.MarkCompletedObjective(KillHarkonnen) Ordos.MarkCompletedObjective(KillHarkonnen)
end end
end end
WorldLoaded = function() WorldLoaded = function()
harkonnen = Player.GetPlayer("Harkonnen") Harkonnen = Player.GetPlayer("Harkonnen")
player = Player.GetPlayer("Ordos") Ordos = Player.GetPlayer("Ordos")
InitObjectives(player) InitObjectives(Ordos)
KillOrdos = AddPrimaryObjective(harkonnen, "") KillOrdos = AddPrimaryObjective(Harkonnen, "")
KillHarkonnen = AddPrimaryObjective(player, "destroy-harkonnen-forces") KillHarkonnen = AddPrimaryObjective(Ordos, "destroy-harkonnen-forces")
Camera.Position = OConyard.CenterPosition Camera.Position = OConyard.CenterPosition
Trigger.OnAllKilled(HarkonnenBase, function() Trigger.OnAllKilled(HarkonnenBase, function()
Utils.Do(harkonnen.GetGroundAttackers(), IdleHunt) Utils.Do(Harkonnen.GetGroundAttackers(), IdleHunt)
end) end)
Trigger.AfterDelay(DateTime.Minutes(1), function() Trigger.AfterDelay(DateTime.Minutes(1), function()
Media.PlaySpeechNotification(player, "Reinforce") Media.PlaySpeechNotification(Ordos, "Reinforce")
Reinforcements.ReinforceWithTransport(player, "carryall.reinforce", OrdosReinforcements, OrdosEntryPath, { OrdosEntryPath[1] }) Reinforcements.ReinforceWithTransport(Ordos, "carryall.reinforce", OrdosReinforcements, OrdosEntryPath, { OrdosEntryPath[1] })
end) end)
TriggerCarryallReinforcements(player, harkonnen, HarkonnenBaseAreaTrigger, InitialHarkonnenReinforcements[1], InitialHarkonnenReinforcementsPaths[1]) TriggerCarryallReinforcements(Ordos, Harkonnen, HarkonnenBaseAreaTrigger, InitialHarkonnenReinforcements[1], InitialHarkonnenReinforcementsPaths[1])
TriggerCarryallReinforcements(player, harkonnen, HarkonnenBaseAreaTrigger, InitialHarkonnenReinforcements[2], InitialHarkonnenReinforcementsPaths[2]) TriggerCarryallReinforcements(Ordos, Harkonnen, HarkonnenBaseAreaTrigger, InitialHarkonnenReinforcements[2], InitialHarkonnenReinforcementsPaths[2])
local path = function() return Utils.Random(HarkonnenAttackPaths) end local path = function() return Utils.Random(HarkonnenAttackPaths) end
SendCarryallReinforcements(harkonnen, 0, HarkonnenAttackWaves[Difficulty], HarkonnenAttackDelay[Difficulty], path, HarkonnenReinforcements[Difficulty]) SendCarryallReinforcements(Harkonnen, 0, HarkonnenAttackWaves[Difficulty], HarkonnenAttackDelay[Difficulty], path, HarkonnenReinforcements[Difficulty])
Trigger.AfterDelay(0, ActivateAI) Trigger.AfterDelay(0, ActivateAI)
end end

View File

@@ -24,11 +24,11 @@ AttackDelays =
HarkonnenInfantryTypes = { "light_inf" } HarkonnenInfantryTypes = { "light_inf" }
ActivateAI = function() ActivateAI = function()
IdlingUnits[harkonnen] = { } IdlingUnits[Harkonnen] = { }
local delay = function() return Utils.RandomInteger(AttackDelays[Difficulty][1], AttackDelays[Difficulty][2] + 1) end local delay = function() return Utils.RandomInteger(AttackDelays[Difficulty][1], AttackDelays[Difficulty][2] + 1) end
local toBuild = function() return HarkonnenInfantryTypes end local toBuild = function() return HarkonnenInfantryTypes end
local attackThresholdSize = AttackGroupSize[Difficulty] * 2.5 local attackThresholdSize = AttackGroupSize[Difficulty] * 2.5
DefendAndRepairBase(harkonnen, HarkonnenBase, 0.75, AttackGroupSize[Difficulty]) DefendAndRepairBase(Harkonnen, HarkonnenBase, 0.75, AttackGroupSize[Difficulty])
ProduceUnits(harkonnen, HBarracks, delay, toBuild, AttackGroupSize[Difficulty], attackThresholdSize) ProduceUnits(Harkonnen, HBarracks, delay, toBuild, AttackGroupSize[Difficulty], attackThresholdSize)
end end

View File

@@ -65,31 +65,31 @@ HarkonnenAttackWaves =
} }
Tick = function() Tick = function()
if player.HasNoRequiredUnits() then if Ordos.HasNoRequiredUnits() then
harkonnen.MarkCompletedObjective(KillOrdos) Harkonnen.MarkCompletedObjective(KillOrdos)
end end
if harkonnen.HasNoRequiredUnits() and not player.IsObjectiveCompleted(KillHarkonnen) then if Harkonnen.HasNoRequiredUnits() and not Ordos.IsObjectiveCompleted(KillHarkonnen) then
Media.DisplayMessage(UserInterface.Translate("harkonnen-annihilated"), Mentat) Media.DisplayMessage(UserInterface.Translate("harkonnen-annihilated"), Mentat)
player.MarkCompletedObjective(KillHarkonnen) Ordos.MarkCompletedObjective(KillHarkonnen)
end end
end end
WorldLoaded = function() WorldLoaded = function()
harkonnen = Player.GetPlayer("Harkonnen") Harkonnen = Player.GetPlayer("Harkonnen")
player = Player.GetPlayer("Ordos") Ordos = Player.GetPlayer("Ordos")
InitObjectives(player) InitObjectives(Ordos)
KillOrdos = AddPrimaryObjective(harkonnen, "") KillOrdos = AddPrimaryObjective(Harkonnen, "")
KillHarkonnen = AddPrimaryObjective(player, "destroy-harkonnen-forces") KillHarkonnen = AddPrimaryObjective(Ordos, "destroy-harkonnen-forces")
Camera.Position = OConyard.CenterPosition Camera.Position = OConyard.CenterPosition
Trigger.OnAllKilled(HarkonnenBase, function() Trigger.OnAllKilled(HarkonnenBase, function()
Utils.Do(harkonnen.GetGroundAttackers(), IdleHunt) Utils.Do(Harkonnen.GetGroundAttackers(), IdleHunt)
end) end)
local path = function() return Utils.Random(HarkonnenAttackPaths) end local path = function() return Utils.Random(HarkonnenAttackPaths) end
SendCarryallReinforcements(harkonnen, 0, HarkonnenAttackWaves[Difficulty], HarkonnenAttackDelay[Difficulty], path, HarkonnenReinforcements[Difficulty]) SendCarryallReinforcements(Harkonnen, 0, HarkonnenAttackWaves[Difficulty], HarkonnenAttackDelay[Difficulty], path, HarkonnenReinforcements[Difficulty])
Trigger.AfterDelay(0, ActivateAI) Trigger.AfterDelay(0, ActivateAI)
end end

View File

@@ -25,13 +25,13 @@ HarkonnenInfantryTypes = { "light_inf", "light_inf", "light_inf", "trooper", "tr
HarkonnenVehicleTypes = { "trike", "trike", "quad" } HarkonnenVehicleTypes = { "trike", "trike", "quad" }
InitAIUnits = function() InitAIUnits = function()
IdlingUnits[harkonnen] = Reinforcements.Reinforce(harkonnen, HarkonnenInitialReinforcements, HarkonnenInitialPath) IdlingUnits[Harkonnen] = Reinforcements.Reinforce(Harkonnen, HarkonnenInitialReinforcements, HarkonnenInitialPath)
DefendAndRepairBase(harkonnen, HarkonnenBase, 0.75, AttackGroupSize[Difficulty]) DefendAndRepairBase(Harkonnen, HarkonnenBase, 0.75, AttackGroupSize[Difficulty])
end end
ActivateAI = function() ActivateAI = function()
LastHarvesterEaten[harkonnen] = true LastHarvesterEaten[Harkonnen] = true
Trigger.AfterDelay(0, InitAIUnits) Trigger.AfterDelay(0, InitAIUnits)
HConyard.Produce(OrdosUpgrades[1]) HConyard.Produce(OrdosUpgrades[1])
@@ -44,7 +44,7 @@ ActivateAI = function()
-- Finish the upgrades first before trying to build something -- Finish the upgrades first before trying to build something
Trigger.AfterDelay(DateTime.Seconds(14), function() Trigger.AfterDelay(DateTime.Seconds(14), function()
ProduceUnits(harkonnen, HBarracks, delay, infantryToBuild, AttackGroupSize[Difficulty], attackThresholdSize) ProduceUnits(Harkonnen, HBarracks, delay, infantryToBuild, AttackGroupSize[Difficulty], attackThresholdSize)
ProduceUnits(harkonnen, HLightFactory, delay, vehilcesToBuild, AttackGroupSize[Difficulty], attackThresholdSize) ProduceUnits(Harkonnen, HLightFactory, delay, vehilcesToBuild, AttackGroupSize[Difficulty], attackThresholdSize)
end) end)
end end

View File

@@ -77,25 +77,25 @@ OrdosBaseBuildings = { "barracks", "light_factory" }
OrdosUpgrades = { "upgrade.barracks", "upgrade.light" } OrdosUpgrades = { "upgrade.barracks", "upgrade.light" }
MessageCheck = function(index) MessageCheck = function(index)
return #player.GetActorsByType(OrdosBaseBuildings[index]) > 0 and not player.HasPrerequisites({ OrdosUpgrades[index] }) return #Ordos.GetActorsByType(OrdosBaseBuildings[index]) > 0 and not Ordos.HasPrerequisites({ OrdosUpgrades[index] })
end end
Tick = function() Tick = function()
if player.HasNoRequiredUnits() then if Ordos.HasNoRequiredUnits() then
harkonnen.MarkCompletedObjective(KillOrdos) Harkonnen.MarkCompletedObjective(KillOrdos)
end end
if harkonnen.HasNoRequiredUnits() and not player.IsObjectiveCompleted(KillHarkonnen) then if Harkonnen.HasNoRequiredUnits() and not Ordos.IsObjectiveCompleted(KillHarkonnen) then
Media.DisplayMessage(UserInterface.Translate("harkonnen-annihilated"), Mentat) Media.DisplayMessage(UserInterface.Translate("harkonnen-annihilated"), Mentat)
player.MarkCompletedObjective(KillHarkonnen) Ordos.MarkCompletedObjective(KillHarkonnen)
end end
if DateTime.GameTime % DateTime.Seconds(10) == 0 and LastHarvesterEaten[harkonnen] then if DateTime.GameTime % DateTime.Seconds(10) == 0 and LastHarvesterEaten[Harkonnen] then
local units = harkonnen.GetActorsByType("harvester") local units = Harkonnen.GetActorsByType("harvester")
if #units > 0 then if #units > 0 then
LastHarvesterEaten[harkonnen] = false LastHarvesterEaten[Harkonnen] = false
ProtectHarvester(units[1], harkonnen, AttackGroupSize[Difficulty]) ProtectHarvester(units[1], Harkonnen, AttackGroupSize[Difficulty])
end end
end end
@@ -105,27 +105,27 @@ Tick = function()
end end
WorldLoaded = function() WorldLoaded = function()
harkonnen = Player.GetPlayer("Harkonnen") Harkonnen = Player.GetPlayer("Harkonnen")
player = Player.GetPlayer("Ordos") Ordos = Player.GetPlayer("Ordos")
InitObjectives(player) InitObjectives(Ordos)
KillOrdos = AddPrimaryObjective(harkonnen, "") KillOrdos = AddPrimaryObjective(Harkonnen, "")
KillHarkonnen = AddPrimaryObjective(player, "eliminate-harkonnen-units-reinforcements") KillHarkonnen = AddPrimaryObjective(Ordos, "eliminate-harkonnen-units-reinforcements")
Camera.Position = OConyard.CenterPosition Camera.Position = OConyard.CenterPosition
Trigger.OnAllKilled(HarkonnenBase, function() Trigger.OnAllKilled(HarkonnenBase, function()
Utils.Do(harkonnen.GetGroundAttackers(), IdleHunt) Utils.Do(Harkonnen.GetGroundAttackers(), IdleHunt)
end) end)
local path = function() return Utils.Random(HarkonnenPaths) end local path = function() return Utils.Random(HarkonnenPaths) end
local waveCondition = function() return player.IsObjectiveCompleted(KillHarkonnen) end local waveCondition = function() return Ordos.IsObjectiveCompleted(KillHarkonnen) end
SendCarryallReinforcements(harkonnen, 0, HarkonnenAttackWaves[Difficulty], HarkonnenAttackDelay[Difficulty], path, HarkonnenReinforcements[Difficulty], waveCondition) SendCarryallReinforcements(Harkonnen, 0, HarkonnenAttackWaves[Difficulty], HarkonnenAttackDelay[Difficulty], path, HarkonnenReinforcements[Difficulty], waveCondition)
ActivateAI() ActivateAI()
Trigger.AfterDelay(DateTime.Minutes(2) + DateTime.Seconds(30), function() Trigger.AfterDelay(DateTime.Minutes(2) + DateTime.Seconds(30), function()
Reinforcements.ReinforceWithTransport(player, "carryall.reinforce", OrdosReinforcements, OrdosPath, { OrdosPath[1] }) Reinforcements.ReinforceWithTransport(Ordos, "carryall.reinforce", OrdosReinforcements, OrdosPath, { OrdosPath[1] })
end) end)
TriggerCarryallReinforcements(player, harkonnen, HarkonnenBaseAreaTrigger, HarkonnenHunters, HarkonnenHunterPath) TriggerCarryallReinforcements(Ordos, Harkonnen, HarkonnenBaseAreaTrigger, HarkonnenHunters, HarkonnenHunterPath)
end end

View File

@@ -25,13 +25,13 @@ HarkonnenInfantryTypes = { "light_inf", "light_inf", "light_inf", "trooper", "tr
HarkonnenVehicleTypes = { "trike", "trike", "quad" } HarkonnenVehicleTypes = { "trike", "trike", "quad" }
InitAIUnits = function() InitAIUnits = function()
IdlingUnits[harkonnen] = Reinforcements.Reinforce(harkonnen, HarkonnenInitialReinforcements, HarkonnenInitialPath) IdlingUnits[Harkonnen] = Reinforcements.Reinforce(Harkonnen, HarkonnenInitialReinforcements, HarkonnenInitialPath)
DefendAndRepairBase(harkonnen, HarkonnenBase, 0.75, AttackGroupSize[Difficulty]) DefendAndRepairBase(Harkonnen, HarkonnenBase, 0.75, AttackGroupSize[Difficulty])
end end
ActivateAI = function() ActivateAI = function()
LastHarvesterEaten[harkonnen] = true LastHarvesterEaten[Harkonnen] = true
Trigger.AfterDelay(0, InitAIUnits) Trigger.AfterDelay(0, InitAIUnits)
HConyard.Produce(OrdosUpgrades[1]) HConyard.Produce(OrdosUpgrades[1])
@@ -44,7 +44,7 @@ ActivateAI = function()
-- Finish the upgrades first before trying to build something -- Finish the upgrades first before trying to build something
Trigger.AfterDelay(DateTime.Seconds(14), function() Trigger.AfterDelay(DateTime.Seconds(14), function()
ProduceUnits(harkonnen, HBarracks, delay, infantryToBuild, AttackGroupSize[Difficulty], attackThresholdSize) ProduceUnits(Harkonnen, HBarracks, delay, infantryToBuild, AttackGroupSize[Difficulty], attackThresholdSize)
ProduceUnits(harkonnen, HLightFactory, delay, vehilcesToBuild, AttackGroupSize[Difficulty], attackThresholdSize) ProduceUnits(Harkonnen, HLightFactory, delay, vehilcesToBuild, AttackGroupSize[Difficulty], attackThresholdSize)
end) end)
end end

View File

@@ -106,33 +106,33 @@ OrdosBaseBuildings = { "barracks", "light_factory" }
OrdosUpgrades = { "upgrade.barracks", "upgrade.light" } OrdosUpgrades = { "upgrade.barracks", "upgrade.light" }
MessageCheck = function(index) MessageCheck = function(index)
return #player.GetActorsByType(OrdosBaseBuildings[index]) > 0 and not player.HasPrerequisites({ OrdosUpgrades[index] }) return #Ordos.GetActorsByType(OrdosBaseBuildings[index]) > 0 and not Ordos.HasPrerequisites({ OrdosUpgrades[index] })
end end
SendOrdosReinforcements = function(timer, unit, path) SendOrdosReinforcements = function(timer, unit, path)
Trigger.AfterDelay(timer, function() Trigger.AfterDelay(timer, function()
Reinforcements.ReinforceWithTransport(player, "carryall.reinforce", unit, path, { path[1] }) Reinforcements.ReinforceWithTransport(Ordos, "carryall.reinforce", unit, path, { path[1] })
SendOrdosReinforcements(timer, unit, path) SendOrdosReinforcements(timer, unit, path)
end) end)
end end
Tick = function() Tick = function()
if player.HasNoRequiredUnits() then if Ordos.HasNoRequiredUnits() then
harkonnen.MarkCompletedObjective(KillOrdos) Harkonnen.MarkCompletedObjective(KillOrdos)
end end
if harkonnen.HasNoRequiredUnits() and not player.IsObjectiveCompleted(KillHarkonnen) then if Harkonnen.HasNoRequiredUnits() and not Ordos.IsObjectiveCompleted(KillHarkonnen) then
Media.DisplayMessage(UserInterface.Translate("harkonnen-annihilated"), Mentat) Media.DisplayMessage(UserInterface.Translate("harkonnen-annihilated"), Mentat)
player.MarkCompletedObjective(KillHarkonnen) Ordos.MarkCompletedObjective(KillHarkonnen)
end end
if DateTime.GameTime % DateTime.Seconds(10) == 0 and LastHarvesterEaten[harkonnen] then if DateTime.GameTime % DateTime.Seconds(10) == 0 and LastHarvesterEaten[Harkonnen] then
local units = harkonnen.GetActorsByType("harvester") local units = Harkonnen.GetActorsByType("harvester")
if #units > 0 then if #units > 0 then
LastHarvesterEaten[harkonnen] = false LastHarvesterEaten[Harkonnen] = false
ProtectHarvester(units[1], harkonnen, AttackGroupSize[Difficulty]) ProtectHarvester(units[1], Harkonnen, AttackGroupSize[Difficulty])
end end
end end
@@ -142,32 +142,32 @@ Tick = function()
end end
WorldLoaded = function() WorldLoaded = function()
harkonnen = Player.GetPlayer("Harkonnen") Harkonnen = Player.GetPlayer("Harkonnen")
player = Player.GetPlayer("Ordos") Ordos = Player.GetPlayer("Ordos")
InitObjectives(player) InitObjectives(Ordos)
KillOrdos = AddPrimaryObjective(harkonnen, "") KillOrdos = AddPrimaryObjective(Harkonnen, "")
KillHarkonnen = AddPrimaryObjective(player, "eliminate-harkonnen-units-reinforcements") KillHarkonnen = AddPrimaryObjective(Ordos, "eliminate-harkonnen-units-reinforcements")
Camera.Position = OConyard.CenterPosition Camera.Position = OConyard.CenterPosition
Trigger.OnAllKilled(HarkonnenBase, function() Trigger.OnAllKilled(HarkonnenBase, function()
Utils.Do(harkonnen.GetGroundAttackers(), IdleHunt) Utils.Do(Harkonnen.GetGroundAttackers(), IdleHunt)
end) end)
local path = function() return Utils.Random(HarkonnenPaths) end local path = function() return Utils.Random(HarkonnenPaths) end
local waveCondition = function() return player.IsObjectiveCompleted(KillHarkonnen) end local waveCondition = function() return Ordos.IsObjectiveCompleted(KillHarkonnen) end
SendCarryallReinforcements(harkonnen, 0, HarkonnenAttackWaves[Difficulty], HarkonnenAttackDelay[Difficulty], path, HarkonnenReinforcements[Difficulty], waveCondition) SendCarryallReinforcements(Harkonnen, 0, HarkonnenAttackWaves[Difficulty], HarkonnenAttackDelay[Difficulty], path, HarkonnenReinforcements[Difficulty], waveCondition)
ActivateAI() ActivateAI()
SendOrdosReinforcements(OrdosReinforcementDelays[1], OrdosReinforcements[1], OrdosPaths[1]) SendOrdosReinforcements(OrdosReinforcementDelays[1], OrdosReinforcements[1], OrdosPaths[1])
SendOrdosReinforcements(OrdosReinforcementDelays[3], OrdosReinforcements[3], OrdosPaths[3]) SendOrdosReinforcements(OrdosReinforcementDelays[3], OrdosReinforcements[3], OrdosPaths[3])
Trigger.AfterDelay(OrdosReinforcementDelays[2], function() Trigger.AfterDelay(OrdosReinforcementDelays[2], function()
Reinforcements.ReinforceWithTransport(player, "carryall.reinforce", OrdosReinforcements[2], OrdosPaths[2], { OrdosPaths[2][1] }) Reinforcements.ReinforceWithTransport(Ordos, "carryall.reinforce", OrdosReinforcements[2], OrdosPaths[2], { OrdosPaths[2][1] })
end) end)
TriggerCarryallReinforcements(player, harkonnen, HarkonnenBaseAreaTrigger, HarkonnenHunters[1], HarkonnenHunterPaths[1]) TriggerCarryallReinforcements(Ordos, Harkonnen, HarkonnenBaseAreaTrigger, HarkonnenHunters[1], HarkonnenHunterPaths[1])
TriggerCarryallReinforcements(player, harkonnen, HarkonnenBaseAreaTrigger, HarkonnenHunters[2], HarkonnenHunterPaths[2]) TriggerCarryallReinforcements(Ordos, Harkonnen, HarkonnenBaseAreaTrigger, HarkonnenHunters[2], HarkonnenHunterPaths[2])
TriggerCarryallReinforcements(player, harkonnen, HarkonnenBaseAreaTrigger, HarkonnenHunters[3], HarkonnenHunterPaths[3]) TriggerCarryallReinforcements(Ordos, Harkonnen, HarkonnenBaseAreaTrigger, HarkonnenHunters[3], HarkonnenHunterPaths[3])
end end

View File

@@ -37,8 +37,8 @@ InitAIUnits = function(house)
end end
ActivateAI = function() ActivateAI = function()
InitAIUnits(harkonnen) InitAIUnits(Harkonnen)
InitAIUnits(smuggler) InitAIUnits(Smuggler)
local delay = function() return Utils.RandomInteger(AttackDelays[Difficulty][1], AttackDelays[Difficulty][2] + 1) end local delay = function() return Utils.RandomInteger(AttackDelays[Difficulty][1], AttackDelays[Difficulty][2] + 1) end
local infantryToBuild = function() return { Utils.Random(EnemyInfantryTypes) } end local infantryToBuild = function() return { Utils.Random(EnemyInfantryTypes) } end
@@ -48,11 +48,11 @@ ActivateAI = function()
local sTanksToBuild = function() return SmugglerTankType end local sTanksToBuild = function() return SmugglerTankType end
local attackTresholdSize = AttackGroupSize[Difficulty] * 2.5 local attackTresholdSize = AttackGroupSize[Difficulty] * 2.5
ProduceUnits(harkonnen, HBarracks, delay, infantryToBuild, AttackGroupSize[Difficulty], attackTresholdSize) ProduceUnits(Harkonnen, HBarracks, delay, infantryToBuild, AttackGroupSize[Difficulty], attackTresholdSize)
ProduceUnits(harkonnen, HLightFactory, delay, hVehiclesToBuild, AttackGroupSize[Difficulty], attackTresholdSize) ProduceUnits(Harkonnen, HLightFactory, delay, hVehiclesToBuild, AttackGroupSize[Difficulty], attackTresholdSize)
ProduceUnits(harkonnen, HHeavyFactory, delay, hTanksToBuild, AttackGroupSize[Difficulty], attackTresholdSize) ProduceUnits(Harkonnen, HHeavyFactory, delay, hTanksToBuild, AttackGroupSize[Difficulty], attackTresholdSize)
ProduceUnits(smuggler, SBarracks, delay, infantryToBuild, AttackGroupSize[Difficulty], attackTresholdSize) ProduceUnits(Smuggler, SBarracks, delay, infantryToBuild, AttackGroupSize[Difficulty], attackTresholdSize)
ProduceUnits(smuggler, SLightFactory, delay, sVehiclesToBuild, AttackGroupSize[Difficulty], attackTresholdSize) ProduceUnits(Smuggler, SLightFactory, delay, sVehiclesToBuild, AttackGroupSize[Difficulty], attackTresholdSize)
ProduceUnits(smuggler, SHeavyFactory, delay, sTanksToBuild, AttackGroupSize[Difficulty], attackTresholdSize) ProduceUnits(Smuggler, SHeavyFactory, delay, sTanksToBuild, AttackGroupSize[Difficulty], attackTresholdSize)
end end

View File

@@ -52,11 +52,11 @@ OrdosPath = { OrdosEntry.Location, OrdosRally.Location }
SendHarkonnen = function(path) SendHarkonnen = function(path)
Trigger.AfterDelay(HarkonnenAttackDelay[Difficulty], function() Trigger.AfterDelay(HarkonnenAttackDelay[Difficulty], function()
if player.IsObjectiveCompleted(KillHarkonnen) then if Ordos.IsObjectiveCompleted(KillHarkonnen) then
return return
end end
local units = Reinforcements.ReinforceWithTransport(harkonnen, "carryall.reinforce", HarkonnenLightInfantryRushers[Difficulty], path, { path[1] })[2] local units = Reinforcements.ReinforceWithTransport(Harkonnen, "carryall.reinforce", HarkonnenLightInfantryRushers[Difficulty], path, { path[1] })[2]
Utils.Do(units, function(unit) Utils.Do(units, function(unit)
unit.AttackMove(HarkonnenAttackLocation) unit.AttackMove(HarkonnenAttackLocation)
IdleHunt(unit) IdleHunt(unit)
@@ -83,64 +83,64 @@ end
AttackNotifier = 0 AttackNotifier = 0
Tick = function() Tick = function()
if player.HasNoRequiredUnits() then if Ordos.HasNoRequiredUnits() then
harkonnen.MarkCompletedObjective(KillOrdosH) Harkonnen.MarkCompletedObjective(KillOrdosH)
smuggler.MarkCompletedObjective(KillOrdosS) Smuggler.MarkCompletedObjective(KillOrdosS)
smuggler.MarkCompletedObjective(DefendOutpost) Smuggler.MarkCompletedObjective(DefendOutpost)
end end
if harkonnen.HasNoRequiredUnits() and not player.IsObjectiveCompleted(KillHarkonnen) then if Harkonnen.HasNoRequiredUnits() and not Ordos.IsObjectiveCompleted(KillHarkonnen) then
Media.DisplayMessage(UserInterface.Translate("harkonnen-annihilated"), Mentat) Media.DisplayMessage(UserInterface.Translate("harkonnen-annihilated"), Mentat)
player.MarkCompletedObjective(KillHarkonnen) Ordos.MarkCompletedObjective(KillHarkonnen)
end end
CheckHarvester(harkonnen) CheckHarvester(Harkonnen)
CheckHarvester(smuggler) CheckHarvester(Smuggler)
AttackNotifier = AttackNotifier - 1 AttackNotifier = AttackNotifier - 1
end end
WorldLoaded = function() WorldLoaded = function()
harkonnen = Player.GetPlayer("Harkonnen") Harkonnen = Player.GetPlayer("Harkonnen")
smuggler = Player.GetPlayer("Smugglers") Smuggler = Player.GetPlayer("Smugglers")
player = Player.GetPlayer("Ordos") Ordos = Player.GetPlayer("Ordos")
InitObjectives(player) InitObjectives(Ordos)
KillOrdosH = AddPrimaryObjective(harkonnen, "") KillOrdosH = AddPrimaryObjective(Harkonnen, "")
KillOrdosS = AddSecondaryObjective(smuggler, "") KillOrdosS = AddSecondaryObjective(Smuggler, "")
DefendOutpost = AddPrimaryObjective(smuggler, "outpost-not-captured-destroyed") DefendOutpost = AddPrimaryObjective(Smuggler, "outpost-not-captured-destroyed")
CaptureOutpost = AddPrimaryObjective(player, "capture-smuggler-outpost") CaptureOutpost = AddPrimaryObjective(Ordos, "capture-smuggler-outpost")
KillHarkonnen = AddSecondaryObjective(player, "destroy-harkonnen") KillHarkonnen = AddSecondaryObjective(Ordos, "destroy-harkonnen")
SOutpost.GrantCondition("modified") SOutpost.GrantCondition("modified")
Camera.Position = OConyard.CenterPosition Camera.Position = OConyard.CenterPosition
HarkonnenAttackLocation = OConyard.Location HarkonnenAttackLocation = OConyard.Location
Hunt(harkonnen) Hunt(Harkonnen)
Hunt(smuggler) Hunt(Smuggler)
SendHarkonnen(LightInfantryRushersPaths[1]) SendHarkonnen(LightInfantryRushersPaths[1])
SendHarkonnen(LightInfantryRushersPaths[2]) SendHarkonnen(LightInfantryRushersPaths[2])
SendHarkonnen(LightInfantryRushersPaths[3]) SendHarkonnen(LightInfantryRushersPaths[3])
Actor.Create("upgrade.barracks", true, { Owner = harkonnen }) Actor.Create("upgrade.barracks", true, { Owner = Harkonnen })
Actor.Create("upgrade.light", true, { Owner = harkonnen }) Actor.Create("upgrade.light", true, { Owner = Harkonnen })
Actor.Create("upgrade.barracks", true, { Owner = smuggler }) Actor.Create("upgrade.barracks", true, { Owner = Smuggler })
Actor.Create("upgrade.light", true, { Owner = smuggler }) Actor.Create("upgrade.light", true, { Owner = Smuggler })
Trigger.AfterDelay(0, ActivateAI) Trigger.AfterDelay(0, ActivateAI)
Trigger.OnKilled(SOutpost, function() Trigger.OnKilled(SOutpost, function()
player.MarkFailedObjective(CaptureOutpost) Ordos.MarkFailedObjective(CaptureOutpost)
end) end)
Trigger.OnCapture(SOutpost, function() Trigger.OnCapture(SOutpost, function()
Trigger.AfterDelay(DateTime.Seconds(2), function() Trigger.AfterDelay(DateTime.Seconds(2), function()
player.MarkCompletedObjective(CaptureOutpost) Ordos.MarkCompletedObjective(CaptureOutpost)
smuggler.MarkFailedObjective(DefendOutpost) Smuggler.MarkFailedObjective(DefendOutpost)
end) end)
end) end)
Trigger.OnDamaged(SOutpost, function() Trigger.OnDamaged(SOutpost, function()
if SOutpost.Owner ~= smuggler then if SOutpost.Owner ~= Smuggler then
return return
end end
@@ -151,8 +151,8 @@ WorldLoaded = function()
end) end)
Trigger.AfterDelay(HarkonnenAttackDelay[Difficulty] - DateTime.Seconds(5), function() Trigger.AfterDelay(HarkonnenAttackDelay[Difficulty] - DateTime.Seconds(5), function()
Media.PlaySpeechNotification(player, "Reinforce") Media.PlaySpeechNotification(Ordos, "Reinforce")
Reinforcements.Reinforce(player, OrdosReinforcements, OrdosPath) Reinforcements.Reinforce(Ordos, OrdosReinforcements, OrdosPath)
end) end)
Trigger.AfterDelay(HarkonnenAttackDelay[Difficulty], function() Trigger.AfterDelay(HarkonnenAttackDelay[Difficulty], function()

View File

@@ -27,7 +27,7 @@ EnemyTankType = { "combat_tank_a" }
InitAIUnits = function(house) InitAIUnits = function(house)
LastHarvesterEaten[house] = true LastHarvesterEaten[house] = true
if house ~= atreides_small_3 then if house ~= AtreidesSmall3 then
IdlingUnits[house] = Reinforcements.Reinforce(house, InitialReinforcements[house.InternalName], InitialReinforcementsPaths[house.InternalName]) IdlingUnits[house] = Reinforcements.Reinforce(house, InitialReinforcements[house.InternalName], InitialReinforcementsPaths[house.InternalName])
else else
IdlingUnits[house] = { } IdlingUnits[house] = { }
@@ -43,20 +43,20 @@ ActivateAIProduction = function()
local tanksToBuild = function() return EnemyTankType end local tanksToBuild = function() return EnemyTankType end
local attackTresholdSize = AttackGroupSize[Difficulty] * 2.5 local attackTresholdSize = AttackGroupSize[Difficulty] * 2.5
ProduceUnits(atreides_main, ABarracks1, delay, infantryToBuild, AttackGroupSize[Difficulty], attackTresholdSize) ProduceUnits(AtreidesMain, ABarracks1, delay, infantryToBuild, AttackGroupSize[Difficulty], attackTresholdSize)
ProduceUnits(atreides_main, ALightFactory, delay, vehiclesToBuild, AttackGroupSize[Difficulty], attackTresholdSize) ProduceUnits(AtreidesMain, ALightFactory, delay, vehiclesToBuild, AttackGroupSize[Difficulty], attackTresholdSize)
ProduceUnits(atreides_main, AHeavyFactory, delay, tanksToBuild, AttackGroupSize[Difficulty], attackTresholdSize) ProduceUnits(AtreidesMain, AHeavyFactory, delay, tanksToBuild, AttackGroupSize[Difficulty], attackTresholdSize)
ProduceUnits(atreides_small_1, ABarracks2, delay, infantryToBuild, AttackGroupSize[Difficulty], attackTresholdSize) ProduceUnits(AtreidesSmall1, ABarracks2, delay, infantryToBuild, AttackGroupSize[Difficulty], attackTresholdSize)
ProduceUnits(atreides_small_2, ABarracks3, delay, infantryToBuild, AttackGroupSize[Difficulty], attackTresholdSize) ProduceUnits(AtreidesSmall2, ABarracks3, delay, infantryToBuild, AttackGroupSize[Difficulty], attackTresholdSize)
AIProductionActivated = true AIProductionActivated = true
end end
ActivateAI = function() ActivateAI = function()
InitAIUnits(atreides_main) InitAIUnits(AtreidesMain)
InitAIUnits(atreides_small_1) InitAIUnits(AtreidesSmall1)
InitAIUnits(atreides_small_2) InitAIUnits(AtreidesSmall2)
InitAIUnits(atreides_small_3) InitAIUnits(AtreidesSmall3)
end end

View File

@@ -110,57 +110,57 @@ end
CachedResources = -1 CachedResources = -1
Tick = function() Tick = function()
if player.Resources > SpiceToHarvest - 1 then if Ordos.Resources > SpiceToHarvest - 1 then
player.MarkCompletedObjective(GatherSpice) Ordos.MarkCompletedObjective(GatherSpice)
end end
if player.HasNoRequiredUnits() then if Ordos.HasNoRequiredUnits() then
atreides_main.MarkCompletedObjective(KillOrdos1) AtreidesMain.MarkCompletedObjective(KillOrdos1)
atreides_small_1.MarkCompletedObjective(KillOrdos2) AtreidesSmall1.MarkCompletedObjective(KillOrdos2)
atreides_small_2.MarkCompletedObjective(KillOrdos3) AtreidesSmall2.MarkCompletedObjective(KillOrdos3)
atreides_small_3.MarkCompletedObjective(KillOrdos4) AtreidesSmall3.MarkCompletedObjective(KillOrdos4)
end end
if atreides_main.HasNoRequiredUnits() and atreides_small_1.HasNoRequiredUnits() and atreides_small_2.HasNoRequiredUnits() and atreides_small_3.HasNoRequiredUnits() and not player.IsObjectiveCompleted(KillAtreides) then if AtreidesMain.HasNoRequiredUnits() and AtreidesSmall1.HasNoRequiredUnits() and AtreidesSmall2.HasNoRequiredUnits() and AtreidesSmall3.HasNoRequiredUnits() and not Ordos.IsObjectiveCompleted(KillAtreides) then
Media.DisplayMessage(UserInterface.Translate("atreides-annihilated"), Mentat) Media.DisplayMessage(UserInterface.Translate("atreides-annihilated"), Mentat)
player.MarkCompletedObjective(KillAtreides) Ordos.MarkCompletedObjective(KillAtreides)
end end
if #player.GetActorsByType("engineer") == 0 and not player.IsObjectiveCompleted(CaptureStarport) then if #Ordos.GetActorsByType("engineer") == 0 and not Ordos.IsObjectiveCompleted(CaptureStarport) then
player.MarkFailedObjective(CaptureStarport) Ordos.MarkFailedObjective(CaptureStarport)
end end
if player.IsObjectiveCompleted(CaptureStarport) then if Ordos.IsObjectiveCompleted(CaptureStarport) then
if player.Resources ~= CachedResources then if Ordos.Resources ~= CachedResources then
local parameters = { ["harvested"] = player.Resources, ["goal"] = SpiceToHarvest } local parameters = { ["harvested"] = Ordos.Resources, ["goal"] = SpiceToHarvest }
local harvestedResources = UserInterface.Translate("harvested-resources", parameters) local harvestedResources = UserInterface.Translate("harvested-resources", parameters)
UserInterface.SetMissionText(harvestedResources) UserInterface.SetMissionText(harvestedResources)
CachedResources = player.Resources CachedResources = Ordos.Resources
end end
end end
CheckHarvester(atreides_main) CheckHarvester(AtreidesMain)
CheckHarvester(atreides_small_1) CheckHarvester(AtreidesSmall1)
end end
WorldLoaded = function() WorldLoaded = function()
atreides_main = Player.GetPlayer("AtreidesMainBase") AtreidesMain = Player.GetPlayer("AtreidesMainBase")
atreides_small_1 = Player.GetPlayer("AtreidesSmallBase1") AtreidesSmall1 = Player.GetPlayer("AtreidesSmallBase1")
atreides_small_2 = Player.GetPlayer("AtreidesSmallBase2") AtreidesSmall2 = Player.GetPlayer("AtreidesSmallBase2")
atreides_small_3 = Player.GetPlayer("AtreidesSmallBase3") AtreidesSmall3 = Player.GetPlayer("AtreidesSmallBase3")
player = Player.GetPlayer("Ordos") Ordos = Player.GetPlayer("Ordos")
SpiceToHarvest = ToHarvest[Difficulty] SpiceToHarvest = ToHarvest[Difficulty]
InitObjectives(player) InitObjectives(Ordos)
KillOrdos1 = AddPrimaryObjective(atreides_main, "") KillOrdos1 = AddPrimaryObjective(AtreidesMain, "")
KillOrdos2 = AddPrimaryObjective(atreides_small_1, "") KillOrdos2 = AddPrimaryObjective(AtreidesSmall1, "")
KillOrdos3 = AddPrimaryObjective(atreides_small_2, "") KillOrdos3 = AddPrimaryObjective(AtreidesSmall2, "")
KillOrdos4 = AddPrimaryObjective(atreides_small_3, "") KillOrdos4 = AddPrimaryObjective(AtreidesSmall3, "")
CaptureStarport = AddPrimaryObjective(player, "capture-atreides-starport-establish-base") CaptureStarport = AddPrimaryObjective(Ordos, "capture-atreides-starport-establish-base")
local harvestSpice = UserInterface.Translate("harvest-spice", { ["spice"] = SpiceToHarvest }) local harvestSpice = UserInterface.Translate("harvest-spice", { ["spice"] = SpiceToHarvest })
GatherSpice = AddPrimaryObjective(player, harvestSpice) GatherSpice = AddPrimaryObjective(Ordos, harvestSpice)
KillAtreides = AddSecondaryObjective(player, "destroy-atreides") KillAtreides = AddSecondaryObjective(Ordos, "destroy-atreides")
Camera.Position = OEngi1.CenterPosition Camera.Position = OEngi1.CenterPosition
AtreidesAttackLocation = OEngi1.Location AtreidesAttackLocation = OEngi1.Location
@@ -173,45 +173,45 @@ WorldLoaded = function()
OCombat2.Destroy() OCombat2.Destroy()
end end
Hunt(atreides_main) Hunt(AtreidesMain)
Hunt(atreides_small_1) Hunt(AtreidesSmall1)
Hunt(atreides_small_2) Hunt(AtreidesSmall2)
Hunt(atreides_small_3) Hunt(AtreidesSmall3)
local path = function() return Utils.Random(AtreidesPaths) end local path = function() return Utils.Random(AtreidesPaths) end
local waveCondition = function() return player.IsObjectiveCompleted(KillAtreides) end local waveCondition = function() return Ordos.IsObjectiveCompleted(KillAtreides) end
local huntFunction = function(unit) local huntFunction = function(unit)
unit.AttackMove(AtreidesAttackLocation) unit.AttackMove(AtreidesAttackLocation)
IdleHunt(unit) IdleHunt(unit)
end end
SendCarryallReinforcements(atreides_main, 0, 8, AtreidesAttackDelay[Difficulty], path, AtreidesReinforcements[Difficulty], waveCondition, huntFunction) SendCarryallReinforcements(AtreidesMain, 0, 8, AtreidesAttackDelay[Difficulty], path, AtreidesReinforcements[Difficulty], waveCondition, huntFunction)
Actor.Create("upgrade.barracks", true, { Owner = atreides_main }) Actor.Create("upgrade.barracks", true, { Owner = AtreidesMain })
Actor.Create("upgrade.light", true, { Owner = atreides_main }) Actor.Create("upgrade.light", true, { Owner = AtreidesMain })
Actor.Create("upgrade.heavy", true, { Owner = atreides_main }) Actor.Create("upgrade.heavy", true, { Owner = AtreidesMain })
Actor.Create("upgrade.barracks", true, { Owner = atreides_small_1 }) Actor.Create("upgrade.barracks", true, { Owner = AtreidesSmall1 })
Actor.Create("upgrade.barracks", true, { Owner = atreides_small_2 }) Actor.Create("upgrade.barracks", true, { Owner = AtreidesSmall2 })
Trigger.AfterDelay(0, ActivateAI) Trigger.AfterDelay(0, ActivateAI)
Trigger.OnKilled(AStarport, function() Trigger.OnKilled(AStarport, function()
if not player.IsObjectiveCompleted(CaptureStarport) then if not Ordos.IsObjectiveCompleted(CaptureStarport) then
player.MarkFailedObjective(CaptureStarport) Ordos.MarkFailedObjective(CaptureStarport)
end end
end) end)
Trigger.OnCapture(AStarport, function() Trigger.OnCapture(AStarport, function()
player.MarkCompletedObjective(CaptureStarport) Ordos.MarkCompletedObjective(CaptureStarport)
if not AIProductionActivated then if not AIProductionActivated then
ActivateAIProduction() ActivateAIProduction()
end end
Reinforcements.ReinforceWithTransport(player, "frigate", { "mcv" }, { OrdosStarportEntry.Location, AStarport.Location + CVec.New(1, 1) }, { OrdosStarportExit.Location }) Reinforcements.ReinforceWithTransport(Ordos, "frigate", { "mcv" }, { OrdosStarportEntry.Location, AStarport.Location + CVec.New(1, 1) }, { OrdosStarportExit.Location })
if APower8.Owner ~= player and not APower8.IsDead then if APower8.Owner ~= Ordos and not APower8.IsDead then
APower8.Sell() APower8.Sell()
end end
if APower9.Owner ~= player and not APower9.IsDead then if APower9.Owner ~= Ordos and not APower9.IsDead then
APower9.Sell() APower9.Sell()
end end
end) end)

View File

@@ -35,8 +35,8 @@ InitAIUnits = function(house)
end end
ActivateAI = function() ActivateAI = function()
InitAIUnits(atreides) InitAIUnits(Atreides)
InitAIUnits(harkonnen) InitAIUnits(Harkonnen)
local delay = function() return Utils.RandomInteger(ProductionDelays[Difficulty][1], ProductionDelays[Difficulty][2] + 1) end local delay = function() return Utils.RandomInteger(ProductionDelays[Difficulty][1], ProductionDelays[Difficulty][2] + 1) end
local infantryToBuild = function() return { Utils.Random(EnemyInfantryTypes) } end local infantryToBuild = function() return { Utils.Random(EnemyInfantryTypes) } end
@@ -45,10 +45,10 @@ ActivateAI = function()
local tanksToBuildHarkonnen = function() return { Utils.Random(HarkonnenTankTypes) } end local tanksToBuildHarkonnen = function() return { Utils.Random(HarkonnenTankTypes) } end
local attackTresholdSize = AttackGroupSize[Difficulty] * 2.5 local attackTresholdSize = AttackGroupSize[Difficulty] * 2.5
ProduceUnits(atreides, ABarracks, delay, infantryToBuild, AttackGroupSize[Difficulty], attackTresholdSize) ProduceUnits(Atreides, ABarracks, delay, infantryToBuild, AttackGroupSize[Difficulty], attackTresholdSize)
ProduceUnits(atreides, ALightFactory, delay, vehiclesToBuild, AttackGroupSize[Difficulty], attackTresholdSize) ProduceUnits(Atreides, ALightFactory, delay, vehiclesToBuild, AttackGroupSize[Difficulty], attackTresholdSize)
ProduceUnits(atreides, AHeavyFactory, delay, tanksToBuildAtreides, AttackGroupSize[Difficulty], attackTresholdSize) ProduceUnits(Atreides, AHeavyFactory, delay, tanksToBuildAtreides, AttackGroupSize[Difficulty], attackTresholdSize)
ProduceUnits(harkonnen, HBarracks, delay, infantryToBuild, AttackGroupSize[Difficulty], attackTresholdSize) ProduceUnits(Harkonnen, HBarracks, delay, infantryToBuild, AttackGroupSize[Difficulty], attackTresholdSize)
ProduceUnits(harkonnen, HHeavyFactory, delay, tanksToBuildHarkonnen, AttackGroupSize[Difficulty], attackTresholdSize) ProduceUnits(Harkonnen, HHeavyFactory, delay, tanksToBuildHarkonnen, AttackGroupSize[Difficulty], attackTresholdSize)
end end

View File

@@ -143,10 +143,10 @@ ContrabandTimes =
IxianReinforcementsHaveArrived = UserInterface.Translate("ixian-reinforcements-arrived") IxianReinforcementsHaveArrived = UserInterface.Translate("ixian-reinforcements-arrived")
SendContraband = function() SendContraband = function()
Media.PlaySpeechNotification(player, "Reinforce") Media.PlaySpeechNotification(Ordos, "Reinforce")
for i = 0, 6 do for i = 0, 6 do
local c = player.Color local c = Ordos.Color
if i % 2 == 0 then if i % 2 == 0 then
c = HSLColor.White c = HSLColor.White
end end
@@ -159,7 +159,7 @@ SendContraband = function()
local entryPath = { CPos.New(82, OStarport.Location.Y + 1), OStarport.Location + CVec.New(1, 1) } local entryPath = { CPos.New(82, OStarport.Location.Y + 1), OStarport.Location + CVec.New(1, 1) }
local exitPath = { CPos.New(2, OStarport.Location.Y + 1) } local exitPath = { CPos.New(2, OStarport.Location.Y + 1) }
Reinforcements.ReinforceWithTransport(player, "frigate", IxianReinforcements[Difficulty], entryPath, exitPath) Reinforcements.ReinforceWithTransport(Ordos, "frigate", IxianReinforcements[Difficulty], entryPath, exitPath)
end end
Hunt = function(house) Hunt = function(house)
@@ -180,23 +180,23 @@ CheckHarvester = function(house)
end end
Tick = function() Tick = function()
if not player.IsObjectiveCompleted(KillAtreides) and atreides.HasNoRequiredUnits() then if not Ordos.IsObjectiveCompleted(KillAtreides) and Atreides.HasNoRequiredUnits() then
Media.DisplayMessage(UserInterface.Translate("atreides-annihilated"), Mentat) Media.DisplayMessage(UserInterface.Translate("atreides-annihilated"), Mentat)
player.MarkCompletedObjective(KillAtreides) Ordos.MarkCompletedObjective(KillAtreides)
DestroyCarryalls(atreides) DestroyCarryalls(Atreides)
if player.IsObjectiveCompleted(KillHarkonnen) then if Ordos.IsObjectiveCompleted(KillHarkonnen) then
player.MarkCompletedObjective(GuardStarport) Ordos.MarkCompletedObjective(GuardStarport)
end end
end end
if not player.IsObjectiveCompleted(KillHarkonnen) and harkonnen.HasNoRequiredUnits() then if not Ordos.IsObjectiveCompleted(KillHarkonnen) and Harkonnen.HasNoRequiredUnits() then
Media.DisplayMessage(UserInterface.Translate("harkonnen-annihilated"), Mentat) Media.DisplayMessage(UserInterface.Translate("harkonnen-annihilated"), Mentat)
player.MarkCompletedObjective(KillHarkonnen) Ordos.MarkCompletedObjective(KillHarkonnen)
DestroyCarryalls(harkonnen) DestroyCarryalls(Harkonnen)
if player.IsObjectiveCompleted(KillAtreides) then if Ordos.IsObjectiveCompleted(KillAtreides) then
player.MarkCompletedObjective(GuardStarport) Ordos.MarkCompletedObjective(GuardStarport)
end end
end end
@@ -217,29 +217,29 @@ Tick = function()
reinforcementsText = UserInterface.Translate("additional-reinforcements-arrive-in", time) reinforcementsText = UserInterface.Translate("additional-reinforcements-arrive-in", time)
end end
UserInterface.SetMissionText(reinforcementsText, player.Color) UserInterface.SetMissionText(reinforcementsText, Ordos.Color)
end end
end end
CheckHarvester(atreides) CheckHarvester(Atreides)
CheckHarvester(harkonnen) CheckHarvester(Harkonnen)
end end
WorldLoaded = function() WorldLoaded = function()
atreides = Player.GetPlayer("Atreides") Atreides = Player.GetPlayer("Atreides")
harkonnen = Player.GetPlayer("Harkonnen") Harkonnen = Player.GetPlayer("Harkonnen")
player = Player.GetPlayer("Ordos") Ordos = Player.GetPlayer("Ordos")
InitObjectives(player) InitObjectives(Ordos)
GuardStarport = AddPrimaryObjective(player, "defend-starport") GuardStarport = AddPrimaryObjective(Ordos, "defend-starport")
KillAtreides = AddPrimaryObjective(player, "destroy-atreides") KillAtreides = AddPrimaryObjective(Ordos, "destroy-atreides")
KillHarkonnen = AddPrimaryObjective(player, "destroy-harkonnen") KillHarkonnen = AddPrimaryObjective(Ordos, "destroy-harkonnen")
Camera.Position = OConyard.CenterPosition Camera.Position = OConyard.CenterPosition
EnemyAttackLocations = { OConyard.Location, OStarport.Location } EnemyAttackLocations = { OConyard.Location, OStarport.Location }
Trigger.OnRemovedFromWorld(OStarport, function() Trigger.OnRemovedFromWorld(OStarport, function()
player.MarkFailedObjective(GuardStarport) Ordos.MarkFailedObjective(GuardStarport)
end) end)
Trigger.AfterDelay(DateTime.Seconds(2), function() Trigger.AfterDelay(DateTime.Seconds(2), function()
@@ -248,13 +248,13 @@ WorldLoaded = function()
Media.DisplayMessage(UserInterface.Translate("ixian-reinforcements-in", time), Mentat) Media.DisplayMessage(UserInterface.Translate("ixian-reinforcements-in", time), Mentat)
end) end)
Hunt(atreides) Hunt(Atreides)
Hunt(harkonnen) Hunt(Harkonnen)
local atreidesPath = function() return Utils.Random(AtreidesPaths) end local atreidesPath = function() return Utils.Random(AtreidesPaths) end
local harkonnenPath = function() return Utils.Random(HarkonnenPaths) end local harkonnenPath = function() return Utils.Random(HarkonnenPaths) end
local atreidesCondition = function() return player.IsObjectiveCompleted(KillAtreides) end local atreidesCondition = function() return Ordos.IsObjectiveCompleted(KillAtreides) end
local harkonnenCondition = function() return player.IsObjectiveCompleted(KillHarkonnen) end local harkonnenCondition = function() return Ordos.IsObjectiveCompleted(KillHarkonnen) end
local huntFunction = function(unit) local huntFunction = function(unit)
unit.AttackMove(Utils.Random(EnemyAttackLocations)) unit.AttackMove(Utils.Random(EnemyAttackLocations))
IdleHunt(unit) IdleHunt(unit)
@@ -263,16 +263,16 @@ WorldLoaded = function()
Media.DisplayMessage(UserInterface.Translate("enemy-reinforcements-arrived"), Mentat) Media.DisplayMessage(UserInterface.Translate("enemy-reinforcements-arrived"), Mentat)
end end
SendCarryallReinforcements(atreides, 0, AtreidesAttackWaves[Difficulty], EnemyAttackDelay[Difficulty], atreidesPath, AtreidesReinforcements[Difficulty], atreidesCondition, huntFunction, announcementFunction) SendCarryallReinforcements(Atreides, 0, AtreidesAttackWaves[Difficulty], EnemyAttackDelay[Difficulty], atreidesPath, AtreidesReinforcements[Difficulty], atreidesCondition, huntFunction, announcementFunction)
Trigger.AfterDelay(Utils.RandomInteger(DateTime.Seconds(45), DateTime.Minutes(1) + DateTime.Seconds(15)), function() Trigger.AfterDelay(Utils.RandomInteger(DateTime.Seconds(45), DateTime.Minutes(1) + DateTime.Seconds(15)), function()
SendCarryallReinforcements(harkonnen, 0, HarkonnenAttackWaves[Difficulty], EnemyAttackDelay[Difficulty], harkonnenPath, HarkonnenReinforcements[Difficulty], harkonnenCondition, huntFunction, announcementFunction) SendCarryallReinforcements(Harkonnen, 0, HarkonnenAttackWaves[Difficulty], EnemyAttackDelay[Difficulty], harkonnenPath, HarkonnenReinforcements[Difficulty], harkonnenCondition, huntFunction, announcementFunction)
end) end)
Actor.Create("upgrade.barracks", true, { Owner = atreides }) Actor.Create("upgrade.barracks", true, { Owner = Atreides })
Actor.Create("upgrade.light", true, { Owner = atreides }) Actor.Create("upgrade.light", true, { Owner = Atreides })
Actor.Create("upgrade.heavy", true, { Owner = atreides }) Actor.Create("upgrade.heavy", true, { Owner = Atreides })
Actor.Create("upgrade.barracks", true, { Owner = harkonnen }) Actor.Create("upgrade.barracks", true, { Owner = Harkonnen })
Actor.Create("upgrade.heavy", true, { Owner = harkonnen }) Actor.Create("upgrade.heavy", true, { Owner = Harkonnen })
Trigger.AfterDelay(0, ActivateAI) Trigger.AfterDelay(0, ActivateAI)
end end

View File

@@ -139,26 +139,26 @@ InitializeHarvester = function(harvester)
harvester.FindResources() harvester.FindResources()
end end
ticks = 0 Ticks = 0
speed = 5 Speed = 5
Tick = function() Tick = function()
ticks = ticks + 1 Ticks = Ticks + 1
if ticks > 1 or not Map.IsPausedShellmap then if Ticks > 1 or not Map.IsPausedShellmap then
local t = (ticks + 45) % (360 * speed) * (math.pi / 180) / speed; local t = (Ticks + 45) % (360 * Speed) * (math.pi / 180) / Speed;
Camera.Position = viewportOrigin + WVec.New(19200 * math.sin(t), 28800 * math.cos(t), 0) Camera.Position = ViewportOrigin + WVec.New(19200 * math.sin(t), 28800 * math.cos(t), 0)
end end
end end
WorldLoaded = function() WorldLoaded = function()
atreides = Player.GetPlayer("Atreides") Atreides = Player.GetPlayer("Atreides")
harkonnen = Player.GetPlayer("Harkonnen") Harkonnen = Player.GetPlayer("Harkonnen")
ordos = Player.GetPlayer("Ordos") Ordos = Player.GetPlayer("Ordos")
corrino = Player.GetPlayer("Corrino") Corrino = Player.GetPlayer("Corrino")
smugglers = Player.GetPlayer("Smugglers") Smugglers = Player.GetPlayer("Smugglers")
viewportOrigin = Camera.Position ViewportOrigin = Camera.Position
Utils.Do(Utils.Take(4, Upgrades), function(upgrade) Utils.Do(Utils.Take(4, Upgrades), function(upgrade)
atr_cyard.Produce(upgrade) atr_cyard.Produce(upgrade)
@@ -169,32 +169,32 @@ WorldLoaded = function()
atr_cyard.Produce(Upgrades[5]) atr_cyard.Produce(Upgrades[5])
Trigger.AfterDelay(DateTime.Seconds(45), function() Trigger.AfterDelay(DateTime.Seconds(45), function()
SendNewHarv(atreides, AtrCarryHarvWaypoints, 3) SendNewHarv(Atreides, AtrCarryHarvWaypoints, 3)
SendNewHarv(harkonnen, HarCarryHarvWaypoints, 3) SendNewHarv(Harkonnen, HarCarryHarvWaypoints, 3)
SendNewHarv(ordos, OrdCarryHarvWaypoints, 3) SendNewHarv(Ordos, OrdCarryHarvWaypoints, 3)
SendNewHarv(corrino, CorCarryHarvWaypoints, 3) SendNewHarv(Corrino, CorCarryHarvWaypoints, 3)
SendNewHarv(smugglers, SmgCarryHarvWaypoints, 1) SendNewHarv(Smugglers, SmgCarryHarvWaypoints, 1)
end) end)
Trigger.AfterDelay(DateTime.Seconds(1), function() Trigger.AfterDelay(DateTime.Seconds(1), function()
Produce(atreides, AtreidesInfantryTypes) Produce(Atreides, AtreidesInfantryTypes)
Produce(atreides, AtreidesVehicleTypes) Produce(Atreides, AtreidesVehicleTypes)
Produce(atreides, AtreidesTankTypes) Produce(Atreides, AtreidesTankTypes)
Produce(atreides, AtreidesStarportTypes) Produce(Atreides, AtreidesStarportTypes)
Produce(harkonnen, HarkonnenInfantryTypes) Produce(Harkonnen, HarkonnenInfantryTypes)
Produce(harkonnen, HarkonnenVehicleTypes) Produce(Harkonnen, HarkonnenVehicleTypes)
Produce(harkonnen, HarkonnenTankTypes) Produce(Harkonnen, HarkonnenTankTypes)
Produce(harkonnen, HarkonnenStarportTypes) Produce(Harkonnen, HarkonnenStarportTypes)
Produce(ordos, OrdosInfantryTypes) Produce(Ordos, OrdosInfantryTypes)
Produce(ordos, OrdosVehicleTypes) Produce(Ordos, OrdosVehicleTypes)
Produce(ordos, OrdosTankTypes) Produce(Ordos, OrdosTankTypes)
Produce(ordos, OrdosStarportTypes) Produce(Ordos, OrdosStarportTypes)
Produce(corrino, CorrinoInfantryTypes) Produce(Corrino, CorrinoInfantryTypes)
Produce(corrino, CorrinoVehicleTypes) Produce(Corrino, CorrinoVehicleTypes)
Produce(corrino, CorrinoTankTypes) Produce(Corrino, CorrinoTankTypes)
Produce(corrino, CorrinoStarportTypes) Produce(Corrino, CorrinoStarportTypes)
end) end)
end end

View File

@@ -80,7 +80,7 @@ LabGuardsKilled = function()
Media.PlaySoundNotification(Greece, "AlertBuzzer") Media.PlaySoundNotification(Greece, "AlertBuzzer")
end) end)
end end
Utils.Do(sovietArmy, function(a) Utils.Do(SovietArmy, function(a)
if not a.IsDead and a.HasProperty("Hunt") then if not a.IsDead and a.HasProperty("Hunt") then
Trigger.OnIdle(a, a.Hunt) Trigger.OnIdle(a, a.Hunt)
end end
@@ -89,18 +89,18 @@ LabGuardsKilled = function()
end end
SendExtractionHelicopter = function() SendExtractionHelicopter = function()
heli = Reinforcements.ReinforceWithTransport(Greece, ExtractionHelicopterType, nil, ExtractionPath)[1] Heli = Reinforcements.ReinforceWithTransport(Greece, ExtractionHelicopterType, nil, ExtractionPath)[1]
if not einstein.IsDead then if not Einstein.IsDead then
Trigger.OnRemovedFromWorld(einstein, EvacuateHelicopter) Trigger.OnRemovedFromWorld(Einstein, EvacuateHelicopter)
end end
Trigger.OnKilled(heli, RescueFailed) Trigger.OnKilled(Heli, RescueFailed)
Trigger.OnRemovedFromWorld(heli, HelicopterGone) Trigger.OnRemovedFromWorld(Heli, HelicopterGone)
end end
EvacuateHelicopter = function() EvacuateHelicopter = function()
if heli.HasPassengers then if Heli.HasPassengers then
heli.Move(ExtractionExitPoint.Location) Heli.Move(ExtractionExitPoint.Location)
heli.Destroy() Heli.Destroy()
end end
end end
@@ -114,7 +114,7 @@ SendCruisers = function()
end end
LabDestroyed = function() LabDestroyed = function()
if not einstein then if not Einstein then
RescueFailed() RescueFailed()
end end
end end
@@ -136,7 +136,7 @@ end
CiviliansKilled = function() CiviliansKilled = function()
Greece.MarkFailedObjective(CivilProtectionObjective) Greece.MarkFailedObjective(CivilProtectionObjective)
Media.PlaySpeechNotification(Greece, "ObjectiveNotMet") Media.PlaySpeechNotification(Greece, "ObjectiveNotMet")
collateralDamage = true CollateralDamage = true
end end
LostMate = function() LostMate = function()
@@ -148,15 +148,15 @@ end
CreateEinstein = function() CreateEinstein = function()
Greece.MarkCompletedObjective(FindEinsteinObjective) Greece.MarkCompletedObjective(FindEinsteinObjective)
Media.PlaySpeechNotification(Greece, "ObjectiveMet") Media.PlaySpeechNotification(Greece, "ObjectiveMet")
einstein = Actor.Create(EinsteinType, true, { Location = EinsteinSpawnPoint.Location, Owner = Greece }) Einstein = Actor.Create(EinsteinType, true, { Location = EinsteinSpawnPoint.Location, Owner = Greece })
einstein.Scatter() Einstein.Scatter()
Trigger.OnKilled(einstein, RescueFailed) Trigger.OnKilled(Einstein, RescueFailed)
ExtractObjective = AddPrimaryObjective(Greece, "extract-einstein-helicopter") ExtractObjective = AddPrimaryObjective(Greece, "extract-einstein-helicopter")
Trigger.AfterDelay(DateTime.Seconds(1), function() Media.PlaySpeechNotification(Greece, "TargetFreed") end) Trigger.AfterDelay(DateTime.Seconds(1), function() Media.PlaySpeechNotification(Greece, "TargetFreed") end)
end end
HelicopterGone = function() HelicopterGone = function()
if not heli.IsDead then if not Heli.IsDead then
Media.PlaySpeechNotification(Greece, "TargetRescued") Media.PlaySpeechNotification(Greece, "TargetRescued")
Trigger.AfterDelay(DateTime.Seconds(1), function() Trigger.AfterDelay(DateTime.Seconds(1), function()
Greece.MarkCompletedObjective(ExtractObjective) Greece.MarkCompletedObjective(ExtractObjective)
@@ -164,7 +164,7 @@ HelicopterGone = function()
if not Greece.IsObjectiveFailed(TanyaSurviveObjective) then if not Greece.IsObjectiveFailed(TanyaSurviveObjective) then
Greece.MarkCompletedObjective(TanyaSurviveObjective) Greece.MarkCompletedObjective(TanyaSurviveObjective)
end end
if not collateralDamage then if not CollateralDamage then
Greece.MarkCompletedObjective(CivilProtectionObjective) Greece.MarkCompletedObjective(CivilProtectionObjective)
end end
end) end)
@@ -200,12 +200,12 @@ WorldLoaded = function()
Trigger.OnKilled(Lab, LabDestroyed) Trigger.OnKilled(Lab, LabDestroyed)
Trigger.OnKilled(OilPump, OilPumpDestroyed) Trigger.OnKilled(OilPump, OilPumpDestroyed)
sovietArmy = USSR.GetGroundAttackers() SovietArmy = USSR.GetGroundAttackers()
Trigger.OnAllKilled(LabGuardsTeam, LabGuardsKilled) Trigger.OnAllKilled(LabGuardsTeam, LabGuardsKilled)
collateralDamage = false CollateralDamage = false
civilianTeam = { Civilian1, Civilian2 } local civilianTeam = { Civilian1, Civilian2 }
Trigger.OnAnyKilled(civilianTeam, CiviliansKilled) Trigger.OnAnyKilled(civilianTeam, CiviliansKilled)
Trigger.OnKilled(Civilian1, LostMate) Trigger.OnKilled(Civilian1, LostMate)

View File

@@ -50,8 +50,8 @@ else
end end
SendJeepReinforcements = function() SendJeepReinforcements = function()
Media.PlaySpeechNotification(player, "ReinforcementsArrived") Media.PlaySpeechNotification(Greece, "ReinforcementsArrived")
Reinforcements.Reinforce(player, JeepReinforcements, JeepPath, DateTime.Seconds(1)) Reinforcements.Reinforce(Greece, JeepReinforcements, JeepPath, DateTime.Seconds(1))
end end
RunInitialActivities = function() RunInitialActivities = function()
@@ -59,12 +59,12 @@ RunInitialActivities = function()
Trigger.OnKilled(Harvester, function() HarvesterKilled = true end) Trigger.OnKilled(Harvester, function() HarvesterKilled = true end)
Trigger.OnAllKilled(PathGuards, function() Trigger.OnAllKilled(PathGuards, function()
player.MarkCompletedObjective(SecureObjective) Greece.MarkCompletedObjective(SecureObjective)
SendTrucks() SendTrucks()
end) end)
Trigger.OnAllKilled(SovietBase, function() Trigger.OnAllKilled(SovietBase, function()
Utils.Do(ussr.GetGroundAttackers(), function(unit) Utils.Do(USSR.GetGroundAttackers(), function(unit)
if not Utils.Any(PathGuards, function(pg) return pg == unit end) then if not Utils.Any(PathGuards, function(pg) return pg == unit end) then
Trigger.OnIdle(unit, unit.Hunt) Trigger.OnIdle(unit, unit.Hunt)
end end
@@ -72,15 +72,15 @@ RunInitialActivities = function()
end) end)
if InfantryTypes then if InfantryTypes then
Trigger.AfterDelay(InfantryDelay, InfantryProduction) Trigger.AfterDelay(InfantryDelay, ProduceInfantry)
end end
if VehicleTypes then if VehicleTypes then
Trigger.AfterDelay(VehicleDelay, VehicleProduction) Trigger.AfterDelay(VehicleDelay, ProduceVehicles)
end end
end end
InfantryProduction = function() ProduceInfantry = function()
if SovietBarracks.IsDead then if SovietBarracks.IsDead then
return return
end end
@@ -88,12 +88,12 @@ InfantryProduction = function()
local toBuild = { Utils.Random(InfantryTypes) } local toBuild = { Utils.Random(InfantryTypes) }
if SovietKennel.IsDead and toBuild == "dog" then if SovietKennel.IsDead and toBuild == "dog" then
toBuild = "e1" toBuild = { "e1" }
end end
ussr.Build(toBuild, function(unit) USSR.Build(toBuild, function(unit)
IdlingUnits[#IdlingUnits + 1] = unit[1] IdlingUnits[#IdlingUnits + 1] = unit[1]
Trigger.AfterDelay(InfantryDelay, InfantryProduction) Trigger.AfterDelay(InfantryDelay, ProduceInfantry)
if #IdlingUnits >= (AttackGroupSize * 1.5) then if #IdlingUnits >= (AttackGroupSize * 1.5) then
SendAttack() SendAttack()
@@ -101,26 +101,26 @@ InfantryProduction = function()
end) end)
end end
VehicleProduction = function() ProduceVehicles = function()
if SovietWarfactory.IsDead then if SovietWarfactory.IsDead then
return return
end end
if HarvesterKilled then if HarvesterKilled then
ussr.Build({ "harv" }, function(harv) USSR.Build({ "harv" }, function(harv)
harv[1].FindResources() harv[1].FindResources()
Trigger.OnKilled(harv[1], function() HarvesterKilled = true end) Trigger.OnKilled(harv[1], function() HarvesterKilled = true end)
HarvesterKilled = false HarvesterKilled = false
VehicleProduction() ProduceVehicles()
end) end)
return return
end end
local toBuild = { Utils.Random(VehicleTypes) } local toBuild = { Utils.Random(VehicleTypes) }
ussr.Build(toBuild, function(unit) USSR.Build(toBuild, function(unit)
IdlingUnits[#IdlingUnits + 1] = unit[1] IdlingUnits[#IdlingUnits + 1] = unit[1]
Trigger.AfterDelay(VehicleDelay, VehicleProduction) Trigger.AfterDelay(VehicleDelay, ProduceVehicles)
if #IdlingUnits >= (AttackGroupSize * 1.5) then if #IdlingUnits >= (AttackGroupSize * 1.5) then
SendAttack() SendAttack()
@@ -149,14 +149,14 @@ SendAttack = function()
end end
Tick = function() Tick = function()
ussr.Resources = ussr.Resources - (0.01 * ussr.ResourceCapacity / 25) USSR.Resources = USSR.Resources - (0.01 * USSR.ResourceCapacity / 25)
if ussr.HasNoRequiredUnits() then if USSR.HasNoRequiredUnits() then
player.MarkCompletedObjective(ConquestObjective) Greece.MarkCompletedObjective(ConquestObjective)
end end
if player.HasNoRequiredUnits() then if Greece.HasNoRequiredUnits() then
ussr.MarkCompletedObjective(ussrObj) USSR.MarkCompletedObjective(USSRobjective)
end end
end end
@@ -182,22 +182,22 @@ SendTrucks = function()
DateTime.TimeLimit = 0 DateTime.TimeLimit = 0
UserInterface.SetMissionText("") UserInterface.SetMissionText("")
ConvoyObjective = AddPrimaryObjective(player, "escort-convoy") ConvoyObjective = AddPrimaryObjective(Greece, "escort-convoy")
Media.PlaySpeechNotification(player, "ConvoyApproaching") Media.PlaySpeechNotification(Greece, "ConvoyApproaching")
Trigger.AfterDelay(DateTime.Seconds(3), function() Trigger.AfterDelay(DateTime.Seconds(3), function()
ConvoyUnharmed = true ConvoyUnharmed = true
local trucks = Reinforcements.Reinforce(england, TruckReinforcements, TruckPath, DateTime.Seconds(1), local trucks = Reinforcements.Reinforce(England, TruckReinforcements, TruckPath, DateTime.Seconds(1),
function(truck) function(truck)
Trigger.OnIdle(truck, function() truck.Move(TruckExitPoint.Location) end) Trigger.OnIdle(truck, function() truck.Move(TruckExitPoint.Location) end)
end) end)
count = 0 local count = 0
Trigger.OnEnteredFootprint( { TruckExitPoint.Location }, function(a, id) Trigger.OnEnteredFootprint( { TruckExitPoint.Location }, function(a, id)
if a.Owner == england then if a.Owner == England then
count = count + 1 count = count + 1
a.Destroy() a.Destroy()
if count == 3 then if count == 3 then
player.MarkCompletedObjective(ConvoyObjective) Greece.MarkCompletedObjective(ConvoyObjective)
Trigger.RemoveFootprintTrigger(id) Trigger.RemoveFootprintTrigger(id)
end end
end end
@@ -208,30 +208,30 @@ SendTrucks = function()
end end
ConvoyCasualites = function() ConvoyCasualites = function()
Media.PlaySpeechNotification(player, "ConvoyUnitLost") Media.PlaySpeechNotification(Greece, "ConvoyUnitLost")
if ConvoyUnharmed then if ConvoyUnharmed then
ConvoyUnharmed = false ConvoyUnharmed = false
Trigger.AfterDelay(DateTime.Seconds(1), function() player.MarkFailedObjective(ConvoyObjective) end) Trigger.AfterDelay(DateTime.Seconds(1), function() Greece.MarkFailedObjective(ConvoyObjective) end)
end end
end end
WorldLoaded = function() WorldLoaded = function()
player = Player.GetPlayer("Greece") Greece = Player.GetPlayer("Greece")
england = Player.GetPlayer("England") England = Player.GetPlayer("England")
ussr = Player.GetPlayer("USSR") USSR = Player.GetPlayer("USSR")
InitObjectives(player) InitObjectives(Greece)
ussrObj = AddPrimaryObjective(ussr, "") USSRobjective = AddPrimaryObjective(USSR, "")
SecureObjective = AddPrimaryObjective(player, "secure-convoy") SecureObjective = AddPrimaryObjective(Greece, "secure-convoy")
ConquestObjective = AddPrimaryObjective(player, "eliminate-soviets") ConquestObjective = AddPrimaryObjective(Greece, "eliminate-soviets")
Trigger.AfterDelay(DateTime.Seconds(1), function() Media.PlaySpeechNotification(allies, "MissionTimerInitialised") end) Trigger.AfterDelay(DateTime.Seconds(1), function() Media.PlaySpeechNotification(Allies, "MissionTimerInitialised") end)
RunInitialActivities() RunInitialActivities()
Reinforcements.Reinforce(player, ConstructionVehicleReinforcements, ConstructionVehiclePath) Reinforcements.Reinforce(Greece, ConstructionVehicleReinforcements, ConstructionVehiclePath)
Trigger.AfterDelay(DateTime.Seconds(5), SendJeepReinforcements) Trigger.AfterDelay(DateTime.Seconds(5), SendJeepReinforcements)
Trigger.AfterDelay(DateTime.Seconds(10), SendJeepReinforcements) Trigger.AfterDelay(DateTime.Seconds(10), SendJeepReinforcements)
@@ -241,5 +241,5 @@ WorldLoaded = function()
end) end)
Camera.Position = ReinforcementsEntryPoint.CenterPosition Camera.Position = ReinforcementsEntryPoint.CenterPosition
TimerColor = player.Color TimerColor = Greece.Color
end end

View File

@@ -24,7 +24,7 @@ else
end end
ProduceUnits = function(factory, count) ProduceUnits = function(factory, count)
if ussr.IsProducing("e1") then if USSR.IsProducing("e1") then
Trigger.AfterDelay(DateTime.Seconds(5), function() ProduceUnits(factory, count) end) Trigger.AfterDelay(DateTime.Seconds(5), function() ProduceUnits(factory, count) end)
return return
end end
@@ -37,7 +37,7 @@ ProduceUnits = function(factory, count)
if not factory.IsDead then if not factory.IsDead then
factory.IsPrimaryBuilding = true factory.IsPrimaryBuilding = true
ussr.Build(units, function(soldiers) USSR.Build(units, function(soldiers)
Utils.Do(soldiers, function(unit) IdleHunt(unit) end) Utils.Do(soldiers, function(unit) IdleHunt(unit) end)
end) end)
end end
@@ -46,8 +46,8 @@ end
SendAlliedUnits = function() SendAlliedUnits = function()
Camera.Position = TanyaWaypoint.CenterPosition Camera.Position = TanyaWaypoint.CenterPosition
local Artillery = Actor.Create("arty", true, { Owner = player, Location = AlliedUnitsEntry.Location }) local Artillery = Actor.Create("arty", true, { Owner = Greece, Location = AlliedUnitsEntry.Location })
local Tanya = Actor.Create(TanyaType, true, { Owner = player, Location = AlliedUnitsEntry.Location }) local Tanya = Actor.Create(TanyaType, true, { Owner = Greece, Location = AlliedUnitsEntry.Location })
if TanyaType == "e7.noautotarget" then if TanyaType == "e7.noautotarget" then
Trigger.AfterDelay(DateTime.Seconds(2), function() Trigger.AfterDelay(DateTime.Seconds(2), function()
@@ -59,11 +59,11 @@ SendAlliedUnits = function()
Tanya.Move(TanyaWaypoint.Location) Tanya.Move(TanyaWaypoint.Location)
Artillery.Move(ArtilleryWaypoint.Location) Artillery.Move(ArtilleryWaypoint.Location)
Trigger.OnKilled(Tanya, function() player.MarkFailedObjective(TanyaSurvive) end) Trigger.OnKilled(Tanya, function() Greece.MarkFailedObjective(TanyaSurvive) end)
end end
SendUSSRParadrops = function() SendUSSRParadrops = function()
local powerproxy = Actor.Create("powerproxy.paratroopers", false, { Owner = ussr }) local powerproxy = Actor.Create("powerproxy.paratroopers", false, { Owner = USSR })
local aircraftA = powerproxy.TargetParatroopers(ParadropLZ.CenterPosition, Angle.SouthEast) local aircraftA = powerproxy.TargetParatroopers(ParadropLZ.CenterPosition, Angle.SouthEast)
Utils.Do(aircraftA, function(a) Utils.Do(aircraftA, function(a)
@@ -83,13 +83,13 @@ SendUSSRParadrops = function()
end end
SendUSSRWaterTransport = function() SendUSSRWaterTransport = function()
local units = Reinforcements.ReinforceWithTransport(ussr, "lst", TransportReinforcements, { WaterTransportEntry.Location, WaterTransportLoadout.Location }, { WaterTransportExit.Location })[2] local units = Reinforcements.ReinforceWithTransport(USSR, "lst", TransportReinforcements, { WaterTransportEntry.Location, WaterTransportLoadout.Location }, { WaterTransportExit.Location })[2]
Utils.Do(units, function(unit) IdleHunt(unit) end) Utils.Do(units, function(unit) IdleHunt(unit) end)
end end
SendUSSRTankReinforcements = function() SendUSSRTankReinforcements = function()
local camera = Actor.Create("camera", true, { Owner = player, Location = USSRReinforcementsCameraWaypoint.Location }) local camera = Actor.Create("camera", true, { Owner = Greece, Location = USSRReinforcementsCameraWaypoint.Location })
local ussrTank = Reinforcements.Reinforce(ussr, { "3tnk" }, { USSRReinforcementsEntryWaypoint.Location, USSRReinforcementsRallyWaypoint1.Location, USSRReinforcementsRallyWaypoint2.Location })[1] local ussrTank = Reinforcements.Reinforce(USSR, { "3tnk" }, { USSRReinforcementsEntryWaypoint.Location, USSRReinforcementsRallyWaypoint1.Location, USSRReinforcementsRallyWaypoint2.Location })[1]
Trigger.OnRemovedFromWorld(ussrTank, function() Trigger.OnRemovedFromWorld(ussrTank, function()
Trigger.AfterDelay(DateTime.Seconds(3), function() Trigger.AfterDelay(DateTime.Seconds(3), function()
if not camera.IsDead then if not camera.IsDead then
@@ -100,28 +100,28 @@ SendUSSRTankReinforcements = function()
end end
InitPlayers = function() InitPlayers = function()
player = Player.GetPlayer("Greece") Greece = Player.GetPlayer("Greece")
ussr = Player.GetPlayer("USSR") USSR = Player.GetPlayer("USSR")
ussr.Cash = 10000 USSR.Cash = 10000
end end
AddObjectives = function() AddObjectives = function()
KillBridges = AddPrimaryObjective(player, "destroy-bridges") KillBridges = AddPrimaryObjective(Greece, "destroy-bridges")
TanyaSurvive = AddPrimaryObjective(player, "tanya-survive") TanyaSurvive = AddPrimaryObjective(Greece, "tanya-survive")
KillUSSR = AddSecondaryObjective(player, "destroy-oilpumps") KillUSSR = AddSecondaryObjective(Greece, "destroy-oilpumps")
FreePrisoners = AddSecondaryObjective(player, "free-prisoners") FreePrisoners = AddSecondaryObjective(Greece, "free-prisoners")
end end
InitTriggers = function() InitTriggers = function()
Utils.Do(ussr.GetGroundAttackers(), function(unit) Utils.Do(USSR.GetGroundAttackers(), function(unit)
Trigger.OnDamaged(unit, function() IdleHunt(unit) end) Trigger.OnDamaged(unit, function() IdleHunt(unit) end)
end) end)
Trigger.OnAnyKilled(Prisoners, function() player.MarkFailedObjective(FreePrisoners) end) Trigger.OnAnyKilled(Prisoners, function() Greece.MarkFailedObjective(FreePrisoners) end)
Trigger.OnKilled(USSRTechCenter, function() Trigger.OnKilled(USSRTechCenter, function()
Actor.Create("moneycrate", true, { Owner = ussr, Location = USSRMoneyCrateSpawn.Location }) Actor.Create("moneycrate", true, { Owner = USSR, Location = USSRMoneyCrateSpawn.Location })
end) end)
Trigger.OnKilled(ExplosiveBarrel, function() Trigger.OnKilled(ExplosiveBarrel, function()
@@ -135,9 +135,9 @@ InitTriggers = function()
end) end)
local baseTrigger = Trigger.OnEnteredFootprint(CameraTriggerArea, function(a, id) local baseTrigger = Trigger.OnEnteredFootprint(CameraTriggerArea, function(a, id)
if a.Owner == player and not baseCamera then if a.Owner == Greece and not BaseCamera then
Trigger.RemoveFootprintTrigger(id) Trigger.RemoveFootprintTrigger(id)
baseCamera = Actor.Create("camera", true, { Owner = player, Location = BaseCameraWaypoint.Location }) BaseCamera = Actor.Create("camera", true, { Owner = Greece, Location = BaseCameraWaypoint.Location })
end end
end) end)
@@ -145,8 +145,8 @@ InitTriggers = function()
Trigger.OnDamaged(unit, function() Trigger.OnDamaged(unit, function()
if not FirstBaseAlert then if not FirstBaseAlert then
FirstBaseAlert = true FirstBaseAlert = true
if not baseCamera then if not BaseCamera then
baseCamera = Actor.Create("camera", true, { Owner = player, Location = BaseCameraWaypoint.Location }) BaseCamera = Actor.Create("camera", true, { Owner = Greece, Location = BaseCameraWaypoint.Location })
Trigger.RemoveFootprintTrigger(baseTrigger) Trigger.RemoveFootprintTrigger(baseTrigger)
end end
Utils.Do(FirstUSSRBase, function(unit) Utils.Do(FirstUSSRBase, function(unit)
@@ -156,7 +156,7 @@ InitTriggers = function()
end) end)
for i = 0, 2 do for i = 0, 2 do
Trigger.AfterDelay(DateTime.Seconds(i), function() Trigger.AfterDelay(DateTime.Seconds(i), function()
Media.PlaySoundNotification(player, "AlertBuzzer") Media.PlaySoundNotification(Greece, "AlertBuzzer")
end) end)
end end
ProduceUnits(ProductionBuildings[1], Utils.RandomInteger(4, 8)) ProduceUnits(ProductionBuildings[1], Utils.RandomInteger(4, 8))
@@ -164,8 +164,8 @@ InitTriggers = function()
end) end)
end) end)
Trigger.OnAllKilledOrCaptured(FirstUSSRBase, function() Trigger.OnAllKilledOrCaptured(FirstUSSRBase, function()
if baseCamera and baseCamera.IsInWorld then if BaseCamera and BaseCamera.IsInWorld then
baseCamera.Destroy() BaseCamera.Destroy()
end end
end) end)
@@ -180,7 +180,7 @@ InitTriggers = function()
end) end)
for i = 0, 2 do for i = 0, 2 do
Trigger.AfterDelay(DateTime.Seconds(i), function() Trigger.AfterDelay(DateTime.Seconds(i), function()
Media.PlaySoundNotification(player, "AlertBuzzer") Media.PlaySoundNotification(Greece, "AlertBuzzer")
end) end)
end end
ProduceUnits(ProductionBuildings[2], Utils.RandomInteger(5, 7)) ProduceUnits(ProductionBuildings[2], Utils.RandomInteger(5, 7))
@@ -189,7 +189,7 @@ InitTriggers = function()
end) end)
Trigger.OnCapture(USSRRadarDome, function(self) Trigger.OnCapture(USSRRadarDome, function(self)
largeCamera = Actor.Create("camera.verylarge", true, { Owner = player, Location = LargeCameraWaypoint.Location }) local largeCamera = Actor.Create("camera.verylarge", true, { Owner = Greece, Location = LargeCameraWaypoint.Location })
Trigger.ClearAll(self) Trigger.ClearAll(self)
Trigger.AfterDelay(DateTime.Seconds(1), function() Trigger.AfterDelay(DateTime.Seconds(1), function()
Trigger.OnRemovedFromWorld(self, function() Trigger.OnRemovedFromWorld(self, function()
@@ -200,22 +200,22 @@ InitTriggers = function()
end) end)
Trigger.OnEnteredFootprint(WaterTransportTriggerArea, function(a, id) Trigger.OnEnteredFootprint(WaterTransportTriggerArea, function(a, id)
if a.Owner == player and not waterTransportTriggered then if a.Owner == Greece and not WaterTransportTriggered then
waterTransportTriggered = true WaterTransportTriggered = true
Trigger.RemoveFootprintTrigger(id) Trigger.RemoveFootprintTrigger(id)
SendUSSRWaterTransport() SendUSSRWaterTransport()
end end
end) end)
Trigger.OnEnteredFootprint(ParadropTriggerArea, function(a, id) Trigger.OnEnteredFootprint(ParadropTriggerArea, function(a, id)
if a.Owner == player and not paradropsTriggered then if a.Owner == Greece and not ParadropsTriggered then
paradropsTriggered = true ParadropsTriggered = true
Trigger.RemoveFootprintTrigger(id) Trigger.RemoveFootprintTrigger(id)
SendUSSRParadrops() SendUSSRParadrops()
end end
end) end)
Trigger.OnEnteredFootprint(ReinforcementsTriggerArea, function(a, id) Trigger.OnEnteredFootprint(ReinforcementsTriggerArea, function(a, id)
if a.Owner == player and not reinforcementsTriggered then if a.Owner == Greece and not ReinforcementsTriggered then
reinforcementsTriggered = true ReinforcementsTriggered = true
Trigger.RemoveFootprintTrigger(id) Trigger.RemoveFootprintTrigger(id)
Trigger.AfterDelay(DateTime.Seconds(1), function() SendUSSRTankReinforcements() end) Trigger.AfterDelay(DateTime.Seconds(1), function() SendUSSRTankReinforcements() end)
end end
@@ -225,19 +225,19 @@ InitTriggers = function()
local bridges = Utils.Where(Map.ActorsInWorld, function(actor) return actor.Type == "bridge1" end) local bridges = Utils.Where(Map.ActorsInWorld, function(actor) return actor.Type == "bridge1" end)
Trigger.OnAllKilled(bridges, function() Trigger.OnAllKilled(bridges, function()
player.MarkCompletedObjective(KillBridges) Greece.MarkCompletedObjective(KillBridges)
player.MarkCompletedObjective(TanyaSurvive) Greece.MarkCompletedObjective(TanyaSurvive)
-- The prisoners are free once their guards are dead -- The prisoners are free once their guards are dead
if PGuard1.IsDead and PGuard2.IsDead then if PGuard1.IsDead and PGuard2.IsDead then
player.MarkCompletedObjective(FreePrisoners) Greece.MarkCompletedObjective(FreePrisoners)
end end
end) end)
local oilPumps = ussr.GetActorsByType("v19") local oilPumps = USSR.GetActorsByType("v19")
Trigger.OnAllKilled(oilPumps, function() Trigger.OnAllKilled(oilPumps, function()
player.MarkCompletedObjective(KillUSSR) Greece.MarkCompletedObjective(KillUSSR)
end) end)
end) end)
@@ -253,7 +253,7 @@ WorldLoaded = function()
InitPlayers() InitPlayers()
InitObjectives(player) InitObjectives(Greece)
AddObjectives() AddObjectives()
InitTriggers() InitTriggers()
SendAlliedUnits() SendAlliedUnits()

View File

@@ -41,7 +41,7 @@ Tick = function()
end end
ProduceUnits = function(factory, count) ProduceUnits = function(factory, count)
if ussr.IsProducing("e1") then if USSR.IsProducing("e1") then
Trigger.AfterDelay(DateTime.Seconds(5), function() ProduceUnits(factory, count) end) Trigger.AfterDelay(DateTime.Seconds(5), function() ProduceUnits(factory, count) end)
return return
end end
@@ -53,14 +53,14 @@ ProduceUnits = function(factory, count)
if not factory.IsDead then if not factory.IsDead then
factory.IsPrimaryBuilding = true factory.IsPrimaryBuilding = true
ussr.Build(units, function(soldiers) USSR.Build(units, function(soldiers)
Utils.Do(soldiers, function(unit) IdleHunt(unit) end) Utils.Do(soldiers, function(unit) IdleHunt(unit) end)
end) end)
end end
end end
SetupAlliedUnits = function() SetupAlliedUnits = function()
Tanya = Actor.Create(TanyaType, true, { Owner = player, Location = TanyaWaypoint.Location, Facing = Angle.South }) Tanya = Actor.Create(TanyaType, true, { Owner = Greece, Location = TanyaWaypoint.Location, Facing = Angle.South })
if TanyaType == "e7.noautotarget" then if TanyaType == "e7.noautotarget" then
Trigger.AfterDelay(DateTime.Seconds(2), function() Trigger.AfterDelay(DateTime.Seconds(2), function()
@@ -74,18 +74,18 @@ SetupAlliedUnits = function()
InsertionHeli.Move(InsertionHeliExit.Location) InsertionHeli.Move(InsertionHeliExit.Location)
InsertionHeli.Destroy() InsertionHeli.Destroy()
Trigger.OnKilled(Tanya, function() player.MarkFailedObjective(TanyaSurvive) end) Trigger.OnKilled(Tanya, function() Greece.MarkFailedObjective(TanyaSurvive) end)
end end
SetupTopRightIsland = function() SetupTopRightIsland = function()
player.MarkCompletedObjective(FindAllies) Greece.MarkCompletedObjective(FindAllies)
Media.PlaySpeechNotification(player, "AlliedReinforcementsArrived") Media.PlaySpeechNotification(Greece, "AlliedReinforcementsArrived")
Reinforcements.Reinforce(player, AlliedIslandReinforcements, { AlliedIslandReinforcementsEntry.Location, IslandParadropReinforcementsDropzone.Location }) Reinforcements.Reinforce(Greece, AlliedIslandReinforcements, { AlliedIslandReinforcementsEntry.Location, IslandParadropReinforcementsDropzone.Location })
SendUSSRParadrops(Angle.New(720), IslandParadropReinforcementsDropzone) SendUSSRParadrops(Angle.New(720), IslandParadropReinforcementsDropzone)
end end
SendUSSRParadrops = function(facing, dropzone) SendUSSRParadrops = function(facing, dropzone)
local paraproxy = Actor.Create("powerproxy.paratroopers", false, { Owner = ussr }) local paraproxy = Actor.Create("powerproxy.paratroopers", false, { Owner = USSR })
local aircraft = paraproxy.TargetParatroopers(dropzone.CenterPosition, facing) local aircraft = paraproxy.TargetParatroopers(dropzone.CenterPosition, facing)
Utils.Do(aircraft, function(a) Utils.Do(aircraft, function(a)
@@ -98,8 +98,8 @@ SendUSSRParadrops = function(facing, dropzone)
end end
SendUSSRTankReinforcements = function() SendUSSRTankReinforcements = function()
local camera = Actor.Create("camera", true, { Owner = player, Location = USSRReinforcementsCameraWaypoint.Location }) local camera = Actor.Create("camera", true, { Owner = Greece, Location = USSRReinforcementsCameraWaypoint.Location })
local ussrTanks = Reinforcements.Reinforce(ussr, USSRTankReinforcements, USSRTankReinforcementsWaypoints) local ussrTanks = Reinforcements.Reinforce(USSR, USSRTankReinforcements, USSRTankReinforcementsWaypoints)
Trigger.OnAllRemovedFromWorld(ussrTanks, function() Trigger.OnAllRemovedFromWorld(ussrTanks, function()
Trigger.AfterDelay(DateTime.Seconds(3), function() Trigger.AfterDelay(DateTime.Seconds(3), function()
if not camera.IsDead then if not camera.IsDead then
@@ -110,7 +110,7 @@ SendUSSRTankReinforcements = function()
end end
JeepCheckpointMove = function() JeepCheckpointMove = function()
JeepCamera = Actor.Create("camera.jeep", true, { Owner = player }) JeepCamera = Actor.Create("camera.jeep", true, { Owner = Greece })
TeleportJeepCamera = true TeleportJeepCamera = true
Trigger.OnIdle(Jeep, function() Trigger.OnIdle(Jeep, function()
@@ -129,7 +129,7 @@ end
JeepSuicideMove = function() JeepSuicideMove = function()
if not JeepCamera then if not JeepCamera then
JeepCamera = Actor.Create("camera.jeep", true, { Owner = player }) JeepCamera = Actor.Create("camera.jeep", true, { Owner = Greece })
TeleportJeepCamera = true TeleportJeepCamera = true
end end
@@ -156,7 +156,7 @@ AlertFirstBase = function()
end) end)
for i = 0, 2 do for i = 0, 2 do
Trigger.AfterDelay(DateTime.Seconds(i), function() Trigger.AfterDelay(DateTime.Seconds(i), function()
Media.PlaySoundNotification(player, "AlertBuzzer") Media.PlaySoundNotification(Greece, "AlertBuzzer")
end) end)
end end
ProduceUnits(ProductionBuildings[1], Utils.RandomInteger(4, 8)) ProduceUnits(ProductionBuildings[1], Utils.RandomInteger(4, 8))
@@ -164,42 +164,42 @@ AlertFirstBase = function()
end end
InitPlayers = function() InitPlayers = function()
player = Player.GetPlayer("Greece") Greece = Player.GetPlayer("Greece")
ussr = Player.GetPlayer("USSR") USSR = Player.GetPlayer("USSR")
ussr.Cash = 10000 USSR.Cash = 10000
end end
AddObjectives = function() AddObjectives = function()
InitObjectives(player) InitObjectives(Greece)
KillBridges = AddPrimaryObjective(player, "destroy-bridges") KillBridges = AddPrimaryObjective(Greece, "destroy-bridges")
TanyaSurvive = AddPrimaryObjective(player, "tanya-survive") TanyaSurvive = AddPrimaryObjective(Greece, "tanya-survive")
FindAllies = AddSecondaryObjective(player, "find-lost-tanks") FindAllies = AddSecondaryObjective(Greece, "find-lost-tanks")
FreePrisoners = AddSecondaryObjective(player, "free-prisoners") FreePrisoners = AddSecondaryObjective(Greece, "free-prisoners")
end end
InitTriggers = function() InitTriggers = function()
Utils.Do(ussr.GetGroundAttackers(), function(unit) Utils.Do(USSR.GetGroundAttackers(), function(unit)
Trigger.OnDamaged(unit, function() IdleHunt(unit) end) Trigger.OnDamaged(unit, function() IdleHunt(unit) end)
end) end)
Trigger.OnAnyKilled(Prisoners, function() player.MarkFailedObjective(FreePrisoners) end) Trigger.OnAnyKilled(Prisoners, function() Greece.MarkFailedObjective(FreePrisoners) end)
Trigger.OnKilled(PrisonedMedi, function() player.MarkFailedObjective(FreePrisoners) end) Trigger.OnKilled(PrisonedMedi, function() Greece.MarkFailedObjective(FreePrisoners) end)
Trigger.OnKilled(MediHideaway, function() Trigger.OnKilled(MediHideaway, function()
if not MediFreed then if not MediFreed then
MediFreed = true MediFreed = true
player.MarkFailedObjective(FreePrisoners) Greece.MarkFailedObjective(FreePrisoners)
end end
end) end)
Trigger.OnKilled(ExplosiveBarrel, function() Trigger.OnKilled(ExplosiveBarrel, function()
if reinforcementsTriggered then if ReinforcementsTriggered then
return return
end end
if not ExplodingBridge.IsDead then ExplodingBridge.Kill() end if not ExplodingBridge.IsDead then ExplodingBridge.Kill() end
reinforcementsTriggered = true ReinforcementsTriggered = true
Trigger.AfterDelay(DateTime.Seconds(1), SendUSSRTankReinforcements) Trigger.AfterDelay(DateTime.Seconds(1), SendUSSRTankReinforcements)
end) end)
@@ -215,19 +215,19 @@ InitTriggers = function()
if not tank.IsDead then tank.Kill() end if not tank.IsDead then tank.Kill() end
end) end)
jeepTriggered = true JeepTriggered = true
JeepSuicideMove() JeepSuicideMove()
end) end)
Utils.Do(FirstUSSRBase, function(unit) Utils.Do(FirstUSSRBase, function(unit)
Trigger.OnDamaged(unit, function() Trigger.OnDamaged(unit, function()
if not baseCamera then baseCamera = Actor.Create("camera", true, { Owner = player, Location = BaseCameraWaypoint.Location }) end if not BaseCamera then BaseCamera = Actor.Create("camera", true, { Owner = Greece, Location = BaseCameraWaypoint.Location }) end
AlertFirstBase() AlertFirstBase()
end) end)
end) end)
Trigger.OnAllKilledOrCaptured(FirstUSSRBase, function() Trigger.OnAllKilledOrCaptured(FirstUSSRBase, function()
if baseCamera and baseCamera.IsInWorld then if BaseCamera and BaseCamera.IsInWorld then
baseCamera.Destroy() BaseCamera.Destroy()
end end
end) end)
@@ -239,19 +239,19 @@ InitTriggers = function()
end) end)
Trigger.OnCapture(USSRRadarDome, function() Trigger.OnCapture(USSRRadarDome, function()
largeCameraA = Actor.Create("camera.verylarge", true, { Owner = player, Location = LargeCameraWaypoint1.Location }) LargeCameraA = Actor.Create("camera.verylarge", true, { Owner = Greece, Location = LargeCameraWaypoint1.Location })
largeCameraB = Actor.Create("camera.verylarge", true, { Owner = player, Location = LargeCameraWaypoint2.Location }) LargeCameraB = Actor.Create("camera.verylarge", true, { Owner = Greece, Location = LargeCameraWaypoint2.Location })
largeCameraC = Actor.Create("camera.verylarge", true, { Owner = player, Location = LargeCameraWaypoint3.Location }) LargeCameraC = Actor.Create("camera.verylarge", true, { Owner = Greece, Location = LargeCameraWaypoint3.Location })
end) end)
Trigger.OnRemovedFromWorld(USSRRadarDome, function() Trigger.OnRemovedFromWorld(USSRRadarDome, function()
if largeCameraA and largeCameraA.IsInWorld then largeCameraA.Destroy() end if LargeCameraA and LargeCameraA.IsInWorld then LargeCameraA.Destroy() end
if largeCameraB and largeCameraB.IsInWorld then largeCameraB.Destroy() end if LargeCameraB and LargeCameraB.IsInWorld then LargeCameraB.Destroy() end
if largeCameraC and largeCameraC.IsInWorld then largeCameraC.Destroy() end if LargeCameraC and LargeCameraC.IsInWorld then LargeCameraC.Destroy() end
end) end)
Trigger.OnEnteredFootprint(TrukTriggerArea, function(a, id) Trigger.OnEnteredFootprint(TrukTriggerArea, function(a, id)
if a.Owner == player and not trukTriggered then if a.Owner == Greece and not TrukTriggered then
trukTriggered = true TrukTriggered = true
Trigger.RemoveFootprintTrigger(id) Trigger.RemoveFootprintTrigger(id)
if USSRTruk.IsDead then if USSRTruk.IsDead then
@@ -262,7 +262,7 @@ InitTriggers = function()
if USSRTruk.Location == BaseCameraWaypoint.Location then if USSRTruk.Location == BaseCameraWaypoint.Location then
Trigger.ClearAll(USSRTruk) Trigger.ClearAll(USSRTruk)
local driver = Actor.Create("e1", true, { Owner = ussr, Location = USSRTruk.Location }) local driver = Actor.Create("e1", true, { Owner = USSR, Location = USSRTruk.Location })
if not PGuard5.IsDead then if not PGuard5.IsDead then
driver.AttackMove(PGuard5.Location) driver.AttackMove(PGuard5.Location)
else else
@@ -276,57 +276,57 @@ InitTriggers = function()
end end
end) end)
Trigger.OnEnteredProximityTrigger(BaseCameraWaypoint.CenterPosition, WDist.New(7 * 1024), function(a, id) Trigger.OnEnteredProximityTrigger(BaseCameraWaypoint.CenterPosition, WDist.New(7 * 1024), function(a, id)
if a.Type == "truk" and not baseCamera then if a.Type == "truk" and not BaseCamera then
Trigger.RemoveProximityTrigger(id) Trigger.RemoveProximityTrigger(id)
baseCamera = Actor.Create("camera", true, { Owner = player, Location = BaseCameraWaypoint.Location }) BaseCamera = Actor.Create("camera", true, { Owner = Greece, Location = BaseCameraWaypoint.Location })
end end
end) end)
end end
end) end)
Trigger.OnEnteredFootprint(FreeMediTriggerArea, function(a, id) Trigger.OnEnteredFootprint(FreeMediTriggerArea, function(a, id)
if a.Owner == player and not MediFreed then if a.Owner == Greece and not MediFreed then
MediFreed = true MediFreed = true
Trigger.RemoveFootprintTrigger(id) Trigger.RemoveFootprintTrigger(id)
Reinforcements.Reinforce(player, { "medi" }, { MediSpawnpoint.Location, MediRallypoint.Location }) Reinforcements.Reinforce(Greece, { "medi" }, { MediSpawnpoint.Location, MediRallypoint.Location })
end end
end) end)
Trigger.OnEnteredFootprint(CameraTriggerArea, function(a, id) Trigger.OnEnteredFootprint(CameraTriggerArea, function(a, id)
if a.Owner == player and not baseCamera then if a.Owner == Greece and not BaseCamera then
Trigger.RemoveFootprintTrigger(id) Trigger.RemoveFootprintTrigger(id)
baseCamera = Actor.Create("camera", true, { Owner = player, Location = BaseCameraWaypoint.Location }) BaseCamera = Actor.Create("camera", true, { Owner = Greece, Location = BaseCameraWaypoint.Location })
end end
end) end)
Trigger.OnEnteredFootprint(BeachTriggerArea, function(a, id) Trigger.OnEnteredFootprint(BeachTriggerArea, function(a, id)
if a.Owner == player and not beachTransportTriggered then if a.Owner == Greece and not BeachTransportTriggered then
beachTransportTriggered = true BeachTransportTriggered = true
Trigger.RemoveFootprintTrigger(id) Trigger.RemoveFootprintTrigger(id)
SetupTopRightIsland() SetupTopRightIsland()
end end
end) end)
Trigger.OnEnteredFootprint(ParadropTriggerArea, function(a, id) Trigger.OnEnteredFootprint(ParadropTriggerArea, function(a, id)
if a.Owner == player and a.Type ~= "jeep.mission" and not paradropsTriggered then if a.Owner == Greece and a.Type ~= "jeep.mission" and not ParadropsTriggered then
paradropsTriggered = true ParadropsTriggered = true
Trigger.RemoveFootprintTrigger(id) Trigger.RemoveFootprintTrigger(id)
SendUSSRParadrops(Angle.New(216), ParadropReinforcementsDropzone) SendUSSRParadrops(Angle.New(216), ParadropReinforcementsDropzone)
end end
end) end)
Trigger.OnEnteredFootprint(ReinforcementsTriggerArea, function(a, id) Trigger.OnEnteredFootprint(ReinforcementsTriggerArea, function(a, id)
if a.Owner == player and not reinforcementsTriggered then if a.Owner == Greece and not ReinforcementsTriggered then
reinforcementsTriggered = true ReinforcementsTriggered = true
Trigger.RemoveFootprintTrigger(id) Trigger.RemoveFootprintTrigger(id)
Trigger.AfterDelay(DateTime.Seconds(1), SendUSSRTankReinforcements) Trigger.AfterDelay(DateTime.Seconds(1), SendUSSRTankReinforcements)
end end
end) end)
Trigger.OnEnteredFootprint(Barracks3TriggerArea, function(a, id) Trigger.OnEnteredFootprint(Barracks3TriggerArea, function(a, id)
if a.Owner == player and not Barracks3Producing then if a.Owner == Greece and not Barracks3Producing then
Barracks3Producing = true Barracks3Producing = true
Trigger.RemoveFootprintTrigger(id) Trigger.RemoveFootprintTrigger(id)
ProduceUnits(ProductionBuildings[3], Utils.RandomInteger(2, 5)) ProduceUnits(ProductionBuildings[3], Utils.RandomInteger(2, 5))
end end
end) end)
Trigger.OnEnteredFootprint(JeepTriggerArea, function(a, id) Trigger.OnEnteredFootprint(JeepTriggerArea, function(a, id)
if a.Owner == player and not jeepTriggered then if a.Owner == Greece and not JeepTriggered then
jeepTriggered = true JeepTriggered = true
Trigger.RemoveFootprintTrigger(id) Trigger.RemoveFootprintTrigger(id)
JeepCheckpointMove() JeepCheckpointMove()
end end
@@ -345,12 +345,12 @@ InitTriggers = function()
ExplodingBridge = bridges[1] ExplodingBridge = bridges[1]
Trigger.OnAllKilled(bridges, function() Trigger.OnAllKilled(bridges, function()
player.MarkCompletedObjective(KillBridges) Greece.MarkCompletedObjective(KillBridges)
player.MarkCompletedObjective(TanyaSurvive) Greece.MarkCompletedObjective(TanyaSurvive)
-- The medic is freed once his guard is dead -- The medic is freed once his guard is dead
if MediFreed and MediGuard.IsDead and EngisFreed then if MediFreed and MediGuard.IsDead and EngisFreed then
player.MarkCompletedObjective(FreePrisoners) Greece.MarkCompletedObjective(FreePrisoners)
end end
end) end)
end) end)

View File

@@ -59,9 +59,9 @@ BaseBuildings = { Powr1, Barr, Proc, Weap, Powr2, Powr3, Powr4, Ftur1, Ftur2, Ft
InitialBase = { Barracks, Refinery, PowerPlant1, PowerPlant2, PowerPlant3, PowerPlant4, Warfactory, Flametur1, Flametur2, Flametur3, Airfield1, Airfield2 } InitialBase = { Barracks, Refinery, PowerPlant1, PowerPlant2, PowerPlant3, PowerPlant4, Warfactory, Flametur1, Flametur2, Flametur3, Airfield1, Airfield2 }
BuildBase = function() BuildBase = function()
if Conyard.IsDead or Conyard.Owner ~= ussr then if Conyard.IsDead or Conyard.Owner ~= USSR then
return return
elseif Harvester.IsDead and ussr.Resources <= 299 then elseif Harvester.IsDead and USSR.Resources <= 299 then
return return
end end
@@ -77,13 +77,13 @@ end
BuildBuilding = function(building) BuildBuilding = function(building)
Trigger.AfterDelay(Actor.BuildTime(building.name), function() Trigger.AfterDelay(Actor.BuildTime(building.name), function()
local actor = Actor.Create(building.name, true, { Owner = ussr, Location = building.pos }) local actor = Actor.Create(building.name, true, { Owner = USSR, Location = building.pos })
ussr.Cash = ussr.Cash - building.prize USSR.Cash = USSR.Cash - building.prize
building.exists = true building.exists = true
Trigger.OnKilled(actor, function() building.exists = false end) Trigger.OnKilled(actor, function() building.exists = false end)
Trigger.OnDamaged(actor, function(building) Trigger.OnDamaged(actor, function(building)
if building.Owner == ussr and building.Health < building.MaxHealth * 3/4 then if building.Owner == USSR and building.Health < building.MaxHealth * 3/4 then
building.StartBuildingRepairs() building.StartBuildingRepairs()
DefendActor(actor) DefendActor(actor)
end end
@@ -163,13 +163,13 @@ DefendActor = function(unit)
end end
InitAIUnits = function() InitAIUnits = function()
IdlingUnits = ussr.GetGroundAttackers() IdlingUnits = USSR.GetGroundAttackers()
DefendActor(Conyard) DefendActor(Conyard)
for i,v in ipairs(InitialBase) do for i,v in ipairs(InitialBase) do
DefendActor(v) DefendActor(v)
Trigger.OnDamaged(v, function(building) Trigger.OnDamaged(v, function(building)
if building.Owner == ussr and building.Health < building.MaxHealth * 3/4 then if building.Owner == USSR and building.Health < building.MaxHealth * 3/4 then
building.StartBuildingRepairs() building.StartBuildingRepairs()
end end
end) end)
@@ -189,7 +189,7 @@ ProduceInfantry = function()
-- See AttackDelay in WorldLoaded -- See AttackDelay in WorldLoaded
local delay = Utils.RandomInteger(AttackDelay[1], AttackDelay[2]) local delay = Utils.RandomInteger(AttackDelay[1], AttackDelay[2])
local toBuild = { Utils.Random(SovietInfantryTypes) } local toBuild = { Utils.Random(SovietInfantryTypes) }
ussr.Build(toBuild, function(unit) USSR.Build(toBuild, function(unit)
IdlingUnits[#IdlingUnits + 1] = unit[1] IdlingUnits[#IdlingUnits + 1] = unit[1]
Trigger.AfterDelay(delay, ProduceInfantry) Trigger.AfterDelay(delay, ProduceInfantry)
@@ -209,14 +209,14 @@ ProduceVehicles = function()
-- See AttackDelay in WorldLoaded -- See AttackDelay in WorldLoaded
local delay = Utils.RandomInteger(AttackDelay[1], AttackDelay[2]) local delay = Utils.RandomInteger(AttackDelay[1], AttackDelay[2])
if HarvesterKilled then if HarvesterKilled then
ussr.Build({ "harv" }, function(harv) USSR.Build({ "harv" }, function(harv)
ProtectHarvester(harv[1]) ProtectHarvester(harv[1])
HarvesterKilled = false HarvesterKilled = false
Trigger.AfterDelay(delay, ProduceVehicles) Trigger.AfterDelay(delay, ProduceVehicles)
end) end)
else else
local toBuild = { Utils.Random(SovietVehicleTypes) } local toBuild = { Utils.Random(SovietVehicleTypes) }
ussr.Build(toBuild, function(unit) USSR.Build(toBuild, function(unit)
IdlingUnits[#IdlingUnits + 1] = unit[1] IdlingUnits[#IdlingUnits + 1] = unit[1]
Trigger.AfterDelay(delay, ProduceVehicles) Trigger.AfterDelay(delay, ProduceVehicles)
@@ -229,7 +229,7 @@ ProduceVehicles = function()
end end
ProduceAircraft = function() ProduceAircraft = function()
ussr.Build(SovietAircraftType, function(units) USSR.Build(SovietAircraftType, function(units)
local yak = units[1] local yak = units[1]
Yaks[#Yaks + 1] = yak Yaks[#Yaks + 1] = yak
@@ -238,7 +238,7 @@ ProduceAircraft = function()
Trigger.AfterDelay(DateTime.Minutes(1), ProduceAircraft) Trigger.AfterDelay(DateTime.Minutes(1), ProduceAircraft)
end end
InitializeAttackAircraft(yak, player) InitializeAttackAircraft(yak, Greece)
end) end)
end end

View File

@@ -59,7 +59,7 @@ Paradrop = function()
Trigger.AfterDelay(Utils.RandomInteger(ParadropDelay[1], ParadropDelay[2]), function() Trigger.AfterDelay(Utils.RandomInteger(ParadropDelay[1], ParadropDelay[2]), function()
local aircraft = PowerProxy.TargetParatroopers(Utils.Random(ParadropLZs)) local aircraft = PowerProxy.TargetParatroopers(Utils.Random(ParadropLZs))
Utils.Do(aircraft, function(a) Utils.Do(aircraft, function(a)
Trigger.OnPassengerExited(a, function(t, p) Trigger.OnPassengerExited(a, function(_, p)
IdleHunt(p) IdleHunt(p)
end) end)
end) end)
@@ -75,7 +75,7 @@ ConvoysSent = 0
SendConvoys = function() SendConvoys = function()
Trigger.AfterDelay(Utils.RandomInteger(ConvoyDelay[1], ConvoyDelay[2]), function() Trigger.AfterDelay(Utils.RandomInteger(ConvoyDelay[1], ConvoyDelay[2]), function()
local path = Utils.Random(ConvoyRallyPoints) local path = Utils.Random(ConvoyRallyPoints)
local units = Reinforcements.Reinforce(ussr, Utils.Random(ConvoyUnits), { path[1] }) local units = Reinforcements.Reinforce(USSR, Utils.Random(ConvoyUnits), { path[1] })
local lastWaypoint = path[#path] local lastWaypoint = path[#path]
Utils.Do(units, function(unit) Utils.Do(units, function(unit)
@@ -98,14 +98,14 @@ SendConvoys = function()
end) end)
local id = Trigger.OnEnteredFootprint({ lastWaypoint }, function(a, id) local id = Trigger.OnEnteredFootprint({ lastWaypoint }, function(a, id)
if a.Owner == ussr and Utils.Any(units, function(unit) return unit == a end) then if a.Owner == USSR and Utils.Any(units, function(unit) return unit == a end) then
-- We are at our destination and thus don't care about other queued actions anymore -- We are at our destination and thus don't care about other queued actions anymore
a.Stop() a.Stop()
a.Destroy() a.Destroy()
if a.Type == "truk" then if a.Type == "truk" then
player.MarkFailedObjective(DestroyConvoys) Greece.MarkFailedObjective(DestroyConvoys)
end end
end end
end) end)
@@ -117,44 +117,44 @@ SendConvoys = function()
if ConvoysSent <= Convoys[Difficulty] then if ConvoysSent <= Convoys[Difficulty] then
SendConvoys() SendConvoys()
else else
player.MarkCompletedObjective(DestroyConvoys) Greece.MarkCompletedObjective(DestroyConvoys)
end end
end) end)
Media.PlaySpeechNotification(player, "ConvoyApproaching") Media.PlaySpeechNotification(Greece, "ConvoyApproaching")
end) end)
end end
Tick = function() Tick = function()
if player.HasNoRequiredUnits() then if Greece.HasNoRequiredUnits() then
player.MarkFailedObjective(KillUSSR) Greece.MarkFailedObjective(KillUSSR)
end end
if ussr.HasNoRequiredUnits() then if USSR.HasNoRequiredUnits() then
player.MarkCompletedObjective(KillUSSR) Greece.MarkCompletedObjective(KillUSSR)
-- We don't care about future convoys anymore -- We don't care about future convoys anymore
player.MarkCompletedObjective(DestroyConvoys) Greece.MarkCompletedObjective(DestroyConvoys)
end end
end end
AddObjectives = function() AddObjectives = function()
KillUSSR = AddPrimaryObjective(player, "destroy-soviet-units-buildings") KillUSSR = AddPrimaryObjective(Greece, "destroy-soviet-units-buildings")
DestroyConvoys = AddSecondaryObjective(player, "destroy-convoys") DestroyConvoys = AddSecondaryObjective(Greece, "destroy-convoys")
end end
WorldLoaded = function() WorldLoaded = function()
player = Player.GetPlayer("Greece") Greece = Player.GetPlayer("Greece")
ussr = Player.GetPlayer("USSR") USSR = Player.GetPlayer("USSR")
Camera.Position = AlliedConyard.CenterPosition Camera.Position = AlliedConyard.CenterPosition
InitObjectives(player) InitObjectives(Greece)
AddObjectives() AddObjectives()
ConvoyDelay = ConvoyDelays[Difficulty] ConvoyDelay = ConvoyDelays[Difficulty]
ParadropDelay = ParadropDelays[Difficulty] ParadropDelay = ParadropDelays[Difficulty]
PowerProxy = Actor.Create("powerproxy.paratroopers", false, { Owner = ussr }) PowerProxy = Actor.Create("powerproxy.paratroopers", false, { Owner = USSR })
Paradrop() Paradrop()
SendConvoys() SendConvoys()

View File

@@ -84,7 +84,7 @@ WaterAttack = function()
types[i] = Utils.Random(SovietInfantryTypes) types[i] = Utils.Random(SovietInfantryTypes)
end end
return Reinforcements.ReinforceWithTransport(ussr, InsertionTransport, types, { WaterTransportSpawn.Location, Utils.Random(WaterLZs).Location }, { WaterTransportSpawn.Location })[2] return Reinforcements.ReinforceWithTransport(USSR, InsertionTransport, types, { WaterTransportSpawn.Location, Utils.Random(WaterLZs).Location }, { WaterTransportSpawn.Location })[2]
end end
ProtectHarvester = function(unit) ProtectHarvester = function(unit)
@@ -111,12 +111,12 @@ ProtectHarvester = function(unit)
end end
InitAIUnits = function() InitAIUnits = function()
IdlingUnits = Utils.Where(Map.ActorsInWorld, function(self) return self.Owner == ussr and self.HasProperty("Hunt") and self.Location.Y > MainBaseTopLeft.Location.Y end) IdlingUnits = Utils.Where(Map.ActorsInWorld, function(self) return self.Owner == USSR and self.HasProperty("Hunt") and self.Location.Y > MainBaseTopLeft.Location.Y end)
local buildings = Utils.Where(Map.ActorsInWorld, function(self) return self.Owner == ussr and self.HasProperty("StartBuildingRepairs") end) local buildings = Utils.Where(Map.ActorsInWorld, function(self) return self.Owner == USSR and self.HasProperty("StartBuildingRepairs") end)
Utils.Do(buildings, function(actor) Utils.Do(buildings, function(actor)
Trigger.OnDamaged(actor, function(building) Trigger.OnDamaged(actor, function(building)
if building.Owner == ussr and building.Health < building.MaxHealth * 3/4 then if building.Owner == USSR and building.Health < building.MaxHealth * 3/4 then
building.StartBuildingRepairs() building.StartBuildingRepairs()
end end
end) end)
@@ -124,7 +124,7 @@ InitAIUnits = function()
end end
InitAIEconomy = function() InitAIEconomy = function()
ussr.Cash = 6000 USSR.Cash = 6000
if not Harvester.IsDead then if not Harvester.IsDead then
Harvester.FindResources() Harvester.FindResources()
@@ -200,7 +200,7 @@ ProduceInfantry = function()
local delay = Utils.RandomInteger(DateTime.Seconds(3), DateTime.Seconds(9)) local delay = Utils.RandomInteger(DateTime.Seconds(3), DateTime.Seconds(9))
local toBuild = { Utils.Random(SovietInfantryTypes) } local toBuild = { Utils.Random(SovietInfantryTypes) }
ussr.Build(toBuild, function(unit) USSR.Build(toBuild, function(unit)
IdlingUnits[#IdlingUnits + 1] = unit[1] IdlingUnits[#IdlingUnits + 1] = unit[1]
Trigger.AfterDelay(delay, ProduceInfantry) Trigger.AfterDelay(delay, ProduceInfantry)
@@ -223,7 +223,7 @@ ProduceVehicles = function()
local delay = Utils.RandomInteger(DateTime.Seconds(5), DateTime.Seconds(9)) local delay = Utils.RandomInteger(DateTime.Seconds(5), DateTime.Seconds(9))
if HarvesterKilled then if HarvesterKilled then
HarvesterKilled = false HarvesterKilled = false
ussr.Build({ "harv" }, function(harv) USSR.Build({ "harv" }, function(harv)
harv[1].FindResources() harv[1].FindResources()
ProtectHarvester(harv[1]) ProtectHarvester(harv[1])
Trigger.AfterDelay(delay, ProduceVehicles) Trigger.AfterDelay(delay, ProduceVehicles)
@@ -233,7 +233,7 @@ ProduceVehicles = function()
Warfactory2.RallyPoint = Utils.Random(Rallypoints).Location Warfactory2.RallyPoint = Utils.Random(Rallypoints).Location
local toBuild = { Utils.Random(SovietVehicleTypes) } local toBuild = { Utils.Random(SovietVehicleTypes) }
ussr.Build(toBuild, function(unit) USSR.Build(toBuild, function(unit)
IdlingUnits[#IdlingUnits + 1] = unit[1] IdlingUnits[#IdlingUnits + 1] = unit[1]
Trigger.AfterDelay(delay, ProduceVehicles) Trigger.AfterDelay(delay, ProduceVehicles)
@@ -248,7 +248,7 @@ ProduceAircraft = function()
return return
end end
ussr.Build(SovietAircraftType, function(units) USSR.Build(SovietAircraftType, function(units)
local yak = units[1] local yak = units[1]
Yaks[#Yaks + 1] = yak Yaks[#Yaks + 1] = yak
@@ -257,7 +257,7 @@ ProduceAircraft = function()
Trigger.AfterDelay(DateTime.Minutes(1), ProduceAircraft) Trigger.AfterDelay(DateTime.Minutes(1), ProduceAircraft)
end end
InitializeAttackAircraft(yak, greece) InitializeAttackAircraft(yak, Greece)
end) end)
end end

View File

@@ -88,33 +88,33 @@ Tick = function()
Camera.Position = Truk.CenterPosition Camera.Position = Truk.CenterPosition
end end
if ussr.HasNoRequiredUnits() then if USSR.HasNoRequiredUnits() then
if not greece.IsObjectiveCompleted(KillAll) and Difficulty == "tough" then if not Greece.IsObjectiveCompleted(KillAll) and Difficulty == "tough" then
SendWaterExtraction() SendWaterExtraction()
end end
greece.MarkCompletedObjective(KillAll) Greece.MarkCompletedObjective(KillAll)
end end
if GreeceReinforcementsArrived and greece.HasNoRequiredUnits() then if GreeceReinforcementsArrived and Greece.HasNoRequiredUnits() then
ussr.MarkCompletedObjective(ussrObj) USSR.MarkCompletedObjective(USSRobjective)
end end
if ussr.Resources >= ussr.ResourceCapacity * 0.75 then if USSR.Resources >= USSR.ResourceCapacity * 0.75 then
ussr.Cash = ussr.Cash + ussr.Resources - ussr.ResourceCapacity * 0.25 USSR.Cash = USSR.Cash + USSR.Resources - USSR.ResourceCapacity * 0.25
ussr.Resources = ussr.ResourceCapacity * 0.25 USSR.Resources = USSR.ResourceCapacity * 0.25
end end
end end
SendReinforcements = function() SendReinforcements = function()
GreeceReinforcementsArrived = true GreeceReinforcementsArrived = true
Camera.Position = ReinforceCamera.CenterPosition Camera.Position = ReinforceCamera.CenterPosition
greece.Cash = greece.Cash + ReinforceCash Greece.Cash = Greece.Cash + ReinforceCash
Utils.Do(GreeceReinforcements, function(reinforcements) Utils.Do(GreeceReinforcements, function(reinforcements)
Reinforcements.ReinforceWithTransport(greece, InsertionTransport, reinforcements.types, reinforcements.entry, { SpyEntry.Location }) Reinforcements.ReinforceWithTransport(Greece, InsertionTransport, reinforcements.types, reinforcements.entry, { SpyEntry.Location })
end) end)
Media.PlaySpeechNotification(greece, "AlliedReinforcementsArrived") Media.PlaySpeechNotification(Greece, "AlliedReinforcementsArrived")
ActivateAI() ActivateAI()
end end
@@ -131,19 +131,19 @@ ExtractUnits = function(extractionUnit, pos, after)
end end
SendWaterExtraction = function() SendWaterExtraction = function()
local flare = Actor.Create("flare", true, { Owner = greece, Location = SpyEntryPath[2] + CVec.New(2, 0) }) local flare = Actor.Create("flare", true, { Owner = Greece, Location = SpyEntryPath[2] + CVec.New(2, 0) })
Trigger.AfterDelay(DateTime.Seconds(5), flare.Destroy) Trigger.AfterDelay(DateTime.Seconds(5), flare.Destroy)
Media.PlaySpeechNotification(greece, "SignalFlareNorth") Media.PlaySpeechNotification(Greece, "SignalFlareNorth")
Camera.Position = flare.CenterPosition Camera.Position = flare.CenterPosition
WaterExtractionTran = Reinforcements.ReinforceWithTransport(greece, ExtractionTransport, nil, SpyEntryPath)[1] WaterExtractionTran = Reinforcements.ReinforceWithTransport(Greece, ExtractionTransport, nil, SpyEntryPath)[1]
ExtractObj = AddPrimaryObjective(greece, "extract-transport") ExtractObjective = AddPrimaryObjective(Greece, "extract-transport")
Trigger.OnKilled(WaterExtractionTran, function() ussr.MarkCompletedObjective(ussrObj) end) Trigger.OnKilled(WaterExtractionTran, function() USSR.MarkCompletedObjective(USSRobjective) end)
Trigger.OnAllRemovedFromWorld(greece.GetGroundAttackers(), function() Trigger.OnAllRemovedFromWorld(Greece.GetGroundAttackers(), function()
ExtractUnits(WaterExtractionTran, SpyEntryPath[1], function() ExtractUnits(WaterExtractionTran, SpyEntryPath[1], function()
greece.MarkCompletedObjective(ExtractObj) Greece.MarkCompletedObjective(ExtractObjective)
greece.MarkCompletedObjective(surviveObj) Greece.MarkCompletedObjective(TanyaSurviveObjective)
end) end)
end) end)
end end
@@ -169,7 +169,7 @@ MissInfiltrated = function()
for i = 0, 5, 1 do for i = 0, 5, 1 do
local sound = Utils.Random(TanyaVoices) local sound = Utils.Random(TanyaVoices)
Trigger.AfterDelay(DateTime.Seconds(i), function() Trigger.AfterDelay(DateTime.Seconds(i), function()
Media.PlaySoundNotification(greece, sound) Media.PlaySoundNotification(Greece, sound)
end) end)
end end
Prison.Attack(Prison) Prison.Attack(Prison)
@@ -179,7 +179,7 @@ end
FreeTanya = function() FreeTanya = function()
Prison.Stop() Prison.Stop()
Tanya = Actor.Create(TanyaType, true, { Owner = greece, Location = Prison.Location + CVec.New(1, 1) }) Tanya = Actor.Create(TanyaType, true, { Owner = Greece, Location = Prison.Location + CVec.New(1, 1) })
Tanya.Demolish(Prison) Tanya.Demolish(Prison)
Tanya.Move(Tanya.Location + CVec.New(Utils.RandomInteger(-1, 2), 1)) Tanya.Move(Tanya.Location + CVec.New(Utils.RandomInteger(-1, 2), 1))
@@ -189,18 +189,18 @@ FreeTanya = function()
end) end)
end end
Trigger.OnKilled(Tanya, function() ussr.MarkCompletedObjective(ussrObj) end) Trigger.OnKilled(Tanya, function() USSR.MarkCompletedObjective(USSRobjective) end)
if Difficulty == "tough" then if Difficulty == "tough" then
KillSams = AddPrimaryObjective(greece, "destroy-sam-sites-blocker") KillSams = AddPrimaryObjective(Greece, "destroy-sam-sites-blocker")
greece.MarkCompletedObjective(mainObj) Greece.MarkCompletedObjective(RescueTanyaObjective)
surviveObj = AddPrimaryObjective(greece, "tanya-survive") TanyaSurviveObjective = AddPrimaryObjective(Greece, "tanya-survive")
Media.PlaySpeechNotification(greece, "TanyaRescued") Media.PlaySpeechNotification(Greece, "TanyaRescued")
else else
KillSams = AddPrimaryObjective(greece, "destroy-sam-sites-blocker") KillSams = AddPrimaryObjective(Greece, "destroy-sam-sites-blocker")
Media.PlaySpeechNotification(greece, "TargetFreed") Media.PlaySpeechNotification(Greece, "TargetFreed")
end end
if not SpecialCameras and PrisonCamera and PrisonCamera.IsInWorld then if not SpecialCameras and PrisonCamera and PrisonCamera.IsInWorld then
@@ -210,13 +210,13 @@ end
SendSpy = function() SendSpy = function()
Camera.Position = SpyEntry.CenterPosition Camera.Position = SpyEntry.CenterPosition
Spy = Reinforcements.ReinforceWithTransport(greece, InsertionTransport, SpyType, SpyEntryPath, { SpyEntryPath[1] })[2][1] Spy = Reinforcements.ReinforceWithTransport(Greece, InsertionTransport, SpyType, SpyEntryPath, { SpyEntryPath[1] })[2][1]
Trigger.OnKilled(Spy, function() ussr.MarkCompletedObjective(ussrObj) end) Trigger.OnKilled(Spy, function() USSR.MarkCompletedObjective(USSRobjective) end)
if SpecialCameras then if SpecialCameras then
SpyCameraA = Actor.Create("camera", true, { Owner = greece, Location = SpyCamera1.Location }) SpyCameraA = Actor.Create("camera", true, { Owner = Greece, Location = SpyCamera1.Location })
SpyCameraB = Actor.Create("camera", true, { Owner = greece, Location = SpyCamera2.Location }) SpyCameraB = Actor.Create("camera", true, { Owner = Greece, Location = SpyCamera2.Location })
end end
Trigger.AfterDelay(DateTime.Seconds(3), function() Trigger.AfterDelay(DateTime.Seconds(3), function()
@@ -235,44 +235,44 @@ end
InitTriggers = function() InitTriggers = function()
Trigger.OnInfiltrated(Warfactory, function() Trigger.OnInfiltrated(Warfactory, function()
if greece.IsObjectiveCompleted(infWarfactory) then if Greece.IsObjectiveCompleted(InfiltrateWarfactoryObjective) then
return return
elseif Truk.IsDead then elseif Truk.IsDead then
if not greece.IsObjectiveCompleted(mainObj) then if not Greece.IsObjectiveCompleted(RescueTanyaObjective) then
ussr.MarkCompletedObjective(ussrObj) USSR.MarkCompletedObjective(USSRobjective)
end end
return return
end end
Trigger.ClearAll(Spy) Trigger.ClearAll(Spy)
greece.MarkCompletedObjective(infWarfactory) Greece.MarkCompletedObjective(InfiltrateWarfactoryObjective)
WarfactoryInfiltrated() WarfactoryInfiltrated()
end) end)
Trigger.OnKilled(Truk, function() Trigger.OnKilled(Truk, function()
if not greece.IsObjectiveCompleted(infWarfactory) then if not Greece.IsObjectiveCompleted(InfiltrateWarfactoryObjective) then
greece.MarkFailedObjective(infWarfactory) Greece.MarkFailedObjective(InfiltrateWarfactoryObjective)
elseif FollowTruk then elseif FollowTruk then
ussr.MarkCompletedObjective(ussrObj) USSR.MarkCompletedObjective(USSRobjective)
end end
end) end)
Trigger.OnInfiltrated(Prison, function() Trigger.OnInfiltrated(Prison, function()
if greece.IsObjectiveCompleted(mainObj) then if Greece.IsObjectiveCompleted(RescueTanyaObjective) then
return return
end end
if not greece.IsObjectiveCompleted(infWarfactory) then if not Greece.IsObjectiveCompleted(InfiltrateWarfactoryObjective) then
Media.DisplayMessage(UserInterface.Translate("skip-heroics"), UserInterface.Translate("battlefield-control")) Media.DisplayMessage(UserInterface.Translate("skip-heroics"), UserInterface.Translate("battlefield-control"))
greece.MarkCompletedObjective(infWarfactory) Greece.MarkCompletedObjective(InfiltrateWarfactoryObjective)
end end
if not PrisonCamera then if not PrisonCamera then
if SpecialCameras then if SpecialCameras then
PrisonCamera = Actor.Create("camera", true, { Owner = greece, Location = TrukWaypoint5.Location }) PrisonCamera = Actor.Create("camera", true, { Owner = Greece, Location = TrukWaypoint5.Location })
else else
PrisonCamera = Actor.Create("camera.small", true, { Owner = greece, Location = Prison.Location + CVec.New(1, 1) }) PrisonCamera = Actor.Create("camera.small", true, { Owner = Greece, Location = Prison.Location + CVec.New(1, 1) })
end end
end end
@@ -289,21 +289,21 @@ InitTriggers = function()
if a == Truk then if a == Truk then
Trigger.RemoveFootprintTrigger(id) Trigger.RemoveFootprintTrigger(id)
Spy = Actor.Create("spy", true, { Owner = greece, Location = TrukWaypoint5.Location }) Spy = Actor.Create("spy", true, { Owner = Greece, Location = TrukWaypoint5.Location })
Spy.DisguiseAsType("e1", ussr) Spy.DisguiseAsType("e1", USSR)
Spy.Move(SpyWaypoint.Location) Spy.Move(SpyWaypoint.Location)
Spy.Infiltrate(Prison) Spy.Infiltrate(Prison)
Media.PlaySoundNotification(greece, SpyVoice) Media.PlaySoundNotification(Greece, SpyVoice)
FollowTruk = false FollowTruk = false
if SpecialCameras then if SpecialCameras then
PrisonCamera = Actor.Create("camera", true, { Owner = greece, Location = TrukWaypoint5.Location }) PrisonCamera = Actor.Create("camera", true, { Owner = Greece, Location = TrukWaypoint5.Location })
else else
PrisonCamera = Actor.Create("camera.small", true, { Owner = greece, Location = Prison.Location + CVec.New(1, 1) }) PrisonCamera = Actor.Create("camera.small", true, { Owner = Greece, Location = Prison.Location + CVec.New(1, 1) })
end end
Trigger.OnKilled(Spy, function() ussr.MarkCompletedObjective(ussrObj) end) Trigger.OnKilled(Spy, function() USSR.MarkCompletedObjective(USSRobjective) end)
end end
end) end)
@@ -336,28 +336,28 @@ InitTriggers = function()
end) end)
Trigger.OnAllKilled(SamSites, function() Trigger.OnAllKilled(SamSites, function()
greece.MarkCompletedObjective(KillSams) Greece.MarkCompletedObjective(KillSams)
local flare = Actor.Create("flare", true, { Owner = greece, Location = ExtractionPath[2] + CVec.New(0, -1) }) local flare = Actor.Create("flare", true, { Owner = Greece, Location = ExtractionPath[2] + CVec.New(0, -1) })
Trigger.AfterDelay(DateTime.Seconds(7), flare.Destroy) Trigger.AfterDelay(DateTime.Seconds(7), flare.Destroy)
Media.PlaySpeechNotification(greece, "SignalFlare") Media.PlaySpeechNotification(Greece, "SignalFlare")
if Difficulty == "tough" then if Difficulty == "tough" then
Reinforcements.ReinforceWithTransport(greece, InsertionHeliType, HeliReinforcements, ExtractionPath, { ExtractionPath[1] }) Reinforcements.ReinforceWithTransport(Greece, InsertionHeliType, HeliReinforcements, ExtractionPath, { ExtractionPath[1] })
if not Harvester.IsDead then if not Harvester.IsDead then
Harvester.FindResources() Harvester.FindResources()
end end
else else
ExtractionHeli = Reinforcements.ReinforceWithTransport(greece, ExtractionHeliType, nil, ExtractionPath)[1] ExtractionHeli = Reinforcements.ReinforceWithTransport(Greece, ExtractionHeliType, nil, ExtractionPath)[1]
local exitPos = CPos.New(ExtractionPath[1].X, ExtractionPath[2].Y) local exitPos = CPos.New(ExtractionPath[1].X, ExtractionPath[2].Y)
Trigger.OnKilled(ExtractionHeli, function() ussr.MarkCompletedObjective(ussrObj) end) Trigger.OnKilled(ExtractionHeli, function() USSR.MarkCompletedObjective(USSRobjective) end)
Trigger.OnRemovedFromWorld(Tanya, function() Trigger.OnRemovedFromWorld(Tanya, function()
ExtractUnits(ExtractionHeli, exitPos, function() ExtractUnits(ExtractionHeli, exitPos, function()
Media.PlaySpeechNotification(greece, "TanyaRescued") Media.PlaySpeechNotification(Greece, "TanyaRescued")
greece.MarkCompletedObjective(mainObj) Greece.MarkCompletedObjective(RescueTanyaObjective)
Trigger.AfterDelay(DateTime.Seconds(2), function() Trigger.AfterDelay(DateTime.Seconds(2), function()
SendReinforcements() SendReinforcements()
end) end)
@@ -372,17 +372,17 @@ InitTriggers = function()
end end
AddObjectives = function() AddObjectives = function()
ussrObj = AddPrimaryObjective(ussr, "") USSRobjective = AddPrimaryObjective(USSR, "")
mainObj = AddPrimaryObjective(greece, "rescue-tanya") RescueTanyaObjective = AddPrimaryObjective(Greece, "rescue-tanya")
KillAll = AddPrimaryObjective(greece, "elminate-soviet-units") KillAll = AddPrimaryObjective(Greece, "elminate-soviet-units")
infWarfactory = AddSecondaryObjective(greece, "infiltrate-warfactory") InfiltrateWarfactoryObjective = AddSecondaryObjective(Greece, "infiltrate-warfactory")
end end
WorldLoaded = function() WorldLoaded = function()
greece = Player.GetPlayer("Greece") Greece = Player.GetPlayer("Greece")
ussr = Player.GetPlayer("USSR") USSR = Player.GetPlayer("USSR")
InitObjectives(greece) InitObjectives(Greece)
AddObjectives() AddObjectives()
InitTriggers() InitTriggers()
SendSpy() SendSpy()

View File

@@ -83,13 +83,13 @@ end
Attack = 0 Attack = 0
ProduceInfantry = function() ProduceInfantry = function()
if SovietBarracks.IsDead or SovietBarracks.Owner ~= ussr then if SovietBarracks.IsDead or SovietBarracks.Owner ~= USSR then
return return
end end
Attack = Attack + 1 Attack = Attack + 1
local toBuild = Utils.Random(InfTypes) local toBuild = Utils.Random(InfTypes)
ussr.Build(toBuild, function(units) USSR.Build(toBuild, function(units)
if Attack == 2 and not AttackTnk1.IsDead then if Attack == 2 and not AttackTnk1.IsDead then
units[#units + 1] = AttackTnk1 units[#units + 1] = AttackTnk1
elseif Attack == 4 and not AttackTnk2.IsDead then elseif Attack == 4 and not AttackTnk2.IsDead then
@@ -102,10 +102,10 @@ ProduceInfantry = function()
end end
ProduceVehicles = function() ProduceVehicles = function()
if WeaponsFactory.IsDead or WeaponsFactory.Owner ~= ussr then if WeaponsFactory.IsDead or WeaponsFactory.Owner ~= USSR then
return return
end end
ussr.Build(VehicleTypes, function(units) USSR.Build(VehicleTypes, function(units)
Utils.Do(units, function(unit) Utils.Do(units, function(unit)
if unit.Type ~= "harv" then if unit.Type ~= "harv" then
IdlingTanks[#IdlingTanks + 1] = unit IdlingTanks[#IdlingTanks + 1] = unit
@@ -115,18 +115,18 @@ ProduceVehicles = function()
end end
ProduceNaval = function() ProduceNaval = function()
if not shouldProduce and #Utils.Where(Map.ActorsInWorld, function(self) return self.Owner == player and self.Type == "syrd" end) < 1 then if not ShouldProduce and #Utils.Where(Map.ActorsInWorld, function(self) return self.Owner == Greece and self.Type == "syrd" end) < 1 then
Trigger.AfterDelay(DateTime.Minutes(1), ProduceNaval) Trigger.AfterDelay(DateTime.Minutes(1), ProduceNaval)
return return
end end
shouldProduce = true ShouldProduce = true
if SubPen.IsDead or SubPen.Owner ~= ussr then if SubPen.IsDead or SubPen.Owner ~= USSR then
return return
end end
ussr.Build(WaterAttackTypes, function(units) USSR.Build(WaterAttackTypes, function(units)
Utils.Do(units, function(unit) Utils.Do(units, function(unit)
IdlingNavalUnits[#IdlingNavalUnits + 1] = unit IdlingNavalUnits[#IdlingNavalUnits + 1] = unit
end) end)
@@ -141,11 +141,11 @@ ProduceNaval = function()
end end
ProduceAircraft = function() ProduceAircraft = function()
if Airfield.IsDead or Airfield.Owner ~= ussr then if Airfield.IsDead or Airfield.Owner ~= USSR then
return return
end end
ussr.Build(SovietAircraftType, function(units) USSR.Build(SovietAircraftType, function(units)
local yak = units[1] local yak = units[1]
Yaks[#Yaks + 1] = yak Yaks[#Yaks + 1] = yak
@@ -154,7 +154,7 @@ ProduceAircraft = function()
Trigger.AfterDelay(DateTime.Seconds(BuildDelays), ProduceAircraft) Trigger.AfterDelay(DateTime.Seconds(BuildDelays), ProduceAircraft)
end end
InitializeAttackAircraft(yak, player) InitializeAttackAircraft(yak, Greece)
end) end)
end end
@@ -185,7 +185,7 @@ end
WTransWaves = function() WTransWaves = function()
local way = Utils.Random(WTransWays) local way = Utils.Random(WTransWays)
local units = Utils.Random(WTransUnits) local units = Utils.Random(WTransUnits)
local attackUnits = Reinforcements.ReinforceWithTransport(ussr, "lst", units , way, { way[2], way[1] })[2] local attackUnits = Reinforcements.ReinforceWithTransport(USSR, "lst", units , way, { way[2], way[1] })[2]
Utils.Do(attackUnits, function(a) Utils.Do(attackUnits, function(a)
Trigger.OnAddedToWorld(a, function() Trigger.OnAddedToWorld(a, function()
a.AttackMove(UnitBStopLocation.Location) a.AttackMove(UnitBStopLocation.Location)

View File

@@ -95,41 +95,41 @@ InitialSovietPatrols = function()
end end
InitialAlliedReinforcements = function() InitialAlliedReinforcements = function()
local camera = Actor.Create("Camera", true, { Owner = player, Location = DefaultCameraPosition.Location }) local camera = Actor.Create("Camera", true, { Owner = Greece, Location = DefaultCameraPosition.Location })
Trigger.AfterDelay(DateTime.Seconds(30), camera.Destroy) Trigger.AfterDelay(DateTime.Seconds(30), camera.Destroy)
Reinforcements.Reinforce(player, AlliedReinforcementsA, { AlliedEntry1.Location, UnitBStopLocation.Location }, 2) Reinforcements.Reinforce(Greece, AlliedReinforcementsA, { AlliedEntry1.Location, UnitBStopLocation.Location }, 2)
Trigger.AfterDelay(DateTime.Seconds(2), function() Trigger.AfterDelay(DateTime.Seconds(2), function()
Reinforcements.Reinforce(player, AlliedReinforcementsB, { AlliedEntry2.Location, UnitAStopLocation.Location }, 2) Reinforcements.Reinforce(Greece, AlliedReinforcementsB, { AlliedEntry2.Location, UnitAStopLocation.Location }, 2)
end) end)
Trigger.AfterDelay(DateTime.Seconds(5), function() Trigger.AfterDelay(DateTime.Seconds(5), function()
Reinforcements.Reinforce(player, { "mcv" }, { AlliedEntry3.Location, MCVStopLocation.Location }) Reinforcements.Reinforce(Greece, { "mcv" }, { AlliedEntry3.Location, MCVStopLocation.Location })
end) end)
end end
CaptureRadarDome = function() CaptureRadarDome = function()
Trigger.OnKilled(RadarDome, function() Trigger.OnKilled(RadarDome, function()
player.MarkFailedObjective(CaptureRadarDomeObj) Greece.MarkFailedObjective(CaptureRadarDomeObj)
end) end)
Trigger.OnCapture(RadarDome, function() Trigger.OnCapture(RadarDome, function()
player.MarkCompletedObjective(CaptureRadarDomeObj) Greece.MarkCompletedObjective(CaptureRadarDomeObj)
Utils.Do(SovietTechLabs, function(a) Utils.Do(SovietTechLabs, function(a)
if a.IsDead then if a.IsDead then
return return
end end
Beacon.New(player, a.CenterPosition) Beacon.New(Greece, a.CenterPosition)
if Difficulty ~= "hard" then if Difficulty ~= "hard" then
Actor.Create("TECH.CAM", true, { Owner = player, Location = a.Location + CVec.New(1, 1) }) Actor.Create("TECH.CAM", true, { Owner = Greece, Location = a.Location + CVec.New(1, 1) })
end end
end) end)
Media.DisplayMessage(UserInterface.Translate("soviet-tech-centers-discovered")) Media.DisplayMessage(UserInterface.Translate("soviet-tech-centers-discovered"))
if Difficulty == "easy" then if Difficulty == "easy" then
Actor.Create("Camera", true, { Owner = player, Location = Weapcam.Location }) Actor.Create("Camera", true, { Owner = Greece, Location = Weapcam.Location })
end end
end) end)
end end
@@ -137,14 +137,14 @@ end
InfiltrateTechCenter = function() InfiltrateTechCenter = function()
Utils.Do(SovietTechLabs, function(a) Utils.Do(SovietTechLabs, function(a)
Trigger.OnInfiltrated(a, function() Trigger.OnInfiltrated(a, function()
if infiltrated then if Infiltrated then
return return
end end
infiltrated = true Infiltrated = true
DestroySovietsObj = AddPrimaryObjective(player, "destroy-soviet-buildings-units") DestroySovietsObj = AddPrimaryObjective(Greece, "destroy-soviet-buildings-units")
player.MarkCompletedObjective(InfiltrateTechCenterObj) Greece.MarkCompletedObjective(InfiltrateTechCenterObj)
local Proxy = Actor.Create("powerproxy.paratroopers", false, { Owner = ussr }) local Proxy = Actor.Create("powerproxy.paratroopers", false, { Owner = USSR })
Utils.Do(ParadropWaypoints[Difficulty], function(waypoint) Utils.Do(ParadropWaypoints[Difficulty], function(waypoint)
Proxy.TargetParatroopers(waypoint.CenterPosition, Angle.South) Proxy.TargetParatroopers(waypoint.CenterPosition, Angle.South)
end) end)
@@ -152,37 +152,37 @@ InfiltrateTechCenter = function()
end) end)
Trigger.OnCapture(a, function() Trigger.OnCapture(a, function()
if not infiltrated then if not Infiltrated then
Media.DisplayMessage(UserInterface.Translate("dont-capture-tech-centers")) Media.DisplayMessage(UserInterface.Translate("dont-capture-tech-centers"))
end end
end) end)
end) end)
Trigger.OnAllKilledOrCaptured(SovietTechLabs, function() Trigger.OnAllKilledOrCaptured(SovietTechLabs, function()
if not player.IsObjectiveCompleted(InfiltrateTechCenterObj) then if not Greece.IsObjectiveCompleted(InfiltrateTechCenterObj) then
player.MarkFailedObjective(InfiltrateTechCenterObj) Greece.MarkFailedObjective(InfiltrateTechCenterObj)
end end
end) end)
end end
Tick = function() Tick = function()
if DateTime.GameTime > DateTime.Seconds(10) and player.HasNoRequiredUnits() then if DateTime.GameTime > DateTime.Seconds(10) and Greece.HasNoRequiredUnits() then
player.MarkFailedObjective(InfiltrateTechCenterObj) Greece.MarkFailedObjective(InfiltrateTechCenterObj)
end end
if DestroySovietsObj and ussr.HasNoRequiredUnits() then if DestroySovietsObj and USSR.HasNoRequiredUnits() then
player.MarkCompletedObjective(DestroySovietsObj) Greece.MarkCompletedObjective(DestroySovietsObj)
end end
end end
WorldLoaded = function() WorldLoaded = function()
player = Player.GetPlayer("Greece") Greece = Player.GetPlayer("Greece")
ussr = Player.GetPlayer("USSR") USSR = Player.GetPlayer("USSR")
InitObjectives(player) InitObjectives(Greece)
InfiltrateTechCenterObj = AddPrimaryObjective(player, "infiltrate-tech-center-spy") InfiltrateTechCenterObj = AddPrimaryObjective(Greece, "infiltrate-tech-center-spy")
CaptureRadarDomeObj = AddSecondaryObjective(player, "capture-radar-shore") CaptureRadarDomeObj = AddSecondaryObjective(Greece, "capture-radar-shore")
Camera.Position = DefaultCameraPosition.CenterPosition Camera.Position = DefaultCameraPosition.CenterPosition
@@ -196,9 +196,9 @@ WorldLoaded = function()
end) end)
Trigger.OnEnteredProximityTrigger(SovietMiniBaseCam.CenterPosition, WDist.New(1024 * 6), function(a, id) Trigger.OnEnteredProximityTrigger(SovietMiniBaseCam.CenterPosition, WDist.New(1024 * 6), function(a, id)
if a.Owner == player then if a.Owner == Greece then
Trigger.RemoveProximityTrigger(id) Trigger.RemoveProximityTrigger(id)
local cam = Actor.Create("Camera", true, { Owner = player, Location = SovietMiniBaseCam.Location }) local cam = Actor.Create("Camera", true, { Owner = Greece, Location = SovietMiniBaseCam.Location })
Trigger.AfterDelay(DateTime.Seconds(15), cam.Destroy) Trigger.AfterDelay(DateTime.Seconds(15), cam.Destroy)
end end
end) end)

View File

@@ -93,13 +93,13 @@ end
Attack = 0 Attack = 0
ProduceInfantry = function() ProduceInfantry = function()
if SovietBarracks.IsDead or SovietBarracks.Owner ~= ussr then if SovietBarracks.IsDead or SovietBarracks.Owner ~= USSR then
return return
end end
Attack = Attack + 1 Attack = Attack + 1
local toBuild = Utils.Random(InfTypes) local toBuild = Utils.Random(InfTypes)
ussr.Build(toBuild, function(units) USSR.Build(toBuild, function(units)
if Attack == 2 and not AttackTank1.IsDead then if Attack == 2 and not AttackTank1.IsDead then
units[#units + 1] = AttackTank1 units[#units + 1] = AttackTank1
elseif Attack == 4 and not AttackTank2.IsDead then elseif Attack == 4 and not AttackTank2.IsDead then
@@ -112,10 +112,10 @@ ProduceInfantry = function()
end end
ProduceVehicles = function() ProduceVehicles = function()
if WarFactory.IsDead or WarFactory.Owner ~= ussr then if WarFactory.IsDead or WarFactory.Owner ~= USSR then
return return
end end
ussr.Build(VehicleTypes, function(units) USSR.Build(VehicleTypes, function(units)
Utils.Do(units, function(unit) Utils.Do(units, function(unit)
if unit.Type ~= "harv" then if unit.Type ~= "harv" then
IdlingTanks[#IdlingTanks + 1] = unit IdlingTanks[#IdlingTanks + 1] = unit
@@ -125,18 +125,18 @@ ProduceVehicles = function()
end end
ProduceNaval = function() ProduceNaval = function()
if SubPen.IsDead or SubPen.Owner ~= ussr then if SubPen.IsDead or SubPen.Owner ~= USSR then
return return
end end
if not shouldProduce and #Utils.Where(Map.ActorsInWorld, function(self) return self.Owner == player and self.Type == "syrd" end) < 1 then if not ShouldProduce and #Utils.Where(Map.ActorsInWorld, function(self) return self.Owner == Greece and self.Type == "syrd" end) < 1 then
Trigger.AfterDelay(DateTime.Minutes(1), ProduceNaval) Trigger.AfterDelay(DateTime.Minutes(1), ProduceNaval)
return return
end end
shouldProduce = true ShouldProduce = true
ussr.Build(WaterAttackTypes, function(units) USSR.Build(WaterAttackTypes, function(units)
Utils.Do(units, function(unit) Utils.Do(units, function(unit)
IdlingNavalUnits[#IdlingNavalUnits + 1] = unit IdlingNavalUnits[#IdlingNavalUnits + 1] = unit
end) end)
@@ -151,11 +151,11 @@ ProduceNaval = function()
end end
ProduceAircraft = function() ProduceAircraft = function()
if (Airfield1.IsDead or Airfield1.Owner ~= ussr) and (Airfield2.IsDead or Airfield2.Owner ~= ussr) then if (Airfield1.IsDead or Airfield1.Owner ~= USSR) and (Airfield2.IsDead or Airfield2.Owner ~= USSR) then
return return
end end
ussr.Build(SovietAircraftType, function(units) USSR.Build(SovietAircraftType, function(units)
local yak = units[1] local yak = units[1]
Yaks[#Yaks + 1] = yak Yaks[#Yaks + 1] = yak
@@ -166,7 +166,7 @@ ProduceAircraft = function()
Trigger.AfterDelay(DateTime.Seconds(BuildDelays / 2), ProduceAircraft) Trigger.AfterDelay(DateTime.Seconds(BuildDelays / 2), ProduceAircraft)
end end
InitializeAttackAircraft(yak, player) InitializeAttackAircraft(yak, Greece)
end) end)
end end
@@ -197,7 +197,7 @@ end
WTransWaves = function() WTransWaves = function()
local way = Utils.Random(WTransWays) local way = Utils.Random(WTransWays)
local units = Utils.Random(WTransUnits) local units = Utils.Random(WTransUnits)
local attackUnits = Reinforcements.ReinforceWithTransport(ussr, "lst", units , way, { way[2], way[1] })[2] local attackUnits = Reinforcements.ReinforceWithTransport(USSR, "lst", units , way, { way[2], way[1] })[2]
Utils.Do(attackUnits, function(a) Utils.Do(attackUnits, function(a)
Trigger.OnAddedToWorld(a, function() Trigger.OnAddedToWorld(a, function()
a.AttackMove(SovietBaseAttack.Location) a.AttackMove(SovietBaseAttack.Location)

View File

@@ -104,42 +104,42 @@ InitialSovietPatrols = function()
end end
InitialAlliedReinforcements = function() InitialAlliedReinforcements = function()
local camera = Actor.Create("Camera", true, { Owner = player, Location = DefaultCameraPosition.Location }) local camera = Actor.Create("Camera", true, { Owner = Greece, Location = DefaultCameraPosition.Location })
Trigger.AfterDelay(DateTime.Seconds(30), camera.Destroy) Trigger.AfterDelay(DateTime.Seconds(30), camera.Destroy)
Trigger.AfterDelay(DateTime.Seconds(1), function() Trigger.AfterDelay(DateTime.Seconds(1), function()
Reinforcements.Reinforce(player, AlliedReinforcementsA, { AlliedEntry3.Location, UnitCStopLocation.Location }, 2) Reinforcements.Reinforce(Greece, AlliedReinforcementsA, { AlliedEntry3.Location, UnitCStopLocation.Location }, 2)
Reinforcements.Reinforce(player, AlliedReinforcementsB, { AlliedEntry2.Location, UnitAStopLocation.Location }, 2) Reinforcements.Reinforce(Greece, AlliedReinforcementsB, { AlliedEntry2.Location, UnitAStopLocation.Location }, 2)
end) end)
Trigger.AfterDelay(DateTime.Seconds(3), function() Trigger.AfterDelay(DateTime.Seconds(3), function()
Reinforcements.Reinforce(player, { "mcv" }, { AlliedEntry1.Location, UnitBStopLocation.Location }) Reinforcements.Reinforce(Greece, { "mcv" }, { AlliedEntry1.Location, UnitBStopLocation.Location })
Reinforcements.Reinforce(player, AlliedBoatReinforcements, { AlliedBoatEntry.Location, AlliedBoatStop.Location }) Reinforcements.Reinforce(Greece, AlliedBoatReinforcements, { AlliedBoatEntry.Location, AlliedBoatStop.Location })
end) end)
end end
CaptureRadarDome = function() CaptureRadarDome = function()
Trigger.OnKilled(RadarDome, function() Trigger.OnKilled(RadarDome, function()
player.MarkFailedObjective(CaptureRadarDomeObj) Greece.MarkFailedObjective(CaptureRadarDomeObj)
end) end)
Trigger.OnCapture(RadarDome, function() Trigger.OnCapture(RadarDome, function()
player.MarkCompletedObjective(CaptureRadarDomeObj) Greece.MarkCompletedObjective(CaptureRadarDomeObj)
Utils.Do(SovietTechLabs, function(a) Utils.Do(SovietTechLabs, function(a)
if a.IsDead then if a.IsDead then
return return
end end
Beacon.New(player, a.CenterPosition) Beacon.New(Greece, a.CenterPosition)
if Difficulty ~= "hard" then if Difficulty ~= "hard" then
Actor.Create("TECH.CAM", true, { Owner = player, Location = a.Location + CVec.New(1, 1) }) Actor.Create("TECH.CAM", true, { Owner = Greece, Location = a.Location + CVec.New(1, 1) })
end end
end) end)
Media.DisplayMessage(UserInterface.Translate("soviet-tech-centers-discovered")) Media.DisplayMessage(UserInterface.Translate("soviet-tech-centers-discovered"))
if Difficulty == "easy" then if Difficulty == "easy" then
Actor.Create("Camera", true, { Owner = player, Location = Weapcam.Location }) Actor.Create("Camera", true, { Owner = Greece, Location = Weapcam.Location })
end end
end) end)
end end
@@ -147,61 +147,61 @@ end
InfiltrateTechCenter = function() InfiltrateTechCenter = function()
Utils.Do(SovietTechLabs, function(a) Utils.Do(SovietTechLabs, function(a)
Trigger.OnInfiltrated(a, function() Trigger.OnInfiltrated(a, function()
if infiltrated then if Infiltrated then
return return
end end
infiltrated = true Infiltrated = true
DestroySovietsObj = AddPrimaryObjective(player, "destroy-soviet-buildings-units") DestroySovietsObj = AddPrimaryObjective(Greece, "destroy-soviet-buildings-units")
player.MarkCompletedObjective(InfiltrateTechCenterObj) Greece.MarkCompletedObjective(InfiltrateTechCenterObj)
end) end)
Trigger.OnCapture(a, function() Trigger.OnCapture(a, function()
if not infiltrated then if not Infiltrated then
Media.DisplayMessage(UserInterface.Translate("dont-capture-tech-centers")) Media.DisplayMessage(UserInterface.Translate("dont-capture-tech-centers"))
end end
end) end)
end) end)
Trigger.OnAllKilledOrCaptured(SovietTechLabs, function() Trigger.OnAllKilledOrCaptured(SovietTechLabs, function()
if not player.IsObjectiveCompleted(InfiltrateTechCenterObj) then if not Greece.IsObjectiveCompleted(InfiltrateTechCenterObj) then
player.MarkFailedObjective(InfiltrateTechCenterObj) Greece.MarkFailedObjective(InfiltrateTechCenterObj)
end end
end) end)
end end
Tick = function() Tick = function()
if player.HasNoRequiredUnits() then if Greece.HasNoRequiredUnits() then
player.MarkFailedObjective(InfiltrateTechCenterObj) Greece.MarkFailedObjective(InfiltrateTechCenterObj)
end end
if DestroySovietsObj and ussr.HasNoRequiredUnits() then if DestroySovietsObj and USSR.HasNoRequiredUnits() then
player.MarkCompletedObjective(DestroySovietsObj) Greece.MarkCompletedObjective(DestroySovietsObj)
end end
end end
WorldLoaded = function() WorldLoaded = function()
player = Player.GetPlayer("Greece") Greece = Player.GetPlayer("Greece")
ussr = Player.GetPlayer("USSR") USSR = Player.GetPlayer("USSR")
InitObjectives(player) InitObjectives(Greece)
InfiltrateTechCenterObj = AddPrimaryObjective(player, "infiltrate-tech-center-spy") InfiltrateTechCenterObj = AddPrimaryObjective(Greece, "infiltrate-tech-center-spy")
CaptureRadarDomeObj = AddSecondaryObjective(player, "capture-radar-shore") CaptureRadarDomeObj = AddSecondaryObjective(Greece, "capture-radar-shore")
Camera.Position = DefaultCameraPosition.CenterPosition Camera.Position = DefaultCameraPosition.CenterPosition
if Difficulty == "easy" then if Difficulty == "easy" then
Trigger.OnEnteredProximityTrigger(SovietDefenseCam.CenterPosition, WDist.New(1024 * 7), function(a, id) Trigger.OnEnteredProximityTrigger(SovietDefenseCam.CenterPosition, WDist.New(1024 * 7), function(a, id)
if a.Owner == player then if a.Owner == Greece then
Trigger.RemoveProximityTrigger(id) Trigger.RemoveProximityTrigger(id)
local cam1 = Actor.Create("TECH.CAM", true, { Owner = player, Location = SovietDefenseCam.Location }) local cam1 = Actor.Create("TECH.CAM", true, { Owner = Greece, Location = SovietDefenseCam.Location })
Trigger.AfterDelay(DateTime.Seconds(15), cam1.Destroy) Trigger.AfterDelay(DateTime.Seconds(15), cam1.Destroy)
if not DefenseFlame1.IsDead then if not DefenseFlame1.IsDead then
local cam2 = Actor.Create("TECH.CAM", true, { Owner = player, Location = DefenseFlame1.Location }) local cam2 = Actor.Create("TECH.CAM", true, { Owner = Greece, Location = DefenseFlame1.Location })
Trigger.AfterDelay(DateTime.Seconds(15), cam2.Destroy) Trigger.AfterDelay(DateTime.Seconds(15), cam2.Destroy)
end end
if not DefenseFlame2.IsDead then if not DefenseFlame2.IsDead then
local cam3 = Actor.Create("TECH.CAM", true, { Owner = player, Location = DefenseFlame2.Location }) local cam3 = Actor.Create("TECH.CAM", true, { Owner = Greece, Location = DefenseFlame2.Location })
Trigger.AfterDelay(DateTime.Seconds(15), cam3.Destroy) Trigger.AfterDelay(DateTime.Seconds(15), cam3.Destroy)
end end
end end
@@ -231,9 +231,9 @@ WorldLoaded = function()
end) end)
Trigger.OnEnteredProximityTrigger(SovietMiniBaseCam.CenterPosition, WDist.New(1024 * 14), function(a, id) Trigger.OnEnteredProximityTrigger(SovietMiniBaseCam.CenterPosition, WDist.New(1024 * 14), function(a, id)
if a.Owner == player then if a.Owner == Greece then
Trigger.RemoveProximityTrigger(id) Trigger.RemoveProximityTrigger(id)
local cam = Actor.Create("Camera", true, { Owner = player, Location = SovietMiniBaseCam.Location }) local cam = Actor.Create("Camera", true, { Owner = Greece, Location = SovietMiniBaseCam.Location })
Trigger.AfterDelay(DateTime.Seconds(15), cam.Destroy) Trigger.AfterDelay(DateTime.Seconds(15), cam.Destroy)
end end
end) end)

View File

@@ -64,11 +64,11 @@ SendBGAttackGroup = function()
end end
ProduceBadGuyInfantry = function() ProduceBadGuyInfantry = function()
if BadGuyRax.IsDead or BadGuyRax.Owner ~= badguy then if BadGuyRax.IsDead or BadGuyRax.Owner ~= BadGuy then
return return
end end
badguy.Build({ Utils.Random(SovietInfantry) }, function(units) BadGuy.Build({ Utils.Random(SovietInfantry) }, function(units)
table.insert(BGAttackGroup, units[1]) table.insert(BGAttackGroup, units[1])
SendBGAttackGroup() SendBGAttackGroup()
Trigger.AfterDelay(ProductionInterval[Difficulty], ProduceBadGuyInfantry) Trigger.AfterDelay(ProductionInterval[Difficulty], ProduceBadGuyInfantry)
@@ -90,11 +90,11 @@ SendAttackGroup = function()
end end
ProduceUSSRInfantry = function() ProduceUSSRInfantry = function()
if USSRRax.IsDead or USSRRax.Owner ~= ussr then if USSRRax.IsDead or USSRRax.Owner ~= USSR then
return return
end end
ussr.Build({ Utils.Random(SovietInfantry) }, function(units) USSR.Build({ Utils.Random(SovietInfantry) }, function(units)
table.insert(AttackGroup, units[1]) table.insert(AttackGroup, units[1])
SendAttackGroup() SendAttackGroup()
Trigger.AfterDelay(ProductionInterval[Difficulty], ProduceUSSRInfantry) Trigger.AfterDelay(ProductionInterval[Difficulty], ProduceUSSRInfantry)
@@ -102,11 +102,11 @@ ProduceUSSRInfantry = function()
end end
ProduceVehicles = function() ProduceVehicles = function()
if USSRWarFactory.IsDead or USSRWarFactory.Owner ~= ussr then if USSRWarFactory.IsDead or USSRWarFactory.Owner ~= USSR then
return return
end end
ussr.Build({ Utils.Random(SovietVehicles) }, function(units) USSR.Build({ Utils.Random(SovietVehicles) }, function(units)
table.insert(AttackGroup, units[1]) table.insert(AttackGroup, units[1])
SendAttackGroup() SendAttackGroup()
Trigger.AfterDelay(ProductionInterval[Difficulty], ProduceVehicles) Trigger.AfterDelay(ProductionInterval[Difficulty], ProduceVehicles)
@@ -114,11 +114,11 @@ ProduceVehicles = function()
end end
ProduceAircraft = function() ProduceAircraft = function()
if (Airfield1.IsDead or Airfield1.Owner ~= ussr) and (Airfield2.IsDead or Airfield2.Owner ~= ussr) and (Airfield3.IsDead or Airfield3.Owner ~= ussr) and (Airfield4.IsDead or Airfield4.Owner ~= ussr) then if (Airfield1.IsDead or Airfield1.Owner ~= USSR) and (Airfield2.IsDead or Airfield2.Owner ~= USSR) and (Airfield3.IsDead or Airfield3.Owner ~= USSR) and (Airfield4.IsDead or Airfield4.Owner ~= USSR) then
return return
end end
ussr.Build(SovietAircraftType, function(units) USSR.Build(SovietAircraftType, function(units)
local yak = units[1] local yak = units[1]
Yaks[#Yaks + 1] = yak Yaks[#Yaks + 1] = yak
@@ -129,17 +129,17 @@ ProduceAircraft = function()
Trigger.AfterDelay(DateTime.Seconds(ProductionInterval[Difficulty] / 2), ProduceAircraft) Trigger.AfterDelay(DateTime.Seconds(ProductionInterval[Difficulty] / 2), ProduceAircraft)
end end
InitializeAttackAircraft(yak, greece) InitializeAttackAircraft(yak, Greece)
end) end)
end end
ActivateAI = function() ActivateAI = function()
SovietVehicles = SovietVehicles[Difficulty] SovietVehicles = SovietVehicles[Difficulty]
local buildings = Utils.Where(Map.ActorsInWorld, function(self) return self.Owner == ussr and self.HasProperty("StartBuildingRepairs") end) local buildings = Utils.Where(Map.ActorsInWorld, function(self) return self.Owner == USSR and self.HasProperty("StartBuildingRepairs") end)
Utils.Do(buildings, function(actor) Utils.Do(buildings, function(actor)
Trigger.OnDamaged(actor, function(building) Trigger.OnDamaged(actor, function(building)
if building.Owner == ussr and building.Health < building.MaxHealth * 3/4 then if building.Owner == USSR and building.Health < building.MaxHealth * 3/4 then
building.StartBuildingRepairs() building.StartBuildingRepairs()
end end
end) end)

View File

@@ -11,7 +11,7 @@ ClearSubActivityTriggerActivator = { Sub1, Sub2, Sub3, Sub4, Sub5, Sub6, Sub7, S
AlliedGunboats = { "pt", "pt", "pt" } AlliedGunboats = { "pt", "pt", "pt" }
BeachRifles = { BeachRifle1, BeachRifle2, BeachRifle3, BeachRifle4 } BeachRifles = { BeachRifle1, BeachRifle2, BeachRifle3, BeachRifle4 }
lstReinforcements = LstReinforcements =
{ {
first = first =
{ {
@@ -42,15 +42,15 @@ RaidTwoPath = { RaidTwoEntry.Location, RaidTwoLanding.Location }
StartTimer = false StartTimer = false
TimerColor = Player.GetPlayer("USSR").Color TimerColor = Player.GetPlayer("USSR").Color
TimerTicks = DateTime.Minutes(10) TimerTicks = DateTime.Minutes(10)
ticked = TimerTicks Ticked = TimerTicks
StartTimerDelay = DateTime.Minutes(5) StartTimerDelay = DateTime.Minutes(5)
InitialAlliedReinforcements = function() InitialAlliedReinforcements = function()
Trigger.AfterDelay(DateTime.Seconds(1), function() Trigger.AfterDelay(DateTime.Seconds(1), function()
Reinforcements.Reinforce(greece, AlliedGunboats, { GunboatEntry.Location, waypoint42.Location }, 2) Reinforcements.Reinforce(Greece, AlliedGunboats, { GunboatEntry.Location, waypoint42.Location }, 2)
Media.PlaySpeechNotification(greece, "ReinforcementsArrived") Media.PlaySpeechNotification(Greece, "ReinforcementsArrived")
local reinforcement = lstReinforcements.first local reinforcement = LstReinforcements.first
Reinforcements.ReinforceWithTransport(greece, "lst.reinforcement", reinforcement.actors, reinforcement.entryPath, reinforcement.exitPath) Reinforcements.ReinforceWithTransport(Greece, "lst.reinforcement", reinforcement.actors, reinforcement.entryPath, reinforcement.exitPath)
end) end)
end end
@@ -64,19 +64,19 @@ end
SecondAlliedLanding = function() SecondAlliedLanding = function()
Trigger.AfterDelay(DateTime.Minutes(1), function() Trigger.AfterDelay(DateTime.Minutes(1), function()
Media.PlaySpeechNotification(greece, "ReinforcementsArrived") Media.PlaySpeechNotification(Greece, "ReinforcementsArrived")
local reinforcement = lstReinforcements.second local reinforcement = LstReinforcements.second
Reinforcements.ReinforceWithTransport(greece, "lst.reinforcement", reinforcement.actors, reinforcement.entryPath, reinforcement.exitPath) Reinforcements.ReinforceWithTransport(Greece, "lst.reinforcement", reinforcement.actors, reinforcement.entryPath, reinforcement.exitPath)
end) end)
end end
CaptureRadarDome = function() CaptureRadarDome = function()
Trigger.OnKilled(RadarDome, function() Trigger.OnKilled(RadarDome, function()
greece.MarkFailedObjective(CaptureRadarDomeObj) Greece.MarkFailedObjective(CaptureRadarDomeObj)
end) end)
Trigger.OnCapture(RadarDome, function() Trigger.OnCapture(RadarDome, function()
greece.MarkCompletedObjective(CaptureRadarDomeObj) Greece.MarkCompletedObjective(CaptureRadarDomeObj)
BaseRaids() BaseRaids()
end) end)
end end
@@ -86,7 +86,7 @@ BaseRaids = function()
return return
else else
Trigger.AfterDelay(Utils.RandomInteger(BaseRaidDelay1[1], BaseRaidDelay1[2]), function() Trigger.AfterDelay(Utils.RandomInteger(BaseRaidDelay1[1], BaseRaidDelay1[2]), function()
local raiders = Reinforcements.ReinforceWithTransport(ussr, "lst", RaidingParty, RaidOnePath, { RaidOneEntry.Location })[2] local raiders = Reinforcements.ReinforceWithTransport(USSR, "lst", RaidingParty, RaidOnePath, { RaidOneEntry.Location })[2]
Utils.Do(raiders, function(a) Utils.Do(raiders, function(a)
Trigger.OnAddedToWorld(a, function() Trigger.OnAddedToWorld(a, function()
a.AttackMove(PlayerBase.Location) a.AttackMove(PlayerBase.Location)
@@ -96,7 +96,7 @@ BaseRaids = function()
end) end)
Trigger.AfterDelay(Utils.RandomInteger(BaseRaidDelay2[1], BaseRaidDelay2[2]), function() Trigger.AfterDelay(Utils.RandomInteger(BaseRaidDelay2[1], BaseRaidDelay2[2]), function()
local raiders = Reinforcements.ReinforceWithTransport(ussr, "lst", RaidingParty, RaidTwoPath, { RaidTwoEntry.Location })[2] local raiders = Reinforcements.ReinforceWithTransport(USSR, "lst", RaidingParty, RaidTwoPath, { RaidTwoEntry.Location })[2]
Utils.Do(raiders, function(a) Utils.Do(raiders, function(a)
Trigger.OnAddedToWorld(a, function() Trigger.OnAddedToWorld(a, function()
a.AttackMove(PlayerBase.Location) a.AttackMove(PlayerBase.Location)
@@ -110,7 +110,7 @@ end
StartTimerFunction = function() StartTimerFunction = function()
if Difficulty == "hard" then if Difficulty == "hard" then
StartTimer = true StartTimer = true
Media.PlaySpeechNotification(greece, "TimerStarted") Media.PlaySpeechNotification(Greece, "TimerStarted")
end end
end end
@@ -138,10 +138,10 @@ BattalionWays =
} }
SendArmoredBattalion = function() SendArmoredBattalion = function()
Media.PlaySpeechNotification(greece, "EnemyUnitsApproaching") Media.PlaySpeechNotification(Greece, "EnemyUnitsApproaching")
Utils.Do(BattalionWays, function(way) Utils.Do(BattalionWays, function(way)
local units = { "3tnk", "3tnk", "3tnk", "4tnk", "4tnk" } local units = { "3tnk", "3tnk", "3tnk", "4tnk", "4tnk" }
local armor = Reinforcements.ReinforceWithTransport(ussr, "lst", units , way, { way[2], way[1] })[2] local armor = Reinforcements.ReinforceWithTransport(USSR, "lst", units , way, { way[2], way[1] })[2]
Utils.Do(armor, function(a) Utils.Do(armor, function(a)
Trigger.OnAddedToWorld(a, function() Trigger.OnAddedToWorld(a, function()
a.AttackMove(PlayerBase.Location) a.AttackMove(PlayerBase.Location)
@@ -152,50 +152,50 @@ SendArmoredBattalion = function()
end end
DestroySubPensCompleted = function() DestroySubPensCompleted = function()
greece.MarkCompletedObjective(DestroySubPens) Greece.MarkCompletedObjective(DestroySubPens)
end end
ClearSubActivityCompleted = function() ClearSubActivityCompleted = function()
greece.MarkCompletedObjective(ClearSubActivity) Greece.MarkCompletedObjective(ClearSubActivity)
end end
Tick = function() Tick = function()
ussr.Cash = 5000 USSR.Cash = 5000
badguy.Cash = 500 BadGuy.Cash = 500
if StartTimer then if StartTimer then
if ticked > 0 then if Ticked > 0 then
if (ticked % DateTime.Seconds(1)) == 0 then if (Ticked % DateTime.Seconds(1)) == 0 then
Timer = UserInterface.Translate("soviet-armored-battalion-arrives-in", { ["time"] = Utils.FormatTime(ticked) }) Timer = UserInterface.Translate("soviet-armored-battalion-arrives-in", { ["time"] = Utils.FormatTime(Ticked) })
UserInterface.SetMissionText(Timer, TimerColor) UserInterface.SetMissionText(Timer, TimerColor)
end end
ticked = ticked - 1 Ticked = Ticked - 1
elseif ticked == 0 then elseif Ticked == 0 then
FinishTimer() FinishTimer()
SendArmoredBattalion() SendArmoredBattalion()
ticked = ticked - 1 Ticked = Ticked - 1
end end
end end
if greece.HasNoRequiredUnits() then if Greece.HasNoRequiredUnits() then
ussr.MarkCompletedObjective(BeatAllies) USSR.MarkCompletedObjective(BeatAllies)
end end
end end
WorldLoaded = function() WorldLoaded = function()
greece = Player.GetPlayer("Greece") Greece = Player.GetPlayer("Greece")
ussr = Player.GetPlayer("USSR") USSR = Player.GetPlayer("USSR")
badguy = Player.GetPlayer("BadGuy") BadGuy = Player.GetPlayer("BadGuy")
Camera.Position = DefaultCameraPosition.CenterPosition Camera.Position = DefaultCameraPosition.CenterPosition
InitObjectives(greece) InitObjectives(Greece)
CaptureRadarDomeObj = AddPrimaryObjective(greece, "capture-radar-dome") CaptureRadarDomeObj = AddPrimaryObjective(Greece, "capture-radar-dome")
DestroySubPens = AddPrimaryObjective(greece, "destroy-all-soviet-sub-pens") DestroySubPens = AddPrimaryObjective(Greece, "destroy-all-soviet-sub-pens")
ClearSubActivity = AddSecondaryObjective(greece, "clear-area-all-subs") ClearSubActivity = AddSecondaryObjective(Greece, "clear-area-all-subs")
BeatAllies = AddPrimaryObjective(ussr, "") BeatAllies = AddPrimaryObjective(USSR, "")
PowerProxy = Actor.Create("powerproxy.paratroopers", false, { Owner = ussr }) PowerProxy = Actor.Create("powerproxy.paratroopers", false, { Owner = USSR })
InitialAlliedReinforcements() InitialAlliedReinforcements()
SecondAlliedLanding() SecondAlliedLanding()

View File

@@ -84,11 +84,11 @@ SendAttackGroup = function()
end end
ProduceInfantry = function() ProduceInfantry = function()
if USSRRax.IsDead or USSRRax.Owner ~= ussr then if USSRRax.IsDead or USSRRax.Owner ~= USSR then
return return
end end
ussr.Build({ Utils.Random(SovietInfantry) }, function(units) USSR.Build({ Utils.Random(SovietInfantry) }, function(units)
table.insert(AttackGroup, units[1]) table.insert(AttackGroup, units[1])
SendAttackGroup() SendAttackGroup()
Trigger.AfterDelay(ProductionInterval[Difficulty], ProduceInfantry) Trigger.AfterDelay(ProductionInterval[Difficulty], ProduceInfantry)
@@ -96,11 +96,11 @@ ProduceInfantry = function()
end end
ProduceVehicles = function() ProduceVehicles = function()
if USSRWarFactory.IsDead or USSRWarFactory.Owner ~= ussr then if USSRWarFactory.IsDead or USSRWarFactory.Owner ~= USSR then
return return
end end
ussr.Build({ Utils.Random(SovietVehicles) }, function(units) USSR.Build({ Utils.Random(SovietVehicles) }, function(units)
table.insert(AttackGroup, units[1]) table.insert(AttackGroup, units[1])
SendAttackGroup() SendAttackGroup()
Trigger.AfterDelay(ProductionInterval[Difficulty], ProduceVehicles) Trigger.AfterDelay(ProductionInterval[Difficulty], ProduceVehicles)
@@ -108,11 +108,11 @@ ProduceVehicles = function()
end end
ProduceAircraft = function() ProduceAircraft = function()
if (Airfield1.IsDead or Airfield1.Owner ~= ussr) and (Airfield2.IsDead or Airfield2.Owner ~= ussr) then if (Airfield1.IsDead or Airfield1.Owner ~= USSR) and (Airfield2.IsDead or Airfield2.Owner ~= USSR) then
return return
end end
ussr.Build(SovietAircraftType, function(units) USSR.Build(SovietAircraftType, function(units)
local mig = units[1] local mig = units[1]
Migs[#Migs + 1] = mig Migs[#Migs + 1] = mig
@@ -123,13 +123,13 @@ ProduceAircraft = function()
Trigger.AfterDelay(DateTime.Seconds(ProductionInterval[Difficulty] / 2), ProduceAircraft) Trigger.AfterDelay(DateTime.Seconds(ProductionInterval[Difficulty] / 2), ProduceAircraft)
end end
InitializeAttackAircraft(mig, greece) InitializeAttackAircraft(mig, Greece)
end) end)
end end
GroundWaves = function() GroundWaves = function()
local path = Utils.Random(GroundAttackPaths) local path = Utils.Random(GroundAttackPaths)
local units = Reinforcements.Reinforce(ussr, Utils.Random(GroundAttackUnits[GroundAttackUnitType]), { path[1] }) local units = Reinforcements.Reinforce(USSR, Utils.Random(GroundAttackUnits[GroundAttackUnitType]), { path[1] })
local lastWaypoint = path[#path] local lastWaypoint = path[#path]
Utils.Do(units, function(unit) Utils.Do(units, function(unit)
Trigger.OnAddedToWorld(unit, function() Trigger.OnAddedToWorld(unit, function()
@@ -146,7 +146,7 @@ end
WTransWaves = function() WTransWaves = function()
local way = Utils.Random(WTransWays) local way = Utils.Random(WTransWays)
local units = Utils.Random(WTransUnits) local units = Utils.Random(WTransUnits)
local attackUnits = Reinforcements.ReinforceWithTransport(ussr, "lst", units , way, { way[2], way[1] })[2] local attackUnits = Reinforcements.ReinforceWithTransport(USSR, "lst", units , way, { way[2], way[1] })[2]
Utils.Do(attackUnits, function(a) Utils.Do(attackUnits, function(a)
Trigger.OnAddedToWorld(a, function() Trigger.OnAddedToWorld(a, function()
a.AttackMove(AttackChrono.Location) a.AttackMove(AttackChrono.Location)
@@ -169,15 +169,15 @@ end
SendParabombs = function() SendParabombs = function()
local airfield = Airfield1 local airfield = Airfield1
if Airfield1.IsDead or Airfield1.Owner ~= ussr then if Airfield1.IsDead or Airfield1.Owner ~= USSR then
if Airfield2.IsDead or Airfield2.Owner ~= ussr then if Airfield2.IsDead or Airfield2.Owner ~= USSR then
return return
end end
airfield = Airfield2 airfield = Airfield2
end end
local targets = Utils.Where(greece.GetActors(), function(actor) local targets = Utils.Where(Greece.GetActors(), function(actor)
return return
actor.HasProperty("Sell") and actor.HasProperty("Sell") and
actor.Type ~= "brik" and actor.Type ~= "brik" and
@@ -199,10 +199,10 @@ ActivateAI = function()
ParadropDelays = ParadropDelays[Difficulty] ParadropDelays = ParadropDelays[Difficulty]
BombDelays = BombDelays[Difficulty] BombDelays = BombDelays[Difficulty]
local buildings = Utils.Where(Map.ActorsInWorld, function(self) return self.Owner == ussr and self.HasProperty("StartBuildingRepairs") end) local buildings = Utils.Where(Map.ActorsInWorld, function(self) return self.Owner == USSR and self.HasProperty("StartBuildingRepairs") end)
Utils.Do(buildings, function(actor) Utils.Do(buildings, function(actor)
Trigger.OnDamaged(actor, function(building) Trigger.OnDamaged(actor, function(building)
if building.Owner == ussr and building.Health < building.MaxHealth * 3/4 then if building.Owner == USSR and building.Health < building.MaxHealth * 3/4 then
building.StartBuildingRepairs() building.StartBuildingRepairs()
end end
end) end)

View File

@@ -15,33 +15,33 @@ ScientistEvacuationFootprint = { CPos.New(29, 60), CPos.New(29, 61), CPos.New(29
InitialAlliedReinforcements = function() InitialAlliedReinforcements = function()
Trigger.AfterDelay(DateTime.Seconds(2), function() Trigger.AfterDelay(DateTime.Seconds(2), function()
Media.PlaySpeechNotification(greece, "ReinforcementsArrived") Media.PlaySpeechNotification(Greece, "ReinforcementsArrived")
Reinforcements.Reinforce(greece, { "mcv" }, { MCVEntry.Location, MCVStop.Location }) Reinforcements.Reinforce(Greece, { "mcv" }, { MCVEntry.Location, MCVStop.Location })
Reinforcements.Reinforce(greece, AlliedBoatReinforcements, { DDEntry.Location, DDStop.Location }) Reinforcements.Reinforce(Greece, AlliedBoatReinforcements, { DDEntry.Location, DDStop.Location })
end) end)
end end
CreateScientists = function() CreateScientists = function()
scientists = Reinforcements.Reinforce(greece, ScientistTypes, { ScientistsExit.Location }) local scientists = Reinforcements.Reinforce(Greece, ScientistTypes, { ScientistsExit.Location })
Utils.Do(scientists, function(s) Utils.Do(scientists, function(s)
s.Move(s.Location + CVec.New(0, 1)) s.Move(s.Location + CVec.New(0, 1))
s.Scatter() s.Scatter()
end) end)
local flare = Actor.Create("flare", true, { Owner = greece, Location = DefaultCameraPosition.Location + CVec.New(-1, 0) }) local flare = Actor.Create("flare", true, { Owner = Greece, Location = DefaultCameraPosition.Location + CVec.New(-1, 0) })
Trigger.AfterDelay(DateTime.Seconds(2), function() Media.PlaySpeechNotification(player, "SignalFlareNorth") end) Trigger.AfterDelay(DateTime.Seconds(2), function() Media.PlaySpeechNotification(Greece, "SignalFlareNorth") end)
Trigger.OnAnyKilled(scientists, function() Trigger.OnAnyKilled(scientists, function()
Media.PlaySpeechNotification(greece, "ObjectiveNotMet") Media.PlaySpeechNotification(Greece, "ObjectiveNotMet")
greece.MarkFailedObjective(EvacuateScientists) Greece.MarkFailedObjective(EvacuateScientists)
end) end)
-- Add the footprint trigger in a frame end task (delay 0) to avoid crashes -- Add the footprint trigger in a frame end task (delay 0) to avoid crashes
local left = #scientists local left = #scientists
Trigger.AfterDelay(0, function() Trigger.AfterDelay(0, function()
local changeOwnerTrigger = Trigger.OnEnteredFootprint(ScientistEvacuationFootprint, function(a, id) local changeOwnerTrigger = Trigger.OnEnteredFootprint(ScientistEvacuationFootprint, function(a, id)
if a.Owner == greece and a.Type == "chan" then if a.Owner == Greece and a.Type == "chan" then
a.Owner = germany a.Owner = Germany
a.Stop() a.Stop()
a.Move(MCVEntry.Location) a.Move(MCVEntry.Location)
@@ -54,7 +54,7 @@ CreateScientists = function()
-- Use a cell trigger to destroy the scientists preventing the player from causing glitchs by blocking the path -- Use a cell trigger to destroy the scientists preventing the player from causing glitchs by blocking the path
Trigger.OnEnteredFootprint({ MCVEntry.Location }, function(a, id) Trigger.OnEnteredFootprint({ MCVEntry.Location }, function(a, id)
if a.Owner == germany then if a.Owner == Germany then
a.Stop() a.Stop()
a.Destroy() a.Destroy()
@@ -64,9 +64,9 @@ CreateScientists = function()
Trigger.RemoveFootprintTrigger(changeOwnerTrigger) Trigger.RemoveFootprintTrigger(changeOwnerTrigger)
flare.Destroy() flare.Destroy()
if not greece.IsObjectiveCompleted(EvacuateScientists) and not greece.IsObjectiveFailed(EvacuateScientists) then if not Greece.IsObjectiveCompleted(EvacuateScientists) and not Greece.IsObjectiveFailed(EvacuateScientists) then
Media.PlaySpeechNotification(greece, "ObjectiveMet") Media.PlaySpeechNotification(Greece, "ObjectiveMet")
greece.MarkCompletedObjective(EvacuateScientists) Greece.MarkCompletedObjective(EvacuateScientists)
end end
end end
end end
@@ -78,84 +78,84 @@ DefendChronosphereCompleted = function()
local cells = Utils.ExpandFootprint({ ChronoshiftLocation.Location }, false) local cells = Utils.ExpandFootprint({ ChronoshiftLocation.Location }, false)
local units = { } local units = { }
for i = 1, #cells do for i = 1, #cells do
local unit = Actor.Create("2tnk", true, { Owner = greece, Facing = Angle.North }) local unit = Actor.Create("2tnk", true, { Owner = Greece, Facing = Angle.North })
units[unit] = cells[i] units[unit] = cells[i]
end end
Chronosphere.Chronoshift(units) Chronosphere.Chronoshift(units)
UserInterface.SetMissionText(UserInterface.Translate("experiment-successful"), greece.Color) UserInterface.SetMissionText(UserInterface.Translate("experiment-successful"), Greece.Color)
Trigger.AfterDelay(DateTime.Seconds(3), function() Trigger.AfterDelay(DateTime.Seconds(3), function()
greece.MarkCompletedObjective(DefendChronosphere) Greece.MarkCompletedObjective(DefendChronosphere)
greece.MarkCompletedObjective(KeepBasePowered) Greece.MarkCompletedObjective(KeepBasePowered)
end) end)
end end
ticked = TimerTicks Ticked = TimerTicks
Tick = function() Tick = function()
ussr.Cash = 5000 USSR.Cash = 5000
if ussr.HasNoRequiredUnits() then if USSR.HasNoRequiredUnits() then
greece.MarkCompletedObjective(DefendChronosphere) Greece.MarkCompletedObjective(DefendChronosphere)
greece.MarkCompletedObjective(KeepBasePowered) Greece.MarkCompletedObjective(KeepBasePowered)
end end
if greece.HasNoRequiredUnits() then if Greece.HasNoRequiredUnits() then
ussr.MarkCompletedObjective(BeatAllies) USSR.MarkCompletedObjective(BeatAllies)
end end
if ticked > 0 then if Ticked > 0 then
if (ticked % DateTime.Seconds(1)) == 0 then if (Ticked % DateTime.Seconds(1)) == 0 then
Timer = UserInterface.Translate("chronosphere-experiments-completes-in", { ["time"] = Utils.FormatTime(ticked) }) Timer = UserInterface.Translate("chronosphere-experiments-completes-in", { ["time"] = Utils.FormatTime(Ticked) })
UserInterface.SetMissionText(Timer, TimerColor) UserInterface.SetMissionText(Timer, TimerColor)
end end
ticked = ticked - 1 Ticked = Ticked - 1
elseif ticked == 0 and (greece.PowerState ~= "Normal") then elseif Ticked == 0 and (Greece.PowerState ~= "Normal") then
greece.MarkFailedObjective(KeepBasePowered) Greece.MarkFailedObjective(KeepBasePowered)
elseif ticked == 0 then elseif Ticked == 0 then
DefendChronosphereCompleted() DefendChronosphereCompleted()
ticked = ticked - 1 Ticked = Ticked - 1
end end
end end
WorldLoaded = function() WorldLoaded = function()
greece = Player.GetPlayer("Greece") Greece = Player.GetPlayer("Greece")
ussr = Player.GetPlayer("USSR") USSR = Player.GetPlayer("USSR")
germany = Player.GetPlayer("Germany") Germany = Player.GetPlayer("Germany")
InitObjectives(greece) InitObjectives(Greece)
DefendChronosphere = AddPrimaryObjective(greece, "defend-chronosphere-tech-center") DefendChronosphere = AddPrimaryObjective(Greece, "defend-chronosphere-tech-center")
KeepBasePowered = AddPrimaryObjective(greece, "chronosphere-needs-power") KeepBasePowered = AddPrimaryObjective(Greece, "chronosphere-needs-power")
EvacuateScientists = AddSecondaryObjective(greece, "evacuate-scientists-from-island") EvacuateScientists = AddSecondaryObjective(Greece, "evacuate-scientists-from-island")
BeatAllies = AddPrimaryObjective(ussr, "") BeatAllies = AddPrimaryObjective(USSR, "")
Trigger.AfterDelay(DateTime.Minutes(1), function() Trigger.AfterDelay(DateTime.Minutes(1), function()
Media.PlaySpeechNotification(greece, "TwentyMinutesRemaining") Media.PlaySpeechNotification(Greece, "TwentyMinutesRemaining")
end) end)
Trigger.AfterDelay(DateTime.Minutes(11), function() Trigger.AfterDelay(DateTime.Minutes(11), function()
Media.PlaySpeechNotification(greece, "TenMinutesRemaining") Media.PlaySpeechNotification(Greece, "TenMinutesRemaining")
end) end)
Trigger.AfterDelay(DateTime.Minutes(16), function() Trigger.AfterDelay(DateTime.Minutes(16), function()
Media.PlaySpeechNotification(greece, "WarningFiveMinutesRemaining") Media.PlaySpeechNotification(Greece, "WarningFiveMinutesRemaining")
end) end)
Trigger.AfterDelay(DateTime.Minutes(18), function() Trigger.AfterDelay(DateTime.Minutes(18), function()
Media.PlaySpeechNotification(greece, "WarningThreeMinutesRemaining") Media.PlaySpeechNotification(Greece, "WarningThreeMinutesRemaining")
end) end)
Trigger.AfterDelay(DateTime.Minutes(20), function() Trigger.AfterDelay(DateTime.Minutes(20), function()
Media.PlaySpeechNotification(greece, "WarningOneMinuteRemaining") Media.PlaySpeechNotification(Greece, "WarningOneMinuteRemaining")
end) end)
PowerProxy = Actor.Create("powerproxy.paratroopers", false, { Owner = ussr }) PowerProxy = Actor.Create("powerproxy.paratroopers", false, { Owner = USSR })
Camera.Position = DefaultCameraPosition.CenterPosition Camera.Position = DefaultCameraPosition.CenterPosition
TimerColor = greece.Color TimerColor = Greece.Color
Trigger.OnAnyKilled(ObjectiveBuildings, function() Trigger.OnAnyKilled(ObjectiveBuildings, function()
greece.MarkFailedObjective(DefendChronosphere) Greece.MarkFailedObjective(DefendChronosphere)
end) end)
Trigger.OnEnteredFootprint(ScientistDiscoveryFootprint, function(a, id) Trigger.OnEnteredFootprint(ScientistDiscoveryFootprint, function(a, id)
if a.Owner == greece and not scientistsTriggered then if a.Owner == Greece and not ScientistsTriggered then
scientistsTriggered = true ScientistsTriggered = true
Trigger.RemoveFootprintTrigger(id) Trigger.RemoveFootprintTrigger(id)
CreateScientists() CreateScientists()
end end

View File

@@ -83,11 +83,11 @@ SendAttackGroup = function()
end end
ProduceInfantry = function() ProduceInfantry = function()
if USSRRax.IsDead or USSRRax.Owner ~= ussr then if USSRRax.IsDead or USSRRax.Owner ~= USSR then
return return
end end
ussr.Build({ Utils.Random(SovietInfantry) }, function(units) USSR.Build({ Utils.Random(SovietInfantry) }, function(units)
table.insert(AttackGroup, units[1]) table.insert(AttackGroup, units[1])
SendAttackGroup() SendAttackGroup()
Trigger.AfterDelay(ProductionInterval[Difficulty], ProduceInfantry) Trigger.AfterDelay(ProductionInterval[Difficulty], ProduceInfantry)
@@ -95,11 +95,11 @@ ProduceInfantry = function()
end end
ProduceVehicles = function() ProduceVehicles = function()
if USSRWarFactory.IsDead or USSRWarFactory.Owner ~= ussr then if USSRWarFactory.IsDead or USSRWarFactory.Owner ~= USSR then
return return
end end
ussr.Build({ Utils.Random(SovietVehicles) }, function(units) USSR.Build({ Utils.Random(SovietVehicles) }, function(units)
table.insert(AttackGroup, units[1]) table.insert(AttackGroup, units[1])
SendAttackGroup() SendAttackGroup()
Trigger.AfterDelay(ProductionInterval[Difficulty], ProduceVehicles) Trigger.AfterDelay(ProductionInterval[Difficulty], ProduceVehicles)
@@ -107,11 +107,11 @@ ProduceVehicles = function()
end end
ProduceAircraft = function() ProduceAircraft = function()
if (Airfield1.IsDead or Airfield1.Owner ~= ussr) and (Airfield2.IsDead or Airfield2.Owner ~= ussr) then if (Airfield1.IsDead or Airfield1.Owner ~= USSR) and (Airfield2.IsDead or Airfield2.Owner ~= USSR) then
return return
end end
ussr.Build(SovietAircraftType, function(units) USSR.Build(SovietAircraftType, function(units)
local mig = units[1] local mig = units[1]
Migs[#Migs + 1] = mig Migs[#Migs + 1] = mig
@@ -122,13 +122,13 @@ ProduceAircraft = function()
Trigger.AfterDelay(DateTime.Seconds(ProductionInterval[Difficulty] / 2), ProduceAircraft) Trigger.AfterDelay(DateTime.Seconds(ProductionInterval[Difficulty] / 2), ProduceAircraft)
end end
InitializeAttackAircraft(mig, greece) InitializeAttackAircraft(mig, Greece)
end) end)
end end
GroundWaves = function() GroundWaves = function()
local path = Utils.Random(GroundAttackPaths) local path = Utils.Random(GroundAttackPaths)
local units = Reinforcements.Reinforce(ussr, Utils.Random(GroundAttackUnits[GroundAttackUnitType]), { path[1] }) local units = Reinforcements.Reinforce(USSR, Utils.Random(GroundAttackUnits[GroundAttackUnitType]), { path[1] })
local lastWaypoint = path[#path] local lastWaypoint = path[#path]
Utils.Do(units, function(unit) Utils.Do(units, function(unit)
Trigger.OnAddedToWorld(unit, function() Trigger.OnAddedToWorld(unit, function()
@@ -145,7 +145,7 @@ end
WTransWaves = function() WTransWaves = function()
local way = Utils.Random(WTransWays) local way = Utils.Random(WTransWays)
local units = Utils.Random(WTransUnits) local units = Utils.Random(WTransUnits)
local attackUnits = Reinforcements.ReinforceWithTransport(ussr, "lst", units , way, { way[2], way[1] })[2] local attackUnits = Reinforcements.ReinforceWithTransport(USSR, "lst", units , way, { way[2], way[1] })[2]
Utils.Do(attackUnits, function(a) Utils.Do(attackUnits, function(a)
Trigger.OnAddedToWorld(a, function() Trigger.OnAddedToWorld(a, function()
a.AttackMove(AttackChrono.Location) a.AttackMove(AttackChrono.Location)
@@ -169,15 +169,15 @@ end
SendParabombs = function() SendParabombs = function()
local airfield = Airfield1 local airfield = Airfield1
if Airfield1.IsDead or Airfield1.Owner ~= ussr then if Airfield1.IsDead or Airfield1.Owner ~= USSR then
if Airfield2.IsDead or Airfield2.Owner ~= ussr then if Airfield2.IsDead or Airfield2.Owner ~= USSR then
return return
end end
airfield = Airfield2 airfield = Airfield2
end end
local targets = Utils.Where(greece.GetActors(), function(actor) local targets = Utils.Where(Greece.GetActors(), function(actor)
return return
actor.HasProperty("Sell") and actor.HasProperty("Sell") and
actor.Type ~= "brik" and actor.Type ~= "brik" and
@@ -199,10 +199,10 @@ ActivateAI = function()
ParadropDelays = ParadropDelays[Difficulty] ParadropDelays = ParadropDelays[Difficulty]
BombDelays = BombDelays[Difficulty] BombDelays = BombDelays[Difficulty]
local buildings = Utils.Where(Map.ActorsInWorld, function(self) return self.Owner == ussr and self.HasProperty("StartBuildingRepairs") end) local buildings = Utils.Where(Map.ActorsInWorld, function(self) return self.Owner == USSR and self.HasProperty("StartBuildingRepairs") end)
Utils.Do(buildings, function(actor) Utils.Do(buildings, function(actor)
Trigger.OnDamaged(actor, function(building) Trigger.OnDamaged(actor, function(building)
if building.Owner == ussr and building.Health < building.MaxHealth * 3/4 then if building.Owner == USSR and building.Health < building.MaxHealth * 3/4 then
building.StartBuildingRepairs() building.StartBuildingRepairs()
end end
end) end)

View File

@@ -15,33 +15,33 @@ ScientistEvacuationFootprint = { CPos.New(98, 88), CPos.New(98, 87), CPos.New(99
InitialAlliedReinforcements = function() InitialAlliedReinforcements = function()
Trigger.AfterDelay(DateTime.Seconds(2), function() Trigger.AfterDelay(DateTime.Seconds(2), function()
Media.PlaySpeechNotification(greece, "ReinforcementsArrived") Media.PlaySpeechNotification(Greece, "ReinforcementsArrived")
Reinforcements.Reinforce(greece, { "mcv" }, { MCVEntry.Location, MCVStop.Location }) Reinforcements.Reinforce(Greece, { "mcv" }, { MCVEntry.Location, MCVStop.Location })
Reinforcements.Reinforce(greece, AlliedBoatReinforcements, { DDEntry.Location, DDStop.Location }) Reinforcements.Reinforce(Greece, AlliedBoatReinforcements, { DDEntry.Location, DDStop.Location })
end) end)
end end
CreateScientists = function() CreateScientists = function()
scientists = Reinforcements.Reinforce(greece, ScientistTypes, { ScientistsExit.Location }) local scientists = Reinforcements.Reinforce(Greece, ScientistTypes, { ScientistsExit.Location })
Utils.Do(scientists, function(s) Utils.Do(scientists, function(s)
s.Move(s.Location + CVec.New(0, 1)) s.Move(s.Location + CVec.New(0, 1))
s.Scatter() s.Scatter()
end) end)
local flare = Actor.Create("flare", true, { Owner = greece, Location = DefaultCameraPosition.Location + CVec.New(-1, 0) }) local flare = Actor.Create("flare", true, { Owner = Greece, Location = DefaultCameraPosition.Location + CVec.New(-1, 0) })
Trigger.AfterDelay(DateTime.Seconds(2), function() Media.PlaySpeechNotification(player, "SignalFlareSouth") end) Trigger.AfterDelay(DateTime.Seconds(2), function() Media.PlaySpeechNotification(Greece, "SignalFlareSouth") end)
Trigger.OnAnyKilled(scientists, function() Trigger.OnAnyKilled(scientists, function()
Media.PlaySpeechNotification(greece, "ObjectiveNotMet") Media.PlaySpeechNotification(Greece, "ObjectiveNotMet")
greece.MarkFailedObjective(EvacuateScientists) Greece.MarkFailedObjective(EvacuateScientists)
end) end)
-- Add the footprint trigger in a frame end task (delay 0) to avoid crashes -- Add the footprint trigger in a frame end task (delay 0) to avoid crashes
local left = #scientists local left = #scientists
Trigger.AfterDelay(0, function() Trigger.AfterDelay(0, function()
local changeOwnerTrigger = Trigger.OnEnteredFootprint(ScientistEvacuationFootprint, function(a, id) local changeOwnerTrigger = Trigger.OnEnteredFootprint(ScientistEvacuationFootprint, function(a, id)
if a.Owner == greece and a.Type == "chan" then if a.Owner == Greece and a.Type == "chan" then
a.Owner = england a.Owner = England
a.Stop() a.Stop()
a.Move(MCVEntry.Location) a.Move(MCVEntry.Location)
@@ -54,7 +54,7 @@ CreateScientists = function()
-- Use a cell trigger to destroy the scientists preventing the player from causing glitchs by blocking the path -- Use a cell trigger to destroy the scientists preventing the player from causing glitchs by blocking the path
Trigger.OnEnteredFootprint({ MCVEntry.Location }, function(a, id) Trigger.OnEnteredFootprint({ MCVEntry.Location }, function(a, id)
if a.Owner == england then if a.Owner == England then
a.Stop() a.Stop()
a.Destroy() a.Destroy()
@@ -64,9 +64,9 @@ CreateScientists = function()
Trigger.RemoveFootprintTrigger(changeOwnerTrigger) Trigger.RemoveFootprintTrigger(changeOwnerTrigger)
flare.Destroy() flare.Destroy()
if not greece.IsObjectiveCompleted(EvacuateScientists) and not greece.IsObjectiveFailed(EvacuateScientists) then if not Greece.IsObjectiveCompleted(EvacuateScientists) and not Greece.IsObjectiveFailed(EvacuateScientists) then
Media.PlaySpeechNotification(greece, "ObjectiveMet") Media.PlaySpeechNotification(Greece, "ObjectiveMet")
greece.MarkCompletedObjective(EvacuateScientists) Greece.MarkCompletedObjective(EvacuateScientists)
end end
end end
end end
@@ -78,84 +78,84 @@ DefendChronosphereCompleted = function()
local cells = Utils.ExpandFootprint({ ChronoshiftLocation.Location }, false) local cells = Utils.ExpandFootprint({ ChronoshiftLocation.Location }, false)
local units = { } local units = { }
for i = 1, #cells do for i = 1, #cells do
local unit = Actor.Create("2tnk", true, { Owner = greece, Facing = Angle.North }) local unit = Actor.Create("2tnk", true, { Owner = Greece, Facing = Angle.North })
units[unit] = cells[i] units[unit] = cells[i]
end end
Chronosphere.Chronoshift(units) Chronosphere.Chronoshift(units)
UserInterface.SetMissionText(UserInterface.Translate("experiment-successful"), greece.Color) UserInterface.SetMissionText(UserInterface.Translate("experiment-successful"), Greece.Color)
Trigger.AfterDelay(DateTime.Seconds(3), function() Trigger.AfterDelay(DateTime.Seconds(3), function()
greece.MarkCompletedObjective(DefendChronosphere) Greece.MarkCompletedObjective(DefendChronosphere)
greece.MarkCompletedObjective(KeepBasePowered) Greece.MarkCompletedObjective(KeepBasePowered)
end) end)
end end
ticked = TimerTicks Ticked = TimerTicks
Tick = function() Tick = function()
ussr.Cash = 5000 USSR.Cash = 5000
if ussr.HasNoRequiredUnits() then if USSR.HasNoRequiredUnits() then
greece.MarkCompletedObjective(DefendChronosphere) Greece.MarkCompletedObjective(DefendChronosphere)
greece.MarkCompletedObjective(KeepBasePowered) Greece.MarkCompletedObjective(KeepBasePowered)
end end
if greece.HasNoRequiredUnits() then if Greece.HasNoRequiredUnits() then
ussr.MarkCompletedObjective(BeatAllies) USSR.MarkCompletedObjective(BeatAllies)
end end
if ticked > 0 then if Ticked > 0 then
if (ticked % DateTime.Seconds(1)) == 0 then if (Ticked % DateTime.Seconds(1)) == 0 then
Timer = UserInterface.Translate("chronosphere-experiments-completes-in", { ["time"] = Utils.FormatTime(ticked) }) Timer = UserInterface.Translate("chronosphere-experiments-completes-in", { ["time"] = Utils.FormatTime(Ticked) })
UserInterface.SetMissionText(Timer, TimerColor) UserInterface.SetMissionText(Timer, TimerColor)
end end
ticked = ticked - 1 Ticked = Ticked - 1
elseif ticked == 0 and (greece.PowerState ~= "Normal") then elseif Ticked == 0 and (Greece.PowerState ~= "Normal") then
greece.MarkFailedObjective(KeepBasePowered) Greece.MarkFailedObjective(KeepBasePowered)
elseif ticked == 0 then elseif Ticked == 0 then
DefendChronosphereCompleted() DefendChronosphereCompleted()
ticked = ticked - 1 Ticked = Ticked - 1
end end
end end
WorldLoaded = function() WorldLoaded = function()
greece = Player.GetPlayer("Greece") Greece = Player.GetPlayer("Greece")
ussr = Player.GetPlayer("USSR") USSR = Player.GetPlayer("USSR")
england = Player.GetPlayer("England") England = Player.GetPlayer("England")
InitObjectives(greece) InitObjectives(Greece)
DefendChronosphere = AddPrimaryObjective(greece, "defend-chronosphere-tech-center") DefendChronosphere = AddPrimaryObjective(Greece, "defend-chronosphere-tech-center")
KeepBasePowered = AddPrimaryObjective(greece, "chronosphere-needs-power") KeepBasePowered = AddPrimaryObjective(Greece, "chronosphere-needs-power")
EvacuateScientists = AddSecondaryObjective(greece, "evacuate-scientists-from-island") EvacuateScientists = AddSecondaryObjective(Greece, "evacuate-scientists-from-island")
BeatAllies = AddPrimaryObjective(ussr, "") BeatAllies = AddPrimaryObjective(USSR, "")
Trigger.AfterDelay(DateTime.Minutes(1), function() Trigger.AfterDelay(DateTime.Minutes(1), function()
Media.PlaySpeechNotification(greece, "TwentyMinutesRemaining") Media.PlaySpeechNotification(Greece, "TwentyMinutesRemaining")
end) end)
Trigger.AfterDelay(DateTime.Minutes(11), function() Trigger.AfterDelay(DateTime.Minutes(11), function()
Media.PlaySpeechNotification(greece, "TenMinutesRemaining") Media.PlaySpeechNotification(Greece, "TenMinutesRemaining")
end) end)
Trigger.AfterDelay(DateTime.Minutes(16), function() Trigger.AfterDelay(DateTime.Minutes(16), function()
Media.PlaySpeechNotification(greece, "WarningFiveMinutesRemaining") Media.PlaySpeechNotification(Greece, "WarningFiveMinutesRemaining")
end) end)
Trigger.AfterDelay(DateTime.Minutes(18), function() Trigger.AfterDelay(DateTime.Minutes(18), function()
Media.PlaySpeechNotification(greece, "WarningThreeMinutesRemaining") Media.PlaySpeechNotification(Greece, "WarningThreeMinutesRemaining")
end) end)
Trigger.AfterDelay(DateTime.Minutes(20), function() Trigger.AfterDelay(DateTime.Minutes(20), function()
Media.PlaySpeechNotification(greece, "WarningOneMinuteRemaining") Media.PlaySpeechNotification(Greece, "WarningOneMinuteRemaining")
end) end)
PowerProxy = Actor.Create("powerproxy.paratroopers", false, { Owner = ussr }) PowerProxy = Actor.Create("powerproxy.paratroopers", false, { Owner = USSR })
Camera.Position = DefaultCameraPosition.CenterPosition Camera.Position = DefaultCameraPosition.CenterPosition
TimerColor = greece.Color TimerColor = Greece.Color
Trigger.OnAnyKilled(ObjectiveBuildings, function() Trigger.OnAnyKilled(ObjectiveBuildings, function()
greece.MarkFailedObjective(DefendChronosphere) Greece.MarkFailedObjective(DefendChronosphere)
end) end)
Trigger.OnEnteredFootprint(ScientistDiscoveryFootprint, function(a, id) Trigger.OnEnteredFootprint(ScientistDiscoveryFootprint, function(a, id)
if a.Owner == greece and not scientistsTriggered then if a.Owner == Greece and not ScientistsTriggered then
scientistsTriggered = true ScientistsTriggered = true
Trigger.RemoveFootprintTrigger(id) Trigger.RemoveFootprintTrigger(id)
CreateScientists() CreateScientists()
end end

View File

@@ -7,7 +7,7 @@
information, see COPYING. information, see COPYING.
]] ]]
lstReinforcements = LstReinforcements =
{ {
actors = { "mcv" }, actors = { "mcv" },
entryPath = { AlliedMCVEntry.Location, Unload1.Location }, entryPath = { AlliedMCVEntry.Location, Unload1.Location },
@@ -28,7 +28,7 @@ KosyginContacted = false
InitialAlliedReinforcements = function() InitialAlliedReinforcements = function()
Trigger.AfterDelay(DateTime.Seconds(1), function() Trigger.AfterDelay(DateTime.Seconds(1), function()
Media.PlaySpeechNotification(Greece, "ReinforcementsArrived") Media.PlaySpeechNotification(Greece, "ReinforcementsArrived")
Reinforcements.ReinforceWithTransport(Greece, "lst.reinforcement", lstReinforcements.actors, lstReinforcements.entryPath, lstReinforcements.exitPath) Reinforcements.ReinforceWithTransport(Greece, "lst.reinforcement", LstReinforcements.actors, LstReinforcements.entryPath, LstReinforcements.exitPath)
end) end)
end end

View File

@@ -93,7 +93,7 @@ end
LaunchMissiles = function() LaunchMissiles = function()
MissilesLaunched = true MissilesLaunched = true
local missileCam = Actor.Create("camera", true, { Owner = Greece, Location = FCom.Location }) Actor.Create("camera", true, { Owner = Greece, Location = FCom.Location })
Camera.Position = FCom.CenterPosition Camera.Position = FCom.CenterPosition
Media.PlaySpeechNotification(Greece, "AbombLaunchDetected") Media.PlaySpeechNotification(Greece, "AbombLaunchDetected")
MissileSilo1.ActivateNukePower(CPos.New(127, 127)) MissileSilo1.ActivateNukePower(CPos.New(127, 127))

View File

@@ -15,7 +15,7 @@ AtEndGame = false
TimerColor = Player.GetPlayer("Spain").Color TimerColor = Player.GetPlayer("Spain").Color
InsertionHelicopterType = "tran.insertion" InsertionHelicopterType = "tran.insertion"
TimerTicks = DateTime.Minutes(18) -- 18 minutes is roughly 30 mins in the original game TimerTicks = DateTime.Minutes(18) -- 18 minutes is roughly 30 mins in the original game
ticks = TimerTicks Ticks = TimerTicks
--Table Vars --Table Vars
TankPath = { waypoint12.Location, waypoint13.Location } TankPath = { waypoint12.Location, waypoint13.Location }
@@ -104,27 +104,27 @@ SetupTimeNotifications = function()
end end
GetTicks = function() GetTicks = function()
return ticks return Ticks
end end
Tick = function() Tick = function()
if SurviveObjective ~= nil then if SurviveObjective ~= nil then
if ticks > 0 then if Ticks > 0 then
if ticks == DateTime.Minutes(17) then if Ticks == DateTime.Minutes(17) then
StartAntAttack() StartAntAttack()
elseif ticks == DateTime.Minutes(15) then elseif Ticks == DateTime.Minutes(15) then
SendInsertionHelicopter() SendInsertionHelicopter()
elseif ticks == DateTime.Minutes(12) then elseif Ticks == DateTime.Minutes(12) then
StartAntAttack() StartAntAttack()
elseif ticks == DateTime.Minutes(6) then elseif Ticks == DateTime.Minutes(6) then
StartAntAttack() StartAntAttack()
elseif ticks == DateTime.Minutes(1) then elseif Ticks == DateTime.Minutes(1) then
EndAntAttack() EndAntAttack()
end end
ticks = ticks - 1; Ticks = Ticks - 1;
if (ticks % DateTime.Seconds(1)) == 0 then if (Ticks % DateTime.Seconds(1)) == 0 then
Timer = UserInterface.Translate("reinforcements-arrive-in", { ["time"] = Utils.FormatTime(ticks) }) Timer = UserInterface.Translate("reinforcements-arrive-in", { ["time"] = Utils.FormatTime(Ticks) })
UserInterface.SetMissionText(Timer, TimerColor) UserInterface.SetMissionText(Timer, TimerColor)
end end
else else
@@ -136,7 +136,7 @@ Tick = function()
SendTanks() SendTanks()
Trigger.AfterDelay(DateTime.Seconds(2), function() TimerExpired() end) Trigger.AfterDelay(DateTime.Seconds(2), function() TimerExpired() end)
end end
ticks = ticks - 1 Ticks = Ticks - 1
end end
end end
end end

View File

@@ -46,7 +46,7 @@ Mig2Waypoints = { Mig21, Mig22, Mig23, Mig24 }
BindActorTriggers = function(a) BindActorTriggers = function(a)
if a.HasProperty("Hunt") then if a.HasProperty("Hunt") then
if a.Owner == allies then if a.Owner == Allies then
Trigger.OnIdle(a, function(a) Trigger.OnIdle(a, function(a)
if a.IsInWorld then if a.IsInWorld then
a.Hunt() a.Hunt()
@@ -76,7 +76,7 @@ BindActorTriggers = function(a)
end end
SendSovietUnits = function(entryCell, unitTypes, interval) SendSovietUnits = function(entryCell, unitTypes, interval)
local units = Reinforcements.Reinforce(soviets, unitTypes, { entryCell }, interval) local units = Reinforcements.Reinforce(Soviets, unitTypes, { entryCell }, interval)
Utils.Do(units, function(unit) Utils.Do(units, function(unit)
BindActorTriggers(unit) BindActorTriggers(unit)
end) end)
@@ -85,7 +85,7 @@ end
SendMigs = function(waypoints) SendMigs = function(waypoints)
local migEntryPath = { waypoints[1].Location, waypoints[2].Location } local migEntryPath = { waypoints[1].Location, waypoints[2].Location }
local migs = Reinforcements.Reinforce(soviets, { "mig" }, migEntryPath, 4) local migs = Reinforcements.Reinforce(Soviets, { "mig" }, migEntryPath, 4)
Utils.Do(migs, function(mig) Utils.Do(migs, function(mig)
mig.Move(waypoints[3].Location) mig.Move(waypoints[3].Location)
mig.Move(waypoints[4].Location) mig.Move(waypoints[4].Location)
@@ -96,7 +96,7 @@ SendMigs = function(waypoints)
end end
ShipAlliedUnits = function() ShipAlliedUnits = function()
local units = Reinforcements.ReinforceWithTransport(allies, "lst", local units = Reinforcements.ReinforceWithTransport(Allies, "lst",
ShipUnitTypes, { LstEntry.Location, LstUnload.Location }, { LstEntry.Location })[2] ShipUnitTypes, { LstEntry.Location, LstUnload.Location }, { LstEntry.Location })[2]
Utils.Do(units, function(unit) Utils.Do(units, function(unit)
@@ -108,7 +108,7 @@ end
--- @param hpad actor --- @param hpad actor
InsertAlliedChinookReinforcements = function(entry, hpad) InsertAlliedChinookReinforcements = function(entry, hpad)
local units = Reinforcements.ReinforceWithTransport(allies, "tran", local units = Reinforcements.ReinforceWithTransport(Allies, "tran",
HelicopterUnitTypes, { entry.Location, hpad.Location + CVec.New(1, 2) }, { entry.Location })[2] HelicopterUnitTypes, { entry.Location, hpad.Location + CVec.New(1, 2) }, { entry.Location })[2]
Utils.Do(units, function(unit) Utils.Do(units, function(unit)
@@ -120,7 +120,7 @@ end
ParadropSovietUnits = function() ParadropSovietUnits = function()
local lz = Utils.Random(ParadropWaypoints) local lz = Utils.Random(ParadropWaypoints)
local aircraft = powerproxy.TargetParatroopers(lz.CenterPosition) local aircraft = PowerProxy.TargetParatroopers(lz.CenterPosition)
Utils.Do(aircraft, function(a) Utils.Do(aircraft, function(a)
Trigger.OnPassengerExited(a, function(t, p) Trigger.OnPassengerExited(a, function(t, p)
@@ -143,7 +143,7 @@ end
SetupAlliedUnits = function() SetupAlliedUnits = function()
Utils.Do(Map.NamedActors, function(a) Utils.Do(Map.NamedActors, function(a)
if a.Owner == allies and a.HasProperty("AcceptsCondition") and a.AcceptsCondition("unkillable") then if a.Owner == Allies and a.HasProperty("AcceptsCondition") and a.AcceptsCondition("unkillable") then
a.GrantCondition("unkillable") a.GrantCondition("unkillable")
a.Stance = "Defend" a.Stance = "Defend"
end end
@@ -160,7 +160,7 @@ ChronoshiftAlliedUnits = function()
local cells = Utils.ExpandFootprint({ ChronoshiftLocation.Location }, false) local cells = Utils.ExpandFootprint({ ChronoshiftLocation.Location }, false)
local units = { } local units = { }
for i = 1, #cells do for i = 1, #cells do
local unit = Actor.Create("2tnk", true, { Owner = allies, Facing = Angle.North }) local unit = Actor.Create("2tnk", true, { Owner = Allies, Facing = Angle.North })
BindActorTriggers(unit) BindActorTriggers(unit)
units[unit] = cells[i] units[unit] = cells[i]
end end
@@ -168,27 +168,27 @@ ChronoshiftAlliedUnits = function()
Trigger.AfterDelay(DateTime.Seconds(60), ChronoshiftAlliedUnits) Trigger.AfterDelay(DateTime.Seconds(60), ChronoshiftAlliedUnits)
end end
ticks = 0 Ticks = 0
speed = 5 Speed = 5
Tick = function() Tick = function()
ticks = ticks + 1 Ticks = Ticks + 1
local t = (ticks + 45) % (360 * speed) * (math.pi / 180) / speed; local t = (Ticks + 45) % (360 * Speed) * (math.pi / 180) / Speed;
Camera.Position = viewportOrigin + WVec.New(19200 * math.sin(t), 20480 * math.cos(t), 0) Camera.Position = ViewportOrigin + WVec.New(19200 * math.sin(t), 20480 * math.cos(t), 0)
end end
WorldLoaded = function() WorldLoaded = function()
allies = Player.GetPlayer("Allies") Allies = Player.GetPlayer("Allies")
soviets = Player.GetPlayer("Soviets") Soviets = Player.GetPlayer("Soviets")
viewportOrigin = Camera.Position ViewportOrigin = Camera.Position
SetupAlliedUnits() SetupAlliedUnits()
SetupFactories() SetupFactories()
ShipAlliedUnits() ShipAlliedUnits()
InsertAlliedChinookReinforcements(Chinook1Entry, HeliPad1) InsertAlliedChinookReinforcements(Chinook1Entry, HeliPad1)
InsertAlliedChinookReinforcements(Chinook2Entry, HeliPad2) InsertAlliedChinookReinforcements(Chinook2Entry, HeliPad2)
powerproxy = Actor.Create(ProxyType, false, { Owner = soviets }) PowerProxy = Actor.Create(ProxyType, false, { Owner = Soviets })
ParadropSovietUnits() ParadropSovietUnits()
Trigger.AfterDelay(DateTime.Seconds(5), ChronoshiftAlliedUnits) Trigger.AfterDelay(DateTime.Seconds(5), ChronoshiftAlliedUnits)
Utils.Do(ProducedUnitTypes, ProduceUnits) Utils.Do(ProducedUnitTypes, ProduceUnits)

View File

@@ -73,17 +73,17 @@ ReinforcementsUnits = { "2tnk", "2tnk", "2tnk", "2tnk", "2tnk", "2tnk", "1tnk",
"e1", "e1", "e1", "e3", "e3", "mcv", "truk", "truk", "truk", "truk", "truk", "truk" } "e1", "e1", "e1", "e3", "e3", "mcv", "truk", "truk", "truk", "truk", "truk", "truk" }
SpawnAlliedReinforcements = function() SpawnAlliedReinforcements = function()
if allies2.IsLocalPlayer then if Allies2.IsLocalPlayer then
UserInterface.SetMissionText("") UserInterface.SetMissionText("")
Media.PlaySpeechNotification(allies2, "AlliedReinforcementsArrived") Media.PlaySpeechNotification(Allies2, "AlliedReinforcementsArrived")
end end
Reinforcements.Reinforce(allies2, ReinforcementsUnits, { ReinforcementsEntryPoint.Location, Allies2BasePoint.Location }) Reinforcements.Reinforce(Allies2, ReinforcementsUnits, { ReinforcementsEntryPoint.Location, Allies2BasePoint.Location })
end end
Yak = nil Yak = nil
YakAttack = function() YakAttack = function()
local targets = Map.ActorsInCircle(YakAttackPoint.CenterPosition, WDist.FromCells(10), function(a) local targets = Map.ActorsInCircle(YakAttackPoint.CenterPosition, WDist.FromCells(10), function(a)
return a.Owner == allies1 and not a.IsDead and a ~= Einstein and a ~= Tanya and a ~= Engineer and Yak.CanTarget(a) return a.Owner == Allies1 and not a.IsDead and a ~= Einstein and a ~= Tanya and a ~= Engineer and Yak.CanTarget(a)
end) end)
if (#targets > 0) then if (#targets > 0) then
@@ -106,7 +106,7 @@ SovietTownAttack = function()
end end
SendParabombs = function() SendParabombs = function()
local proxy = Actor.Create("powerproxy.parabombs", false, { Owner = soviets }) local proxy = Actor.Create("powerproxy.parabombs", false, { Owner = Soviets })
proxy.TargetAirstrike(ParabombPoint1.CenterPosition, (BadgerEntryPoint2.CenterPosition - ParabombPoint1.CenterPosition).Facing) proxy.TargetAirstrike(ParabombPoint1.CenterPosition, (BadgerEntryPoint2.CenterPosition - ParabombPoint1.CenterPosition).Facing)
proxy.TargetAirstrike(ParabombPoint2.CenterPosition, (Map.CenterOfCell(BadgerEntryPoint2.Location + CVec.New(0, 3)) - ParabombPoint2.CenterPosition).Facing) proxy.TargetAirstrike(ParabombPoint2.CenterPosition, (Map.CenterOfCell(BadgerEntryPoint2.Location + CVec.New(0, 3)) - ParabombPoint2.CenterPosition).Facing)
proxy.Destroy() proxy.Destroy()
@@ -114,7 +114,7 @@ end
SendParatroopers = function() SendParatroopers = function()
Utils.Do(Paratroopers, function(para) Utils.Do(Paratroopers, function(para)
local proxy = Actor.Create(para.proxy, false, { Owner = soviets }) local proxy = Actor.Create(para.proxy, false, { Owner = Soviets })
local target = Map.CenterOfCell(para.drop) local target = Map.CenterOfCell(para.drop)
local dir = target - Map.CenterOfCell(para.entry) local dir = target - Map.CenterOfCell(para.entry)
@@ -143,11 +143,11 @@ SendAttackGroup = function()
end end
ProduceInfantry = function() ProduceInfantry = function()
if SovietBarracks.IsDead or SovietBarracks.Owner ~= soviets then if SovietBarracks.IsDead or SovietBarracks.Owner ~= Soviets then
return return
end end
soviets.Build({ Utils.Random(SovietInfantry) }, function(units) Soviets.Build({ Utils.Random(SovietInfantry) }, function(units)
table.insert(AttackGroup, units[1]) table.insert(AttackGroup, units[1])
SendAttackGroup() SendAttackGroup()
Trigger.AfterDelay(ProductionInterval[Difficulty], ProduceInfantry) Trigger.AfterDelay(ProductionInterval[Difficulty], ProduceInfantry)
@@ -155,11 +155,11 @@ ProduceInfantry = function()
end end
ProduceVehicles = function() ProduceVehicles = function()
if SovietWarFactory.IsDead or SovietWarFactory.Owner ~= soviets then if SovietWarFactory.IsDead or SovietWarFactory.Owner ~= Soviets then
return return
end end
soviets.Build({ Utils.Random(SovietVehicles[SovietVehicleType]) }, function(units) Soviets.Build({ Utils.Random(SovietVehicles[SovietVehicleType]) }, function(units)
table.insert(AttackGroup, units[1]) table.insert(AttackGroup, units[1])
SendAttackGroup() SendAttackGroup()
Trigger.AfterDelay(ProductionInterval[Difficulty], ProduceVehicles) Trigger.AfterDelay(ProductionInterval[Difficulty], ProduceVehicles)
@@ -168,7 +168,7 @@ end
NumBaseBuildings = function() NumBaseBuildings = function()
local buildings = Map.ActorsInBox(AlliedBaseTopLeft.CenterPosition, AlliedBaseBottomRight.CenterPosition, function(a) local buildings = Map.ActorsInBox(AlliedBaseTopLeft.CenterPosition, AlliedBaseBottomRight.CenterPosition, function(a)
return not a.IsDead and a.Owner == allies2 and a.HasProperty("StartBuildingRepairs") return not a.IsDead and a.Owner == Allies2 and a.HasProperty("StartBuildingRepairs")
end) end)
return #buildings return #buildings
@@ -176,18 +176,18 @@ end
Tick = function() Tick = function()
if DateTime.GameTime > 1 and DateTime.GameTime % 25 == 0 and NumBaseBuildings() == 0 then if DateTime.GameTime > 1 and DateTime.GameTime % 25 == 0 and NumBaseBuildings() == 0 then
allies2.MarkFailedObjective(objHoldPosition) Allies2.MarkFailedObjective(HoldPositionObjective)
end end
if not allies2.IsObjectiveCompleted(objCutSovietPower) and soviets.PowerState ~= "Normal" then if not Allies2.IsObjectiveCompleted(CutSovietPowerObjective) and Soviets.PowerState ~= "Normal" then
allies2.MarkCompletedObjective(objCutSovietPower) Allies2.MarkCompletedObjective(CutSovietPowerObjective)
end end
if not allies2.IsObjectiveCompleted(objLimitLosses) and allies2.UnitsLost > DeathThreshold[Difficulty] then if not Allies2.IsObjectiveCompleted(LimitLossesObjective) and Allies2.UnitsLost > DeathThreshold[Difficulty] then
allies2.MarkFailedObjective(objLimitLosses) Allies2.MarkFailedObjective(LimitLossesObjective)
end end
if allies2.IsLocalPlayer and DateTime.GameTime <= ReinforcementsDelay then if Allies2.IsLocalPlayer and DateTime.GameTime <= ReinforcementsDelay then
if DateTime.GameTime % DateTime.Seconds(1) == 0 then if DateTime.GameTime % DateTime.Seconds(1) == 0 then
local time = Utils.FormatTime(ReinforcementsDelay - DateTime.GameTime) local time = Utils.FormatTime(ReinforcementsDelay - DateTime.GameTime)
local timer = UserInterface.Translate("allied-reinforcements-arrive-in", { ["time"] = time }) local timer = UserInterface.Translate("allied-reinforcements-arrive-in", { ["time"] = time })
@@ -199,21 +199,21 @@ Tick = function()
end end
SetupSoviets = function() SetupSoviets = function()
soviets.Cash = 1000 Soviets.Cash = 1000
if Difficulty == "easy" then if Difficulty == "easy" then
Utils.Do(Sams, function(sam) Utils.Do(Sams, function(sam)
local camera = Actor.Create("Camera.SAM", true, { Owner = allies1, Location = sam.Location }) local camera = Actor.Create("Camera.SAM", true, { Owner = Allies1, Location = sam.Location })
Trigger.OnKilledOrCaptured(sam, function() Trigger.OnKilledOrCaptured(sam, function()
camera.Destroy() camera.Destroy()
end) end)
end) end)
end end
local buildings = Utils.Where(Map.ActorsInWorld, function(self) return self.Owner == soviets and self.HasProperty("StartBuildingRepairs") end) local buildings = Utils.Where(Map.ActorsInWorld, function(self) return self.Owner == Soviets and self.HasProperty("StartBuildingRepairs") end)
Utils.Do(buildings, function(actor) Utils.Do(buildings, function(actor)
Trigger.OnDamaged(actor, function(building) Trigger.OnDamaged(actor, function(building)
if building.Owner == soviets and building.Health < (building.MaxHealth * RepairTriggerThreshold[Difficulty] / 100) then if building.Owner == Soviets and building.Health < (building.MaxHealth * RepairTriggerThreshold[Difficulty] / 100) then
building.StartBuildingRepairs() building.StartBuildingRepairs()
end end
end) end)
@@ -233,43 +233,43 @@ end
SetupTriggers = function() SetupTriggers = function()
Trigger.OnKilled(Tanya, function() Trigger.OnKilled(Tanya, function()
allies1.MarkFailedObjective(objTanyaMustSurvive) Allies1.MarkFailedObjective(TanyaMustSurviveObjective)
end) end)
Trigger.OnAllKilledOrCaptured(Sams, function() Trigger.OnAllKilledOrCaptured(Sams, function()
allies1.MarkCompletedObjective(objDestroySamSites) Allies1.MarkCompletedObjective(DestroySamSitesObjective)
objExtractEinstein = AddPrimaryObjective(allies1, "wait-for-helicopter-extract-einstein") ExtractEinsteinObjective = AddPrimaryObjective(Allies1, "wait-for-helicopter-extract-einstein")
Actor.Create("flare", true, { Owner = allies1, Location = ExtractionLZ.Location + CVec.New(1, -1) }) Actor.Create("flare", true, { Owner = Allies1, Location = ExtractionLZ.Location + CVec.New(1, -1) })
Beacon.New(allies1, ExtractionLZ.CenterPosition) Beacon.New(Allies1, ExtractionLZ.CenterPosition)
Media.PlaySpeechNotification(allies1, "SignalFlareNorth") Media.PlaySpeechNotification(Allies1, "SignalFlareNorth")
ExtractionHeli = Reinforcements.ReinforceWithTransport(allies1, "tran", nil, { ExtractionLZEntryPoint.Location, ExtractionLZ.Location })[1] ExtractionHeli = Reinforcements.ReinforceWithTransport(Allies1, "tran", nil, { ExtractionLZEntryPoint.Location, ExtractionLZ.Location })[1]
Trigger.OnKilled(ExtractionHeli, function() Trigger.OnKilled(ExtractionHeli, function()
allies1.MarkFailedObjective(objExtractEinstein) Allies1.MarkFailedObjective(ExtractEinsteinObjective)
end) end)
Trigger.OnPassengerEntered(ExtractionHeli, function(heli, passenger) Trigger.OnPassengerEntered(ExtractionHeli, function(heli, passenger)
if passenger == Einstein then if passenger == Einstein then
heli.Move(ExtractionLZEntryPoint.Location) heli.Move(ExtractionLZEntryPoint.Location)
heli.Destroy() heli.Destroy()
Trigger.OnRemovedFromWorld(heli, function() Trigger.OnRemovedFromWorld(heli, function()
allies2.MarkCompletedObjective(objLimitLosses) Allies2.MarkCompletedObjective(LimitLossesObjective)
allies2.MarkCompletedObjective(objHoldPosition) Allies2.MarkCompletedObjective(HoldPositionObjective)
allies1.MarkCompletedObjective(objTanyaMustSurvive) Allies1.MarkCompletedObjective(TanyaMustSurviveObjective)
allies1.MarkCompletedObjective(objEinsteinSurvival) Allies1.MarkCompletedObjective(EinsteinSurvivalObjective)
allies1.MarkCompletedObjective(objExtractEinstein) Allies1.MarkCompletedObjective(ExtractEinsteinObjective)
end) end)
end end
end) end)
end) end)
Trigger.OnEnteredProximityTrigger(TownPoint.CenterPosition, WDist.FromCells(15), function(actor, trigger) Trigger.OnEnteredProximityTrigger(TownPoint.CenterPosition, WDist.FromCells(15), function(actor, trigger)
if actor.Owner == allies1 then if actor.Owner == Allies1 then
ReassignActors(TownUnits, neutral, allies1) ReassignActors(TownUnits, Neutral, Allies1)
Utils.Do(TownUnits, function(a) a.Stance = "Defend" end) Utils.Do(TownUnits, function(a) a.Stance = "Defend" end)
allies1.MarkCompletedObjective(objFindEinstein) Allies1.MarkCompletedObjective(FindEinsteinObjective)
objEinsteinSurvival = AddPrimaryObjective(allies1, "keep-einstein-alive-at-all-costs") EinsteinSurvivalObjective = AddPrimaryObjective(Allies1, "keep-einstein-alive-at-all-costs")
Trigger.OnKilled(Einstein, function() Trigger.OnKilled(Einstein, function()
allies1.MarkFailedObjective(objEinsteinSurvival) Allies1.MarkFailedObjective(EinsteinSurvivalObjective)
end) end)
Trigger.RemoveProximityTrigger(trigger) Trigger.RemoveProximityTrigger(trigger)
SovietTownAttack() SovietTownAttack()
@@ -277,11 +277,11 @@ SetupTriggers = function()
end) end)
Trigger.OnEnteredProximityTrigger(YakAttackPoint.CenterPosition, WDist.FromCells(5), function(actor, trigger) Trigger.OnEnteredProximityTrigger(YakAttackPoint.CenterPosition, WDist.FromCells(5), function(actor, trigger)
if not (Yak == nil or Yak.IsDead) or actor.Owner ~= allies1 then if not (Yak == nil or Yak.IsDead) or actor.Owner ~= Allies1 then
return return
end end
Yak = Actor.Create("yak", true, { Owner = soviets, Location = YakEntryPoint.Location, CenterPosition = YakEntryPoint.CenterPosition + WVec.New(0, 0, Actor.CruiseAltitude("yak")) }) Yak = Actor.Create("yak", true, { Owner = Soviets, Location = YakEntryPoint.Location, CenterPosition = YakEntryPoint.CenterPosition + WVec.New(0, 0, Actor.CruiseAltitude("yak")) })
Yak.Move(YakAttackPoint.Location + CVec.New(0, -10)) Yak.Move(YakAttackPoint.Location + CVec.New(0, -10))
Yak.CallFunc(YakAttack) Yak.CallFunc(YakAttack)
end) end)
@@ -292,9 +292,9 @@ SetupTriggers = function()
end end
SpawnTanya = function() SpawnTanya = function()
Tanya = Actor.Create(TanyaType, true, { Owner = allies1, Location = TanyaLocation.Location }) Tanya = Actor.Create(TanyaType, true, { Owner = Allies1, Location = TanyaLocation.Location })
if Difficulty ~= "easy" and allies1.IsLocalPlayer then if Difficulty ~= "easy" and Allies1.IsLocalPlayer then
Trigger.AfterDelay(DateTime.Seconds(2), function() Trigger.AfterDelay(DateTime.Seconds(2), function()
Media.DisplayMessage(UserInterface.Translate("tanya-rules-of-engagement"), UserInterface.Translate("tanya")) Media.DisplayMessage(UserInterface.Translate("tanya-rules-of-engagement"), UserInterface.Translate("tanya"))
end) end)
@@ -311,46 +311,46 @@ ReassignActors = function(actors, from, to)
end end
WorldLoaded = function() WorldLoaded = function()
neutral = Player.GetPlayer("Neutral") Neutral = Player.GetPlayer("Neutral")
-- Allies is the pre-set owner of units that get assigned to either the second player, if any, or the first player otherwise. -- Allies is the pre-set owner of units that get assigned to either the second player, if any, or the first player otherwise.
allies = Player.GetPlayer("Allies") Allies = Player.GetPlayer("Allies")
-- Allies1 is the player starting on the right, controlling Tanya -- Allies1 is the player starting on the right, controlling Tanya
allies1 = Player.GetPlayer("Allies1") Allies1 = Player.GetPlayer("Allies1")
-- Allies2 is the player starting on the left, defending the base -- Allies2 is the player starting on the left, defending the base
allies2 = Player.GetPlayer("Allies2") Allies2 = Player.GetPlayer("Allies2")
soviets = Player.GetPlayer("Soviets") Soviets = Player.GetPlayer("Soviets")
Utils.Do({ allies1, allies2 }, function(player) Utils.Do({ Allies1, Allies2 }, function(player)
if player and player.IsLocalPlayer then if player and player.IsLocalPlayer then
InitObjectives(player) InitObjectives(player)
end end
end) end)
if not allies2 or allies2.IsLocalPlayer then if not Allies2 or Allies2.IsLocalPlayer then
Camera.Position = Allies2BasePoint.CenterPosition Camera.Position = Allies2BasePoint.CenterPosition
else else
Camera.Position = ChinookHusk.CenterPosition Camera.Position = ChinookHusk.CenterPosition
end end
if not allies2 then if not Allies2 then
allies2 = allies1 Allies2 = Allies1
end end
ReassignActors(Map.ActorsInWorld, allies, allies2) ReassignActors(Map.ActorsInWorld, Allies, Allies2)
SpawnTanya() SpawnTanya()
objTanyaMustSurvive = AddPrimaryObjective(allies1, "tanya-survive") TanyaMustSurviveObjective = AddPrimaryObjective(Allies1, "tanya-survive")
objFindEinstein = AddPrimaryObjective(allies1, "find-einstein-crashed-helicopter") FindEinsteinObjective = AddPrimaryObjective(Allies1, "find-einstein-crashed-helicopter")
objDestroySamSites = AddPrimaryObjective(allies1, "destroy-sam-sites") DestroySamSitesObjective = AddPrimaryObjective(Allies1, "destroy-sam-sites")
objHoldPosition = AddPrimaryObjective(allies2, "hold-position-protect-base") HoldPositionObjective = AddPrimaryObjective(Allies2, "hold-position-protect-base")
local dontLoseMoreThan = UserInterface.Translate("keep-civilians-alive", { ["units"] = DeathThreshold[Difficulty] }) local dontLoseMoreThan = UserInterface.Translate("keep-civilians-alive", { ["units"] = DeathThreshold[Difficulty] })
objLimitLosses = AddSecondaryObjective(allies2, dontLoseMoreThan) LimitLossesObjective = AddSecondaryObjective(Allies2, dontLoseMoreThan)
objCutSovietPower = AddSecondaryObjective(allies2, "take-out-the-soviet-power-grid") CutSovietPowerObjective = AddSecondaryObjective(Allies2, "take-out-the-soviet-power-grid")
SetupTriggers() SetupTriggers()
SetupSoviets() SetupSoviets()

View File

@@ -108,13 +108,13 @@ SovietUnits2 =
CurrentReinforcement1 = 0 CurrentReinforcement1 = 0
CurrentReinforcement2 = 0 CurrentReinforcement2 = 0
SpawnAlliedUnit = function(units) SpawnAlliedUnit = function(units)
Reinforcements.Reinforce(allies1, units, { Allies1EntryPoint.Location, Allies1MovePoint.Location }) Reinforcements.Reinforce(Allies1, units, { Allies1EntryPoint.Location, Allies1MovePoint.Location })
if allies2 then if Allies2 then
Reinforcements.Reinforce(allies2, units, { Allies2EntryPoint.Location, Allies2MovePoint.Location }) Reinforcements.Reinforce(Allies2, units, { Allies2EntryPoint.Location, Allies2MovePoint.Location })
end end
Utils.Do(humans, function(player) Utils.Do(Humans, function(player)
Trigger.AfterDelay(DateTime.Seconds(2), function() Trigger.AfterDelay(DateTime.Seconds(2), function()
Media.PlaySpeechNotification(player, "AlliedReinforcementsNorth") Media.PlaySpeechNotification(player, "AlliedReinforcementsNorth")
end) end)
@@ -148,11 +148,11 @@ SpawnSovietUnits = function()
local unitType = Utils.Random(units) local unitType = Utils.Random(units)
local spawnPoint = Utils.Random(SovietEntryPoints) local spawnPoint = Utils.Random(SovietEntryPoints)
local rallyPoint = Utils.Random(SovietRallyPoints) local rallyPoint = Utils.Random(SovietRallyPoints)
local actor = Actor.Create(unitType, true, { Owner = soviets, Location = spawnPoint.Location }) local actor = Actor.Create(unitType, true, { Owner = Soviets, Location = spawnPoint.Location })
actor.AttackMove(rallyPoint.Location) actor.AttackMove(rallyPoint.Location)
IdleHunt(actor) IdleHunt(actor)
local delay = math.max(attackAtFrame - 5, minAttackAtFrame) local delay = math.max(AttackAtFrame[Difficulty] - 5, MinAttackAtFrame[Difficulty])
Trigger.AfterDelay(delay, SpawnSovietUnits) Trigger.AfterDelay(delay, SpawnSovietUnits)
end end
@@ -166,7 +166,7 @@ SendSovietParadrop = function()
SovietParadrop = SovietParadrop + 1 SovietParadrop = SovietParadrop + 1
Utils.Do(humans, function(player) Utils.Do(Humans, function(player)
Media.PlaySpeechNotification(player, "SovietForcesApproaching") Media.PlaySpeechNotification(player, "SovietForcesApproaching")
end) end)
@@ -176,16 +176,16 @@ SendSovietParadrop = function()
local randomParadropCell = CPos.New(x, y) local randomParadropCell = CPos.New(x, y)
local lz = Map.CenterOfCell(randomParadropCell) local lz = Map.CenterOfCell(randomParadropCell)
local powerproxy = Actor.Create("powerproxy.paratroopers", false, { Owner = soviets }) local powerproxy = Actor.Create("powerproxy.paratroopers", false, { Owner = Soviets })
powerproxy.TargetParatroopers(lz) powerproxy.TargetParatroopers(lz)
powerproxy.Destroy() powerproxy.Destroy()
Trigger.AfterDelay(sovietParadropTicks, SendSovietParadrop) Trigger.AfterDelay(SovietParadropTicks[Difficulty], SendSovietParadrop)
end end
AircraftTargets = function(yak) AircraftTargets = function(yak)
local targets = Utils.Where(Map.ActorsInWorld, function(a) local targets = Utils.Where(Map.ActorsInWorld, function(a)
return (a.Owner == allies1 or a.Owner == allies2) and a.HasProperty("Health") and yak.CanTarget(a) return (a.Owner == Allies1 or a.Owner == Allies2) and a.HasProperty("Health") and yak.CanTarget(a)
end) end)
-- Prefer mobile units -- Prefer mobile units
@@ -215,14 +215,14 @@ YakAttack = function(yak, target)
end end
ManageSovietAircraft = function() ManageSovietAircraft = function()
if allies1.IsObjectiveCompleted(destroyAirbases) then if Allies1.IsObjectiveCompleted(DestroyAirbases) then
return return
end end
local maxSovietYaks = MaxSovietYaks[Difficulty] local maxSovietYaks = MaxSovietYaks[Difficulty]
local sovietYaks = soviets.GetActorsByType('yak') local sovietYaks = Soviets.GetActorsByType('yak')
if #sovietYaks < maxSovietYaks then if #sovietYaks < maxSovietYaks then
soviets.Build(Yak, function(units) Soviets.Build(Yak, function(units)
local yak = units[1] local yak = units[1]
YakAttack(yak) YakAttack(yak)
end) end)
@@ -230,21 +230,21 @@ ManageSovietAircraft = function()
end end
SetEvacuateMissionText = function() SetEvacuateMissionText = function()
local attributes = { ["evacuated"] = UnitsEvacuated, ["threshold"] = unitsEvacuatedThreshold } local attributes = { ["evacuated"] = UnitsEvacuated, ["threshold"] = UnitsEvacuatedThreshold[Difficulty] }
local unitsEvacuated = UserInterface.Translate("units-evacuated", attributes) local unitsEvacuated = UserInterface.Translate("units-evacuated", attributes)
UserInterface.SetMissionText(unitsEvacuated, TextColor) UserInterface.SetMissionText(unitsEvacuated, TextColor)
end end
UnitsEvacuated = 0 UnitsEvacuated = 0
EvacuateAlliedUnit = function(unit) EvacuateAlliedUnit = function(unit)
if (unit.Owner == allies1 or unit.Owner == allies2) and unit.HasProperty("Move") then if (unit.Owner == Allies1 or unit.Owner == Allies2) and unit.HasProperty("Move") then
unit.Stop() unit.Stop()
unit.Owner = allies unit.Owner = Allies
if unit.Type == 'mgg' then if unit.Type == 'mgg' then
Utils.Do(humans, function(player) Utils.Do(Humans, function(player)
if player then if player then
player.MarkCompletedObjective(evacuateMgg) player.MarkCompletedObjective(EvacuateMgg)
end end
end) end)
end end
@@ -266,10 +266,10 @@ EvacuateAlliedUnit = function(unit)
SetEvacuateMissionText() SetEvacuateMissionText()
if UnitsEvacuated >= unitsEvacuatedThreshold then if UnitsEvacuated >= UnitsEvacuatedThreshold[Difficulty] then
Utils.Do(humans, function(player) Utils.Do(Humans, function(player)
if player then if player then
player.MarkCompletedObjective(evacuateUnits) player.MarkCompletedObjective(EvacuateUnits)
end end
end) end)
end end
@@ -280,9 +280,9 @@ Tick = function()
if DateTime.GameTime % 100 == 0 then if DateTime.GameTime % 100 == 0 then
ManageSovietAircraft() ManageSovietAircraft()
Utils.Do(humans, function(player) Utils.Do(Humans, function(player)
if player and player.HasNoRequiredUnits() then if player and player.HasNoRequiredUnits() then
soviets.MarkCompletedObjective(sovietObjective) Soviets.MarkCompletedObjective(SovietObjective)
end end
end) end)
end end
@@ -290,61 +290,56 @@ end
WorldLoaded = function() WorldLoaded = function()
-- NPC -- NPC
neutral = Player.GetPlayer("Neutral") Neutral = Player.GetPlayer("Neutral")
allies = Player.GetPlayer("Allies") Allies = Player.GetPlayer("Allies")
soviets = Player.GetPlayer("Soviets") Soviets = Player.GetPlayer("Soviets")
-- Player controlled -- Player controlled
allies1 = Player.GetPlayer("Allies1") Allies1 = Player.GetPlayer("Allies1")
allies2 = Player.GetPlayer("Allies2") Allies2 = Player.GetPlayer("Allies2")
humans = { allies1, allies2 } Humans = { Allies1, Allies2 }
Utils.Do(humans, function(player) Utils.Do(Humans, function(player)
if player and player.IsLocalPlayer then if player and player.IsLocalPlayer then
InitObjectives(player) InitObjectives(player)
TextColor = player.Color TextColor = player.Color
end end
end) end)
unitsEvacuatedThreshold = UnitsEvacuatedThreshold[Difficulty]
SetEvacuateMissionText() SetEvacuateMissionText()
Utils.Do(humans, function(player) Utils.Do(Humans, function(player)
if player then if player then
evacuateUnits = AddPrimaryObjective(player, UserInterface.Translate("evacuate-units", { ["threshold"] = unitsEvacuatedThreshold })) EvacuateUnits = AddPrimaryObjective(player, UserInterface.Translate("evacuate-units", { ["threshold"] = UnitsEvacuatedThreshold[Difficulty] }))
destroyAirbases = AddSecondaryObjective(player, "destroy-nearby-soviet-airbases") DestroyAirbases = AddSecondaryObjective(player, "destroy-nearby-soviet-airbases")
evacuateMgg = AddSecondaryObjective(player, "evacuate-at-least-one-gap-generator") EvacuateMgg = AddSecondaryObjective(player, "evacuate-at-least-one-gap-generator")
end end
end) end)
Trigger.OnAllKilledOrCaptured(SovietAirfields, function() Trigger.OnAllKilledOrCaptured(SovietAirfields, function()
Utils.Do(humans, function(player) Utils.Do(Humans, function(player)
if player then if player then
player.MarkCompletedObjective(destroyAirbases) player.MarkCompletedObjective(DestroyAirbases)
end end
end) end)
end) end)
sovietObjective = AddPrimaryObjective(soviets, "") SovietObjective = AddPrimaryObjective(Soviets, "")
if not allies2 or allies1.IsLocalPlayer then if not Allies2 or Allies1.IsLocalPlayer then
Camera.Position = Allies1EntryPoint.CenterPosition Camera.Position = Allies1EntryPoint.CenterPosition
else else
Camera.Position = Allies2EntryPoint.CenterPosition Camera.Position = Allies2EntryPoint.CenterPosition
end end
if not allies2 then if not Allies2 then
allies1.Cash = 10000 Allies1.Cash = 10000
Media.DisplayMessage(UserInterface.Translate("transferring-funds"), UserInterface.Translate("co-commander-missing")) Media.DisplayMessage(UserInterface.Translate("transferring-funds"), UserInterface.Translate("co-commander-missing"))
end end
SpawnAlliedUnit(MobileConstructionVehicle) SpawnAlliedUnit(MobileConstructionVehicle)
minAttackAtFrame = MinAttackAtFrame[Difficulty] Trigger.AfterDelay(AttackAtFrame[Difficulty], SpawnSovietUnits)
attackAtFrame = AttackAtFrame[Difficulty] Trigger.AfterDelay(SovietParadropTicks[Difficulty], SendSovietParadrop)
Trigger.AfterDelay(attackAtFrame, SpawnSovietUnits)
sovietParadropTicks = SovietParadropTicks[Difficulty]
Trigger.AfterDelay(sovietParadropTicks, SendSovietParadrop)
Trigger.OnEnteredFootprint(MountainEntry, EvacuateAlliedUnit) Trigger.OnEnteredFootprint(MountainEntry, EvacuateAlliedUnit)
Trigger.OnEnteredFootprint(BridgeEntry, EvacuateAlliedUnit) Trigger.OnEnteredFootprint(BridgeEntry, EvacuateAlliedUnit)

View File

@@ -36,7 +36,7 @@ FootprintTrigger12 = { CPos.New(35, 39), CPos.New(35, 40), CPos.New(35, 41), CPo
ExtractionHelicopterType = "tran" ExtractionHelicopterType = "tran"
ExtractionPath = { ChinookEntry.Location, ExtractionPoint.Location } ExtractionPath = { ChinookEntry.Location, ExtractionPoint.Location }
lstReinforcements = LstReinforcements =
{ {
first = first =
{ {
@@ -241,7 +241,7 @@ FootprintTriggers = function()
Trigger.RemoveFootprintTrigger(id) Trigger.RemoveFootprintTrigger(id)
foot6Triggered = true foot6Triggered = true
local reinforcement = lstReinforcements.first local reinforcement = LstReinforcements.first
Media.PlaySpeechNotification(Allies, "ReinforcementsArrived") Media.PlaySpeechNotification(Allies, "ReinforcementsArrived")
Reinforcements.ReinforceWithTransport(Allies, "lst.reinforcement", reinforcement.actors, reinforcement.entryPath, reinforcement.exitPath) Reinforcements.ReinforceWithTransport(Allies, "lst.reinforcement", reinforcement.actors, reinforcement.entryPath, reinforcement.exitPath)
end end
@@ -349,7 +349,7 @@ FootprintTriggers = function()
trig11camera.Destroy() trig11camera.Destroy()
end) end)
local reinforcement = lstReinforcements.second local reinforcement = LstReinforcements.second
Media.PlaySpeechNotification(Allies, "ReinforcementsArrived") Media.PlaySpeechNotification(Allies, "ReinforcementsArrived")
Reinforcements.ReinforceWithTransport(Allies, "lst.reinforcement", reinforcement.actors, reinforcement.entryPath, reinforcement.exitPath) Reinforcements.ReinforceWithTransport(Allies, "lst.reinforcement", reinforcement.actors, reinforcement.entryPath, reinforcement.exitPath)
end end

View File

@@ -47,7 +47,7 @@ end
InitialInfantryProduction = function(id, units) InitialInfantryProduction = function(id, units)
local productionComplete = AIPlayers[id].Build(units, function(actors) local productionComplete = AIPlayers[id].Build(units, function(actors)
InfantryProduction(id) ProduceInfantry(id)
end) end)
Trigger.OnProduction(AIBarracks[id], function(producer, produced) Trigger.OnProduction(AIBarracks[id], function(producer, produced)
@@ -55,13 +55,13 @@ InitialInfantryProduction = function(id, units)
end) end)
end end
InfantryProduction = function(id) ProduceInfantry = function(id)
local productionComplete = AIPlayers[id].Build({ Utils.Random(UnitsToBuild) }, function(actors) local productionComplete = AIPlayers[id].Build({ Utils.Random(UnitsToBuild) }, function(actors)
Trigger.AfterDelay(0, function() InfantryProduction(id) end) Trigger.AfterDelay(0, function() ProduceInfantry(id) end)
end) end)
if not productionComplete then if not productionComplete then
Trigger.AfterDelay(0, function() InfantryProduction(id) end) Trigger.AfterDelay(0, function() ProduceInfantry(id) end)
end end
end end

View File

@@ -100,7 +100,7 @@ IdleHunt = function(actor)
end end
SendUnits = function(entryCell, unitTypes, targetCell, extraData) SendUnits = function(entryCell, unitTypes, targetCell, extraData)
Reinforcements.Reinforce(soviets, unitTypes, { entryCell }, 40, function(a) Reinforcements.Reinforce(Soviets, unitTypes, { entryCell }, 40, function(a)
if not a.HasProperty("AttackMove") then if not a.HasProperty("AttackMove") then
Trigger.OnIdle(a, function(a) Trigger.OnIdle(a, function(a)
a.Move(targetCell) a.Move(targetCell)
@@ -140,7 +140,7 @@ SendWave = function()
end) end)
end end
Utils.Do(players, function(player) Utils.Do(Players, function(player)
Media.PlaySpeechNotification(player, "EnemyUnitsApproaching") Media.PlaySpeechNotification(player, "EnemyUnitsApproaching")
end) end)
@@ -174,7 +174,7 @@ end
SovietsRetreating = function() SovietsRetreating = function()
Utils.Do(Snipers, function(a) Utils.Do(Snipers, function(a)
if not a.IsDead and a.Owner == soviets then if not a.IsDead and a.Owner == Soviets then
a.Destroy() a.Destroy()
end end
end) end)
@@ -201,7 +201,7 @@ Tick = function()
end end
SetupWallOwners = function() SetupWallOwners = function()
Utils.Do(players, function(player) Utils.Do(Players, function(player)
Utils.Do(Walls[player.Spawn], function(wall) Utils.Do(Walls[player.Spawn], function(wall)
wall.Owner = player wall.Owner = player
end) end)
@@ -209,14 +209,14 @@ SetupWallOwners = function()
end end
WorldLoaded = function() WorldLoaded = function()
soviets = Player.GetPlayer("Soviets") Soviets = Player.GetPlayer("Soviets")
players = { } Players = { }
for i = 0, 4 do for i = 0, 4 do
local player = Player.GetPlayer("Multi" ..i) local player = Player.GetPlayer("Multi" ..i)
players[i] = player Players[i] = player
if players[i] and players[i].IsBot then if Players[i] and Players[i].IsBot then
ActivateAI(players[i], i) ActivateAI(Players[i], i)
end end
end end
@@ -224,6 +224,6 @@ WorldLoaded = function()
SetupWallOwners() SetupWallOwners()
ParaProxy = Actor.Create("powerproxy.paratroopers", false, { Owner = soviets }) ParaProxy = Actor.Create("powerproxy.paratroopers", false, { Owner = Soviets })
SendWave() SendWave()
end end

View File

@@ -129,7 +129,7 @@ AlliedReinforcements = function()
Media.PlaySpeechNotification(Greece, "ReinforcementsArrived") Media.PlaySpeechNotification(Greece, "ReinforcementsArrived")
local chinookChalk2 = Reinforcements.ReinforceWithTransport(Greece, "tran.reinforcement", NorthChinookChalk, NorthChinookPath, { NorthChinookPath[1] }) local chinookChalk2 = Reinforcements.ReinforceWithTransport(Greece, "tran.reinforcement", NorthChinookChalk, NorthChinookPath, { NorthChinookPath[1] })
InfantryProduction() ProduceInfantry()
TankProduction() TankProduction()
end end
end) end)
@@ -266,7 +266,7 @@ AttackGroupSize = 4
ProductionDelay = DateTime.Seconds(10) ProductionDelay = DateTime.Seconds(10)
IdlingUnits = { } IdlingUnits = { }
InfantryProduction = function() ProduceInfantry = function()
if (Tent1.IsDead or Tent1.Owner ~= USSR) and (Tent2.IsDead or Tent2.Owner ~= USSR) then if (Tent1.IsDead or Tent1.Owner ~= USSR) and (Tent2.IsDead or Tent2.Owner ~= USSR) then
return return
end end
@@ -275,7 +275,7 @@ InfantryProduction = function()
USSR.Build(toBuild, function(unit) USSR.Build(toBuild, function(unit)
IdlingUnits[#IdlingUnits + 1] = unit[1] IdlingUnits[#IdlingUnits + 1] = unit[1]
Trigger.AfterDelay(ProductionDelay, InfantryProduction) Trigger.AfterDelay(ProductionDelay, ProduceInfantry)
if #IdlingUnits >= (AttackGroupSize * 1.5) then if #IdlingUnits >= (AttackGroupSize * 1.5) then
SendAttack() SendAttack()
@@ -336,19 +336,19 @@ LoseTriggers = function()
end) end)
end end
ticked = TimerTicks Ticked = TimerTicks
Tick = function() Tick = function()
if Greece.HasNoRequiredUnits() and UnitsArrived then if Greece.HasNoRequiredUnits() and UnitsArrived then
USSR.MarkCompletedObjective(SovietObj) USSR.MarkCompletedObjective(SovietObj)
end end
if ticked > 0 then if Ticked > 0 then
if (ticked % DateTime.Seconds(1)) == 0 then if (Ticked % DateTime.Seconds(1)) == 0 then
Timer = UserInterface.Translate("chronosphere-explodes-in", { ["time"] = Utils.FormatTime(ticked) }) Timer = UserInterface.Translate("chronosphere-explodes-in", { ["time"] = Utils.FormatTime(Ticked) })
UserInterface.SetMissionText(Timer, TimerColor) UserInterface.SetMissionText(Timer, TimerColor)
end end
ticked = ticked - 1 Ticked = Ticked - 1
elseif ticked == 0 then elseif Ticked == 0 then
UserInterface.SetMissionText(UserInterface.Translate("too-late"), USSR.Color) UserInterface.SetMissionText(UserInterface.Translate("too-late"), USSR.Color)
USSR.MarkCompletedObjective(SovietObj) USSR.MarkCompletedObjective(SovietObj)
end end

View File

@@ -40,25 +40,25 @@ Patrol3 = { "e1", "e1", "dog.patrol" }
TransportType = "lst.unselectable.unloadonly" TransportType = "lst.unselectable.unloadonly"
SecureLabFailed = function() SecureLabFailed = function()
Utils.Do(humans, function(player) Utils.Do(Humans, function(player)
if player then if player then
player.MarkFailedObjective(secureLab) player.MarkFailedObjective(SecureLab)
end end
end) end)
end end
timerStarted = false TimerStarted = false
StartTimer = function() StartTimer = function()
Utils.Do(humans, function(player) Utils.Do(Humans, function(player)
if player.IsLocalPlayer then if player.IsLocalPlayer then
TimerColor = player.Color TimerColor = player.Color
end end
end) end)
CountDownTimerAnnouncements() CountDownTimerAnnouncements()
ticked = TimerTicks Ticked = TimerTicks
timerStarted = true TimerStarted = true
Trigger.AfterDelay(DateTime.Seconds(3), function() Trigger.AfterDelay(DateTime.Seconds(3), function()
Utils.Do(humans, function(player) Utils.Do(Humans, function(player)
Media.PlaySpeechNotification(player, "TimerStarted") Media.PlaySpeechNotification(player, "TimerStarted")
end) end)
end) end)
@@ -68,8 +68,8 @@ CountDownTimerAnnouncements = function()
for i = #Announcements, 1, -1 do for i = #Announcements, 1, -1 do
local delay = TimerTicks - Announcements[i].delay local delay = TimerTicks - Announcements[i].delay
Trigger.AfterDelay(delay, function() Trigger.AfterDelay(delay, function()
if not labSecured then if not LabSecured then
Utils.Do(humans, function(player) Utils.Do(Humans, function(player)
Media.PlaySpeechNotification(player, Announcements[i].speech) Media.PlaySpeechNotification(player, Announcements[i].speech)
end) end)
end end
@@ -77,13 +77,13 @@ CountDownTimerAnnouncements = function()
end end
end end
reinforcementsHaveArrived = false ReinforcementsHaveArrived = false
LabInfiltrated = function() LabInfiltrated = function()
Utils.Do(humans, function(player) Utils.Do(Humans, function(player)
if player then if player then
secureLab = AddPrimaryObjective(player, "secure-laboratory-guards") SecureLab = AddPrimaryObjective(player, "secure-laboratory-guards")
destroyBase = AddPrimaryObjective(player, "destroy-remaining-soviet-presence") DestroyBase = AddPrimaryObjective(player, "destroy-remaining-soviet-presence")
player.MarkCompletedObjective(infiltrateLab) player.MarkCompletedObjective(InfiltrateLab)
Trigger.ClearAll(Lab) Trigger.ClearAll(Lab)
Trigger.AfterDelay(0, function() Trigger.AfterDelay(0, function()
Trigger.OnKilled(Lab, SecureLabFailed) Trigger.OnKilled(Lab, SecureLabFailed)
@@ -95,46 +95,46 @@ LabInfiltrated = function()
local entryPath = { ReinforcementsEntryPoint.Location, ReinforcementsUnloadPoint.Location } local entryPath = { ReinforcementsEntryPoint.Location, ReinforcementsUnloadPoint.Location }
local exit = { ReinforcementsEntryPoint.Location } local exit = { ReinforcementsEntryPoint.Location }
mcvActors = { "mcv" } local mcvActors = { "mcv" }
if player2 then if Allies2 then
mcvActors = { "mcv", "mcv" } mcvActors = { "mcv", "mcv" }
end end
local reinforcements = Reinforcements.ReinforceWithTransport(allies, TransportType, mcvActors, entryPath, exit) local reinforcements = Reinforcements.ReinforceWithTransport(Allies, TransportType, mcvActors, entryPath, exit)
local mcvs = reinforcements[2] local mcvs = reinforcements[2]
Trigger.OnAddedToWorld(mcvs[1], function(mcvUnloaded) Trigger.OnAddedToWorld(mcvs[1], function(mcvUnloaded)
-- Don't call this twice (because of the owner change) -- Don't call this twice (because of the owner change)
if mcvUnloaded.Owner == player1 then if mcvUnloaded.Owner == Allies1 then
return return
end end
mcvUnloaded.Owner = player1 mcvUnloaded.Owner = Allies1
if not player2 then if not Allies2 then
player1.Cash = 5000 Allies1.Cash = 5000
end end
Media.PlaySpeechNotification(player, "AlliedReinforcementsSouth") Media.PlaySpeechNotification(Allies1, "AlliedReinforcementsSouth")
StartTimer() StartTimer()
HijackTruck.Destroy() HijackTruck.Destroy()
reinforcementsHaveArrived = true ReinforcementsHaveArrived = true
end) end)
if player2 then if Allies2 then
Trigger.OnAddedToWorld(mcvs[2], function(mcvUnloaded) Trigger.OnAddedToWorld(mcvs[2], function(mcvUnloaded)
-- Don't call this twice (because of the owner change) -- Don't call this twice (because of the owner change)
if mcvUnloaded.Owner == player2 then if mcvUnloaded.Owner == Allies2 then
return return
end end
mcvUnloaded.Owner = player2 mcvUnloaded.Owner = Allies2
player1.Cash = 2500 Allies1.Cash = 2500
player2.Cash = 2500 Allies2.Cash = 2500
end) end)
end end
Utils.Do(humans, function(player) Utils.Do(Humans, function(player)
for i = 0, 2 do for i = 0, 2 do
Trigger.AfterDelay(DateTime.Seconds(i), function() Trigger.AfterDelay(DateTime.Seconds(i), function()
Media.PlaySoundNotification(player, "AlertBuzzer") Media.PlaySoundNotification(player, "AlertBuzzer")
@@ -155,9 +155,9 @@ LabInfiltrated = function()
end end
InfiltrateLabFailed = function() InfiltrateLabFailed = function()
Utils.Do(humans, function(player) Utils.Do(Humans, function(player)
if player then if player then
player.MarkFailedObjective(infiltrateLab) player.MarkFailedObjective(InfiltrateLab)
end end
end) end)
end end
@@ -170,14 +170,14 @@ ChangeOwnerOnAddedToWorld = function(actor, newOwner)
end end
InsertSpies = function() InsertSpies = function()
Utils.Do(humans, function(player) Utils.Do(Humans, function(player)
if player then if player then
infiltrateLab = AddPrimaryObjective(player, "infiltrate-laboratory") InfiltrateLab = AddPrimaryObjective(player, "infiltrate-laboratory")
end end
end) end)
Trigger.OnKilled(Lab, function() Trigger.OnKilled(Lab, function()
if not player1.IsObjectiveCompleted(infiltrateLab) then if not Allies1.IsObjectiveCompleted(InfiltrateLab) then
InfiltrateLabFailed() InfiltrateLabFailed()
end end
end) end)
@@ -188,30 +188,30 @@ InsertSpies = function()
Trigger.OnInfiltrated(Lab, function() Trigger.OnInfiltrated(Lab, function()
infiltrationCount = infiltrationCount + 1 infiltrationCount = infiltrationCount + 1
if (player2 and infiltrationCount == 2) or not player2 then if (Allies2 and infiltrationCount == 2) or not Allies2 then
Trigger.AfterDelay(DateTime.Seconds(3), LabInfiltrated) Trigger.AfterDelay(DateTime.Seconds(3), LabInfiltrated)
end end
end) end)
spyActors = { "spy.strong" } local spyActors = { "spy.strong" }
if player2 then if Allies2 then
spyActors = { "spy.strong", "spy.strong" } spyActors = { "spy.strong", "spy.strong" }
end end
local entryPath = { SpyReinforcementsEntryPoint.Location, SpyReinforcementsUnloadPoint.Location } local entryPath = { SpyReinforcementsEntryPoint.Location, SpyReinforcementsUnloadPoint.Location }
local exit = { SpyReinforcementsExitPoint.Location } local exit = { SpyReinforcementsExitPoint.Location }
local reinforcements = Reinforcements.ReinforceWithTransport(allies, TransportType, spyActors, entryPath, exit) local reinforcements = Reinforcements.ReinforceWithTransport(Allies, TransportType, spyActors, entryPath, exit)
local transport = reinforcements[1] local transport = reinforcements[1]
Camera.Position = transport.CenterPosition Camera.Position = transport.CenterPosition
spies = reinforcements[2] local spies = reinforcements[2]
Trigger.OnAnyKilled(spies, InfiltrateLabFailed) Trigger.OnAnyKilled(spies, InfiltrateLabFailed)
ChangeOwnerOnAddedToWorld(spies[1], player1) ChangeOwnerOnAddedToWorld(spies[1], Allies1)
if player2 then if Allies2 then
ChangeOwnerOnAddedToWorld(spies[2], player2) ChangeOwnerOnAddedToWorld(spies[2], Allies2)
end end
end end
@@ -237,7 +237,7 @@ CapOre = function(player)
end end
NewPatrol = function(actorType, start, waypoints) NewPatrol = function(actorType, start, waypoints)
local guard = Actor.Create(actorType, true, { Owner = soviets, Location = start }) local guard = Actor.Create(actorType, true, { Owner = Soviets, Location = start })
guard.Patrol(waypoints, true, Utils.RandomInteger(50, 75)) guard.Patrol(waypoints, true, Utils.RandomInteger(50, 75))
end end
@@ -260,20 +260,20 @@ SetupPatrols = function()
end) end)
end end
ticked = 0 Ticked = 0
SecureLabTimer = function() SecureLabTimer = function()
if not timerStarted or labSecured then if not TimerStarted or LabSecured then
return return
end end
if ticked > 0 then if Ticked > 0 then
if (ticked % DateTime.Seconds(1)) == 0 then if (Ticked % DateTime.Seconds(1)) == 0 then
Timer = UserInterface.Translate("secure-lab-in", { ["time"] = Utils.FormatTime(ticked) }) Timer = UserInterface.Translate("secure-lab-in", { ["time"] = Utils.FormatTime(Ticked) })
UserInterface.SetMissionText(Timer, TimerColor) UserInterface.SetMissionText(Timer, TimerColor)
end end
ticked = ticked - 1 Ticked = Ticked - 1
elseif ticked <= 0 then elseif Ticked <= 0 then
TimerColor = soviets.Color TimerColor = Soviets.Color
UserInterface.SetMissionText(UserInterface.Translate("soviet-research-lab-not-secured-in-time"), TimerColor) UserInterface.SetMissionText(UserInterface.Translate("soviet-research-lab-not-secured-in-time"), TimerColor)
SecureLabFailed() SecureLabFailed()
end end
@@ -281,18 +281,18 @@ end
SovietBaseMaintenanceSetup = function() SovietBaseMaintenanceSetup = function()
local sovietbuildings = Utils.Where(Map.NamedActors, function(a) local sovietbuildings = Utils.Where(Map.NamedActors, function(a)
return a.Owner == soviets and a.HasProperty("StartBuildingRepairs") return a.Owner == Soviets and a.HasProperty("StartBuildingRepairs")
end) end)
Trigger.OnAllKilledOrCaptured(sovietbuildings, function() Trigger.OnAllKilledOrCaptured(sovietbuildings, function()
Utils.Do(humans, function(player) Utils.Do(Humans, function(player)
player.MarkCompletedObjective(destroyBase) player.MarkCompletedObjective(DestroyBase)
end) end)
end) end)
Utils.Do(sovietbuildings, function(sovietbuilding) Utils.Do(sovietbuildings, function(sovietbuilding)
Trigger.OnDamaged(sovietbuilding, function(building) Trigger.OnDamaged(sovietbuilding, function(building)
if building.Owner == soviets and building.Health < building.MaxHealth * 3/4 then if building.Owner == Soviets and building.Health < building.MaxHealth * 3/4 then
building.StartBuildingRepairs() building.StartBuildingRepairs()
end end
end) end)
@@ -300,61 +300,61 @@ SovietBaseMaintenanceSetup = function()
end end
CheckPlayerDefeat = function() CheckPlayerDefeat = function()
if not reinforcementsHaveArrived then if not ReinforcementsHaveArrived then
return return
end end
Utils.Do(humans, function(player) Utils.Do(Humans, function(player)
if player.HasNoRequiredUnits() then if player.HasNoRequiredUnits() then
player.MarkFailedObjective(destroyBase) player.MarkFailedObjective(DestroyBase)
end end
end) end)
end end
labSecured = false LabSecured = false
CheckLabSecured = function() CheckLabSecured = function()
if not reinforcementsHaveArrived or labSecured then if not ReinforcementsHaveArrived or LabSecured then
return return
end end
if player1.HasNoRequiredUnits() or (player2 and player2.HasNoRequiredUnits()) then if Allies1.HasNoRequiredUnits() or (Allies2 and Allies2.HasNoRequiredUnits()) then
Utils.Do(humans, function(player) Utils.Do(Humans, function(player)
player.MarkFailedObjective(secureLab) player.MarkFailedObjective(SecureLab)
end) end)
end end
local radius = WDist.FromCells(10) local radius = WDist.FromCells(10)
local labGuards = Utils.Where(Map.ActorsInCircle(LabWaypoint.CenterPosition, radius), function(a) local labGuards = Utils.Where(Map.ActorsInCircle(LabWaypoint.CenterPosition, radius), function(a)
return a.Owner == soviets and a.HasProperty("Move") return a.Owner == Soviets and a.HasProperty("Move")
end) end)
if #labGuards < 1 then if #labGuards < 1 then
labSecured = true LabSecured = true
Utils.Do(humans, function(player) Utils.Do(Humans, function(player)
player.MarkCompletedObjective(secureLab) player.MarkCompletedObjective(SecureLab)
end) end)
UserInterface.SetMissionText("") UserInterface.SetMissionText("")
end end
end end
Tick = function() Tick = function()
CapOre(soviets) CapOre(Soviets)
SecureLabTimer() SecureLabTimer()
CheckLabSecured() CheckLabSecured()
CheckPlayerDefeat() CheckPlayerDefeat()
end end
WorldLoaded = function() WorldLoaded = function()
allies = Player.GetPlayer("Allies") Allies = Player.GetPlayer("Allies")
neutral = Player.GetPlayer("Neutral") Neutral = Player.GetPlayer("Neutral")
creeps = Player.GetPlayer("Creeps") Creeps = Player.GetPlayer("Creeps")
soviets = Player.GetPlayer("Soviets") Soviets = Player.GetPlayer("Soviets")
player1 = Player.GetPlayer("Allies1") Allies1 = Player.GetPlayer("Allies1")
player2 = Player.GetPlayer("Allies2") Allies2 = Player.GetPlayer("Allies2")
humans = { player1, player2 } Humans = { Allies1, Allies2 }
Utils.Do(humans, function(player) Utils.Do(Humans, function(player)
if player and player.IsLocalPlayer then if player and player.IsLocalPlayer then
InitObjectives(player) InitObjectives(player)
end end

View File

@@ -62,7 +62,7 @@ GroundPatrolUnits =
} }
ParadropSovietUnits = function() ParadropSovietUnits = function()
local powerproxy = Actor.Create("powerproxy.paratroopers", false, { Owner = soviets }) local powerproxy = Actor.Create("powerproxy.paratroopers", false, { Owner = Soviets })
local aircraft = powerproxy.TargetParatroopers(MCVDeployLocation.CenterPosition, Angle.New(812)) local aircraft = powerproxy.TargetParatroopers(MCVDeployLocation.CenterPosition, Angle.New(812))
Utils.Do(aircraft, function(a) Utils.Do(aircraft, function(a)
Trigger.OnPassengerExited(a, function(t, p) Trigger.OnPassengerExited(a, function(t, p)
@@ -81,7 +81,7 @@ AirRaid = function(planeTypes, ingress, target)
for i = 1, #planeTypes do for i = 1, #planeTypes do
Trigger.AfterDelay((i - 1) * DateTime.Seconds(1), function() Trigger.AfterDelay((i - 1) * DateTime.Seconds(1), function()
local start = Map.CenterOfCell(ingress[1]) + WVec.New(0, 0, Actor.CruiseAltitude(planeTypes[i])) local start = Map.CenterOfCell(ingress[1]) + WVec.New(0, 0, Actor.CruiseAltitude(planeTypes[i]))
local plane = Actor.Create(planeTypes[i], true, { CenterPosition = start, Owner = soviets, Facing = (Map.CenterOfCell(ingress[2]) - start).Facing }) local plane = Actor.Create(planeTypes[i], true, { CenterPosition = start, Owner = Soviets, Facing = (Map.CenterOfCell(ingress[2]) - start).Facing })
Utils.Do(ingress, function(wpt) plane.Move(wpt) end) Utils.Do(ingress, function(wpt) plane.Move(wpt) end)
plane.Attack(target) plane.Attack(target)
@@ -91,7 +91,7 @@ end
BaseRaid = function() BaseRaid = function()
local targets = Map.ActorsInBox(AlliedAreaTopLeft.CenterPosition, AlliedAreaBottomRight.CenterPosition, function(actor) local targets = Map.ActorsInBox(AlliedAreaTopLeft.CenterPosition, AlliedAreaBottomRight.CenterPosition, function(actor)
return actor.Owner == player and actor.HasProperty("StartBuildingRepairs") return actor.Owner == Allies and actor.HasProperty("StartBuildingRepairs")
end) end)
if #targets == 0 then if #targets == 0 then
@@ -163,7 +163,7 @@ BaseRearAttack = function(team)
end end
Build = function(units, action) Build = function(units, action)
if not soviets.Build(units, action) then if not Soviets.Build(units, action) then
Trigger.AfterDelay(DateTime.Seconds(15), function() Trigger.AfterDelay(DateTime.Seconds(15), function()
Build(units, action) Build(units, action)
end) end)
@@ -185,9 +185,9 @@ SetupWorld = function()
end) end)
Utils.Do(Map.NamedActors, function(actor) Utils.Do(Map.NamedActors, function(actor)
if actor.Owner == soviets and actor.HasProperty("StartBuildingRepairs") then if actor.Owner == Soviets and actor.HasProperty("StartBuildingRepairs") then
Trigger.OnDamaged(actor, function(building) Trigger.OnDamaged(actor, function(building)
if building.Owner == soviets then if building.Owner == Soviets then
building.StartBuildingRepairs() building.StartBuildingRepairs()
end end
end) end)
@@ -227,12 +227,12 @@ end
Tick = function() Tick = function()
if DateTime.GameTime > 2 then if DateTime.GameTime > 2 then
if soviets.Resources > soviets.ResourceCapacity * 0.75 then if Soviets.Resources > Soviets.ResourceCapacity * 0.75 then
soviets.Resources = soviets.Resources - ((soviets.ResourceCapacity * 0.01) / 25) Soviets.Resources = Soviets.Resources - ((Soviets.ResourceCapacity * 0.01) / 25)
end end
if player.HasNoRequiredUnits() then if Allies.HasNoRequiredUnits() then
player.MarkFailedObjective(villageObjective) Allies.MarkFailedObjective(VillageObjective)
end end
if CachedVillagePercentage ~= VillagePercentage then if CachedVillagePercentage ~= VillagePercentage then
@@ -244,43 +244,43 @@ Tick = function()
end end
WorldLoaded = function() WorldLoaded = function()
player = Player.GetPlayer("Allies") Allies = Player.GetPlayer("Allies")
soviets = Player.GetPlayer("Soviets") Soviets = Player.GetPlayer("Soviets")
InitObjectives(player) InitObjectives(Allies)
sovietObjective = AddPrimaryObjective(soviets, "") SovietObjective = AddPrimaryObjective(Soviets, "")
villageObjective = AddPrimaryObjective(player, "save-village") VillageObjective = AddPrimaryObjective(Allies, "save-village")
beachheadObjective = AddPrimaryObjective(player, "mcv-main-island") BeachheadObjective = AddPrimaryObjective(Allies, "mcv-main-island")
beachheadTrigger = false BeachheadTriggered = false
Trigger.OnExitedFootprint(BeachheadTrigger, function(a, id) Trigger.OnExitedFootprint(BeachheadTrigger, function(a, id)
if not beachheadTrigger and a.Owner == player and a.Type == "mcv" then if not BeachheadTriggered and a.Owner == Allies and a.Type == "mcv" then
beachheadTrigger = true BeachheadTriggered = true
Trigger.RemoveFootprintTrigger(id) Trigger.RemoveFootprintTrigger(id)
player.MarkCompletedObjective(beachheadObjective) Allies.MarkCompletedObjective(BeachheadObjective)
captureObjective = AddPrimaryObjective(player, "capture-air-force-hq") CaptureObjective = AddPrimaryObjective(Allies, "capture-air-force-hq")
if AirForceHQ.IsDead then if AirForceHQ.IsDead then
player.MarkFailedObjective(captureObjective) Allies.MarkFailedObjective(CaptureObjective)
return return
end end
if AirForceHQ.Owner == player then if AirForceHQ.Owner == Allies then
player.MarkCompletedObjective(captureObjective) Allies.MarkCompletedObjective(CaptureObjective)
player.MarkCompletedObjective(villageObjective) Allies.MarkCompletedObjective(VillageObjective)
return return
end end
Trigger.OnCapture(AirForceHQ, function() Trigger.OnCapture(AirForceHQ, function()
Trigger.AfterDelay(DateTime.Seconds(3), function() Trigger.AfterDelay(DateTime.Seconds(3), function()
player.MarkCompletedObjective(captureObjective) Allies.MarkCompletedObjective(CaptureObjective)
player.MarkCompletedObjective(villageObjective) Allies.MarkCompletedObjective(VillageObjective)
end) end)
end) end)
Trigger.OnKilled(AirForceHQ, function() player.MarkFailedObjective(captureObjective) end) Trigger.OnKilled(AirForceHQ, function() Allies.MarkFailedObjective(CaptureObjective) end)
Actor.Create("mainland", true, { Owner = player }) Actor.Create("mainland", true, { Owner = Allies })
Trigger.AfterDelay(BaseFrontAttackInterval, function() Trigger.AfterDelay(BaseFrontAttackInterval, function()
Build(BaseFrontAttackUnits, BaseFrontAttack) Build(BaseFrontAttackUnits, BaseFrontAttack)
@@ -301,7 +301,7 @@ WorldLoaded = function()
end end
end) end)
Trigger.OnAllKilled(Village, function() player.MarkFailedObjective(villageObjective) end) Trigger.OnAllKilled(Village, function() Allies.MarkFailedObjective(VillageObjective) end)
SetupWorld() SetupWorld()
SetupMissionText() SetupMissionText()
@@ -311,7 +311,7 @@ WorldLoaded = function()
Trigger.AfterDelay(1, function() Build(UBoatPatrolUnits, SendUboatPatrol) end) Trigger.AfterDelay(1, function() Build(UBoatPatrolUnits, SendUboatPatrol) end)
Trigger.AfterDelay(1, function() Build(Utils.Random(GroundPatrolUnits), SendGroundPatrol) end) Trigger.AfterDelay(1, function() Build(Utils.Random(GroundPatrolUnits), SendGroundPatrol) end)
Reinforcements.Reinforce(player, { "mcv" }, { MCVInsertLocation.Location, MCVDeployLocation.Location }, 0, function(mcv) Reinforcements.Reinforce(Allies, { "mcv" }, { MCVInsertLocation.Location, MCVDeployLocation.Location }, 0, function(mcv)
mcv.Deploy() mcv.Deploy()
end) end)

View File

@@ -30,13 +30,13 @@ DemitriAreaTrigger = { CPos.New(32, 98), CPos.New(32, 99), CPos.New(33, 99), CPo
HospitalAreaTrigger = { CPos.New(43, 41), CPos.New(44, 41), CPos.New(45, 41), CPos.New(46, 41), CPos.New(46, 42), CPos.New(46, 43), CPos.New(46, 44), CPos.New(46, 45), CPos.New(46, 46), CPos.New(45, 46), CPos.New(44, 46), CPos.New(43, 46) } HospitalAreaTrigger = { CPos.New(43, 41), CPos.New(44, 41), CPos.New(45, 41), CPos.New(46, 41), CPos.New(46, 42), CPos.New(46, 43), CPos.New(46, 44), CPos.New(46, 45), CPos.New(46, 46), CPos.New(45, 46), CPos.New(44, 46), CPos.New(43, 46) }
EvacuateCivilians = function() EvacuateCivilians = function()
local evacuees = Reinforcements.Reinforce(neutral, CivilianEvacuees, { HospitalCivilianSpawnPoint.Location }, 0) local evacuees = Reinforcements.Reinforce(Neutral, CivilianEvacuees, { HospitalCivilianSpawnPoint.Location }, 0)
Trigger.OnAnyKilled(evacuees, function() Trigger.OnAnyKilled(evacuees, function()
player.MarkFailedObjective(RescueCivilians) Greece.MarkFailedObjective(RescueCivilians)
end) end)
Trigger.OnAllRemovedFromWorld(evacuees, function() Trigger.OnAllRemovedFromWorld(evacuees, function()
player.MarkCompletedObjective(RescueCivilians) Greece.MarkCompletedObjective(RescueCivilians)
end) end)
Utils.Do(evacuees, function(civ) Utils.Do(evacuees, function(civ)
@@ -51,33 +51,33 @@ EvacuateCivilians = function()
end end
SpawnAndMoveAlliedBaseUnits = function() SpawnAndMoveAlliedBaseUnits = function()
Media.PlaySpeechNotification(player, "ReinforcementsArrived") Media.PlaySpeechNotification(Greece, "ReinforcementsArrived")
Reinforcements.Reinforce(player, ReinforceBaseUnits, { AlliedBaseEntryPoint.Location, AlliedBaseMovePoint.Location }, 18) Reinforcements.Reinforce(Greece, ReinforceBaseUnits, { AlliedBaseEntryPoint.Location, AlliedBaseMovePoint.Location }, 18)
end end
SetupAlliedBase = function() SetupAlliedBase = function()
local alliedOutpost = Map.ActorsInBox(AlliedBaseTopLeft.CenterPosition, AlliedBaseBottomRight.CenterPosition, local alliedOutpost = Map.ActorsInBox(AlliedBaseTopLeft.CenterPosition, AlliedBaseBottomRight.CenterPosition,
function(self) return self.Owner == outpost end) function(self) return self.Owner == Outpost end)
Media.PlaySoundNotification(player, "BaseSetup") Media.PlaySoundNotification(Greece, "BaseSetup")
Utils.Do(alliedOutpost, function(building) Utils.Do(alliedOutpost, function(building)
building.Owner = player building.Owner = Greece
end) end)
AlliedBaseHarv.Owner = player AlliedBaseHarv.Owner = Greece
AlliedBaseHarv.FindResources() AlliedBaseHarv.FindResources()
FindDemitri = AddPrimaryObjective(player, "find-demitri") FindDemitri = AddPrimaryObjective(Greece, "find-demitri")
InfiltrateRadarDome = AddPrimaryObjective(player, "reprogram-super-tanks") InfiltrateRadarDome = AddPrimaryObjective(Greece, "reprogram-super-tanks")
DefendOutpost = AddSecondaryObjective(player, "defend-outpost") DefendOutpost = AddSecondaryObjective(Greece, "defend-outpost")
player.MarkCompletedObjective(FindOutpost) Greece.MarkCompletedObjective(FindOutpost)
-- Don't fail the Objective instantly -- Don't fail the Objective instantly
Trigger.AfterDelay(DateTime.Seconds(1), function() Trigger.AfterDelay(DateTime.Seconds(1), function()
-- The actor might have been destroyed/crushed in this one second delay -- The actor might have been destroyed/crushed in this one second delay
local actors = Utils.Where(alliedOutpost, function(actor) return actor.IsInWorld end) local actors = Utils.Where(alliedOutpost, function(actor) return actor.IsInWorld end)
Trigger.OnAllRemovedFromWorld(actors, function() player.MarkFailedObjective(DefendOutpost) end) Trigger.OnAllRemovedFromWorld(actors, function() Greece.MarkFailedObjective(DefendOutpost) end)
end) end)
Trigger.AfterDelay(DateTime.Minutes(1) + DateTime.Seconds(40), function() Trigger.AfterDelay(DateTime.Minutes(1) + DateTime.Seconds(40), function()
@@ -111,10 +111,10 @@ SendAlliedUnits = function()
Camera.Position = StartEntryPoint.CenterPosition Camera.Position = StartEntryPoint.CenterPosition
Media.PlaySpeechNotification(player, "ReinforcementsArrived") Media.PlaySpeechNotification(Greece, "ReinforcementsArrived")
Utils.Do(AlliedUnits, function(table) Utils.Do(AlliedUnits, function(table)
Trigger.AfterDelay(table.delay, function() Trigger.AfterDelay(table.delay, function()
local units = Reinforcements.Reinforce(player, table.types, { StartEntryPoint.Location, StartMovePoint.Location }, 18) local units = Reinforcements.Reinforce(Greece, table.types, { StartEntryPoint.Location, StartMovePoint.Location }, 18)
Utils.Do(units, function(unit) Utils.Do(units, function(unit)
if unit.Type == "e6" then if unit.Type == "e6" then
@@ -122,7 +122,7 @@ SendAlliedUnits = function()
Trigger.OnKilled(unit, LandingPossible) Trigger.OnKilled(unit, LandingPossible)
elseif unit.Type == "thf" then elseif unit.Type == "thf" then
Trigger.OnKilled(unit, function() Trigger.OnKilled(unit, function()
player.MarkFailedObjective(StealMoney) Greece.MarkFailedObjective(StealMoney)
end) end)
end end
end) end)
@@ -133,15 +133,15 @@ SendAlliedUnits = function()
end end
LandingPossible = function() LandingPossible = function()
if not beachReached and (USSRSpen.IsDead or Engineer.IsDead) and LstProduced < 1 then if not BeachReached and (USSRSpen.IsDead or Engineer.IsDead) and LstProduced < 1 then
player.MarkFailedObjective(CrossRiver) Greece.MarkFailedObjective(CrossRiver)
end end
end end
SuperTankDomeInfiltrated = function() SuperTankDomeInfiltrated = function()
SuperTankAttack = true SuperTankAttack = true
Utils.Do(SuperTanks, function(tnk) Utils.Do(SuperTanks, function(tnk)
tnk.Owner = friendlyMadTanks tnk.Owner = FriendlyMadTanks
if not tnk.IsDead then if not tnk.IsDead then
tnk.GrantCondition("friendly") tnk.GrantCondition("friendly")
Trigger.ClearAll(tnk) Trigger.ClearAll(tnk)
@@ -169,29 +169,29 @@ SuperTankDomeInfiltrated = function()
end end
end) end)
player.MarkCompletedObjective(InfiltrateRadarDome) Greece.MarkCompletedObjective(InfiltrateRadarDome)
Trigger.AfterDelay(DateTime.Minutes(3), SuperTanksDestruction) Trigger.AfterDelay(DateTime.Minutes(3), SuperTanksDestruction)
ticked = DateTime.Minutes(3) Ticked = DateTime.Minutes(3)
Trigger.AfterDelay(DateTime.Seconds(2), function() Trigger.AfterDelay(DateTime.Seconds(2), function()
Media.PlaySpeechNotification(player, "ControlCenterDeactivated") Media.PlaySpeechNotification(Greece, "ControlCenterDeactivated")
Trigger.AfterDelay(DateTime.Seconds(4), function() Trigger.AfterDelay(DateTime.Seconds(4), function()
Media.DisplayMessage(UserInterface.Translate("super-tank-self-destruct-t-minus-3")) Media.DisplayMessage(UserInterface.Translate("super-tank-self-destruct-t-minus-3"))
Media.PlaySpeechNotification(player, "WarningThreeMinutesRemaining") Media.PlaySpeechNotification(Greece, "WarningThreeMinutesRemaining")
end) end)
end) end)
end end
SuperTanksDestruction = function() SuperTanksDestruction = function()
local badGuys = Utils.Where(Map.ActorsInWorld, function(self) return self.Owner == badguy and self.HasProperty("Health") end) local badGuys = Utils.Where(Map.ActorsInWorld, function(self) return self.Owner == BadGuy and self.HasProperty("Health") end)
Utils.Do(badGuys, function(unit) Utils.Do(badGuys, function(unit)
unit.Kill() unit.Kill()
end) end)
Utils.Do(SuperTanks, function(tnk) Utils.Do(SuperTanks, function(tnk)
if not tnk.IsDead then if not tnk.IsDead then
local camera = Actor.Create("camera", true, { Owner = player, Location = tnk.Location }) local camera = Actor.Create("camera", true, { Owner = Greece, Location = tnk.Location })
Trigger.AfterDelay(DateTime.Seconds(3), camera.Destroy) Trigger.AfterDelay(DateTime.Seconds(3), camera.Destroy)
Trigger.ClearAll(tnk) Trigger.ClearAll(tnk)
@@ -199,31 +199,31 @@ SuperTanksDestruction = function()
end end
end) end)
player.MarkCompletedObjective(DefendOutpost) Greece.MarkCompletedObjective(DefendOutpost)
end end
CreateDemitri = function() CreateDemitri = function()
local demitri = Actor.Create("demitri", true, { Owner = player, Location = DemitriChurchSpawnPoint.Location }) local demitri = Actor.Create("demitri", true, { Owner = Greece, Location = DemitriChurchSpawnPoint.Location })
demitri.Move(DemitriTriggerAreaCenter.Location) demitri.Move(DemitriTriggerAreaCenter.Location)
Media.PlaySpeechNotification(player, "TargetFreed") Media.PlaySpeechNotification(Greece, "TargetFreed")
EvacuateDemitri = AddPrimaryObjective(player, "evacuate-demitri") EvacuateDemitri = AddPrimaryObjective(Greece, "evacuate-demitri")
player.MarkCompletedObjective(FindDemitri) Greece.MarkCompletedObjective(FindDemitri)
local flarepos = CPos.New(DemitriLZ.Location.X, DemitriLZ.Location.Y - 1) local flarepos = CPos.New(DemitriLZ.Location.X, DemitriLZ.Location.Y - 1)
local demitriLZFlare = Actor.Create("flare", true, { Owner = player, Location = flarepos }) local demitriLZFlare = Actor.Create("flare", true, { Owner = Greece, Location = flarepos })
Trigger.AfterDelay(DateTime.Seconds(3), function() Media.PlaySpeechNotification(player, "SignalFlareNorth") end) Trigger.AfterDelay(DateTime.Seconds(3), function() Media.PlaySpeechNotification(Greece, "SignalFlareNorth") end)
local demitriChinook = Reinforcements.ReinforceWithTransport(player, ExtractionHeli, nil, { ExtractionWaypoint, ExtractionLZ })[1] local demitriChinook = Reinforcements.ReinforceWithTransport(Greece, ExtractionHeli, nil, { ExtractionWaypoint, ExtractionLZ })[1]
Trigger.OnAnyKilled({ demitri, demitriChinook }, function() Trigger.OnAnyKilled({ demitri, demitriChinook }, function()
player.MarkFailedObjective(EvacuateDemitri) Greece.MarkFailedObjective(EvacuateDemitri)
end) end)
Trigger.OnRemovedFromWorld(demitriChinook, function() Trigger.OnRemovedFromWorld(demitriChinook, function()
if not demitriChinook.IsDead then if not demitriChinook.IsDead then
Media.PlaySpeechNotification(player, "TargetRescued") Media.PlaySpeechNotification(Greece, "TargetRescued")
Trigger.AfterDelay(DateTime.Seconds(1), function() player.MarkCompletedObjective(EvacuateDemitri) end) Trigger.AfterDelay(DateTime.Seconds(1), function() Greece.MarkCompletedObjective(EvacuateDemitri) end)
Trigger.AfterDelay(DateTime.Seconds(3), SpawnAndMoveAlliedBaseUnits) Trigger.AfterDelay(DateTime.Seconds(3), SpawnAndMoveAlliedBaseUnits)
end end
end) end)
@@ -236,27 +236,27 @@ CreateDemitri = function()
end) end)
end end
ticked = -1 Ticked = -1
Tick = function() Tick = function()
ussr.Resources = ussr.Resources - (0.01 * ussr.ResourceCapacity / 25) USSR.Resources = USSR.Resources - (0.01 * USSR.ResourceCapacity / 25)
if InitialUnitsArrived then -- don't fail the mission straight at the beginning if InitialUnitsArrived then -- don't fail the mission straight at the beginning
if not DemitriFound or not SuperTankDomeIsInfiltrated then if not DemitriFound or not SuperTankDomeIsInfiltrated then
if player.HasNoRequiredUnits() then if Greece.HasNoRequiredUnits() then
player.MarkFailedObjective(EliminateSuperTanks) Greece.MarkFailedObjective(EliminateSuperTanks)
end end
end end
end end
if ticked > 0 then if Ticked > 0 then
if (ticked % DateTime.Seconds(1)) == 0 then if (Ticked % DateTime.Seconds(1)) == 0 then
Timer = UserInterface.Translate("super-tank-self-destruct-in", { ["time"] = Utils.FormatTime(ticked) }) Timer = UserInterface.Translate("super-tank-self-destruct-in", { ["time"] = Utils.FormatTime(Ticked) })
UserInterface.SetMissionText(Timer, TimerColor) UserInterface.SetMissionText(Timer, TimerColor)
end end
ticked = ticked - 1 Ticked = Ticked - 1
elseif ticked == 0 then elseif Ticked == 0 then
FinishTimer() FinishTimer()
ticked = ticked - 1 Ticked = Ticked - 1
end end
end end
@@ -273,67 +273,67 @@ FinishTimer = function()
end end
SetupMission = function() SetupMission = function()
TestCamera = Actor.Create("camera" ,true , { Owner = player, Location = ProvingGroundsCameraPoint.Location }) TestCamera = Actor.Create("camera" ,true , { Owner = Greece, Location = ProvingGroundsCameraPoint.Location })
Camera.Position = ProvingGroundsCameraPoint.CenterPosition Camera.Position = ProvingGroundsCameraPoint.CenterPosition
TimerColor = player.Color TimerColor = Greece.Color
Trigger.AfterDelay(DateTime.Seconds(12), function() Trigger.AfterDelay(DateTime.Seconds(12), function()
Media.PlaySpeechNotification(player, "StartGame") Media.PlaySpeechNotification(Greece, "StartGame")
Trigger.AfterDelay(DateTime.Seconds(2), SendAlliedUnits) Trigger.AfterDelay(DateTime.Seconds(2), SendAlliedUnits)
end) end)
end end
InitPlayers = function() InitPlayers = function()
player = Player.GetPlayer("Greece") Greece = Player.GetPlayer("Greece")
neutral = Player.GetPlayer("Neutral") Neutral = Player.GetPlayer("Neutral")
outpost = Player.GetPlayer("Outpost") Outpost = Player.GetPlayer("Outpost")
badguy = Player.GetPlayer("BadGuy") BadGuy = Player.GetPlayer("BadGuy")
ussr = Player.GetPlayer("USSR") USSR = Player.GetPlayer("USSR")
ukraine = Player.GetPlayer("Ukraine") Ukraine = Player.GetPlayer("Ukraine")
turkey = Player.GetPlayer("Turkey") Turkey = Player.GetPlayer("Turkey")
friendlyMadTanks = Player.GetPlayer("FriendlyMadTanks") FriendlyMadTanks = Player.GetPlayer("FriendlyMadTanks")
ussr.Cash = 2000 USSR.Cash = 2000
Trigger.AfterDelay(0, function() badguy.Resources = badguy.ResourceCapacity * 0.75 end) Trigger.AfterDelay(0, function() BadGuy.Resources = BadGuy.ResourceCapacity * 0.75 end)
end end
AddObjectives = function() AddObjectives = function()
InitObjectives(player) InitObjectives(Greece)
EliminateSuperTanks = AddPrimaryObjective(player, "eliminate-super-tanks") EliminateSuperTanks = AddPrimaryObjective(Greece, "eliminate-super-tanks")
StealMoney = AddPrimaryObjective(player, "steal-money-outpost") StealMoney = AddPrimaryObjective(Greece, "steal-money-outpost")
CrossRiver = AddPrimaryObjective(player, "cross-river") CrossRiver = AddPrimaryObjective(Greece, "cross-river")
FindOutpost = AddPrimaryObjective(player, "find-outpost") FindOutpost = AddPrimaryObjective(Greece, "find-outpost")
RescueCivilians = AddSecondaryObjective(player, "evacuate-civilian-hospital") RescueCivilians = AddSecondaryObjective(Greece, "evacuate-civilian-hospital")
BadGuyObj = AddPrimaryObjective(badguy, "") BadGuyObj = AddPrimaryObjective(BadGuy, "")
USSRObj = AddPrimaryObjective(ussr, "") USSRObj = AddPrimaryObjective(USSR, "")
UkraineObj = AddPrimaryObjective(ukraine, "") UkraineObj = AddPrimaryObjective(Ukraine, "")
TurkeyObj = AddPrimaryObjective(turkey, "") TurkeyObj = AddPrimaryObjective(Turkey, "")
Trigger.OnPlayerLost(player, function() Trigger.OnPlayerLost(Greece, function()
ussr.MarkCompletedObjective(USSRObj) USSR.MarkCompletedObjective(USSRObj)
badguy.MarkCompletedObjective(BadGuyObj) BadGuy.MarkCompletedObjective(BadGuyObj)
ukraine.MarkCompletedObjective(UkraineObj) Ukraine.MarkCompletedObjective(UkraineObj)
turkey.MarkCompletedObjective(TurkeyObj) Turkey.MarkCompletedObjective(TurkeyObj)
end) end)
Trigger.OnPlayerWon(player, function() Trigger.OnPlayerWon(Greece, function()
Media.DisplayMessage(UserInterface.Translate("demitri-extracted-super-tanks-destroyed")) Media.DisplayMessage(UserInterface.Translate("demitri-extracted-super-tanks-destroyed"))
ussr.MarkFailedObjective(USSRObj) USSR.MarkFailedObjective(USSRObj)
badguy.MarkFailedObjective(BadGuyObj) BadGuy.MarkFailedObjective(BadGuyObj)
ukraine.MarkFailedObjective(UkraineObj) Ukraine.MarkFailedObjective(UkraineObj)
turkey.MarkFailedObjective(TurkeyObj) Turkey.MarkFailedObjective(TurkeyObj)
end) end)
end end
InitTriggers = function() InitTriggers = function()
Trigger.OnAllKilled(SuperTanks, function() Trigger.OnAllKilled(SuperTanks, function()
Trigger.AfterDelay(DateTime.Seconds(3), function() player.MarkCompletedObjective(EliminateSuperTanks) end) Trigger.AfterDelay(DateTime.Seconds(3), function() Greece.MarkCompletedObjective(EliminateSuperTanks) end)
end) end)
Trigger.OnKilled(SuperTankDome, function() Trigger.OnKilled(SuperTankDome, function()
if not SuperTankDomeIsInfiltrated then if not SuperTankDomeIsInfiltrated then
player.MarkFailedObjective(InfiltrateRadarDome) Greece.MarkFailedObjective(InfiltrateRadarDome)
end end
end) end)
Trigger.OnInfiltrated(SuperTankDome, function() Trigger.OnInfiltrated(SuperTankDome, function()
@@ -361,46 +361,46 @@ InitTriggers = function()
Trigger.OnKilled(DemitriChurch, function() Trigger.OnKilled(DemitriChurch, function()
if not DemitriFound then if not DemitriFound then
player.MarkFailedObjective(FindDemitri) Greece.MarkFailedObjective(FindDemitri)
end end
end) end)
Trigger.OnKilled(Hospital, function() Trigger.OnKilled(Hospital, function()
if not HospitalEvacuated then if not HospitalEvacuated then
HospitalEvacuated = true HospitalEvacuated = true
player.MarkFailedObjective(RescueCivilians) Greece.MarkFailedObjective(RescueCivilians)
end end
end) end)
Trigger.OnInfiltrated(USSROutpostSilo, function() Trigger.OnInfiltrated(USSROutpostSilo, function()
MoneyStolen = true MoneyStolen = true
player.MarkCompletedObjective(StealMoney) Greece.MarkCompletedObjective(StealMoney)
end) end)
Trigger.OnKilledOrCaptured(USSROutpostSilo, function() Trigger.OnKilledOrCaptured(USSROutpostSilo, function()
if not MoneyStolen then if not MoneyStolen then
player.MarkFailedObjective(StealMoney) Greece.MarkFailedObjective(StealMoney)
end end
end) end)
beachReached = false BeachReached = false
Trigger.OnEnteredFootprint(BeachTrigger, function(a, id) Trigger.OnEnteredFootprint(BeachTrigger, function(a, id)
if not beachReached and a.Owner == player then if not BeachReached and a.Owner == Greece then
beachReached = true BeachReached = true
Trigger.RemoveFootprintTrigger(id) Trigger.RemoveFootprintTrigger(id)
player.MarkCompletedObjective(CrossRiver) Greece.MarkCompletedObjective(CrossRiver)
end end
end) end)
Trigger.OnPlayerDiscovered(outpost, function(_, discoverer) Trigger.OnPlayerDiscovered(Outpost, function(_, discoverer)
if not outpostReached and discoverer == player then if not OutpostReached and discoverer == Greece then
outpostReached = true OutpostReached = true
SetupAlliedBase() SetupAlliedBase()
end end
end) end)
Trigger.OnEnteredFootprint(DemitriAreaTrigger, function(a, id) Trigger.OnEnteredFootprint(DemitriAreaTrigger, function(a, id)
if not DemitriFound and a.Owner == player then if not DemitriFound and a.Owner == Greece then
DemitriFound = true DemitriFound = true
Trigger.RemoveFootprintTrigger(id) Trigger.RemoveFootprintTrigger(id)
CreateDemitri() CreateDemitri()
@@ -408,7 +408,7 @@ InitTriggers = function()
end) end)
Trigger.OnEnteredFootprint(HospitalAreaTrigger, function(a, id) Trigger.OnEnteredFootprint(HospitalAreaTrigger, function(a, id)
if not HospitalEvacuated and a.Owner == player then if not HospitalEvacuated and a.Owner == Greece then
HospitalEvacuated = true HospitalEvacuated = true
Trigger.RemoveFootprintTrigger(id) Trigger.RemoveFootprintTrigger(id)
EvacuateCivilians() EvacuateCivilians()

View File

@@ -200,7 +200,7 @@ end
UnitsArrived = false UnitsArrived = false
TimerFinished = false TimerFinished = false
ticked = TimerTicks Ticked = TimerTicks
Tick = function() Tick = function()
if BadGuy.PowerState ~= "Normal" then if BadGuy.PowerState ~= "Normal" then
PowerDownTeslas() PowerDownTeslas()
@@ -210,13 +210,13 @@ Tick = function()
USSR.MarkCompletedObjective(EscapeWithSub) USSR.MarkCompletedObjective(EscapeWithSub)
end end
if ticked > 0 then if Ticked > 0 then
if (ticked % DateTime.Seconds(1)) == 0 then if (Ticked % DateTime.Seconds(1)) == 0 then
Timer = UserInterface.Translate("submarine-completes-in", { ["time"] = Utils.FormatTime(ticked) }) Timer = UserInterface.Translate("submarine-completes-in", { ["time"] = Utils.FormatTime(Ticked) })
UserInterface.SetMissionText(Timer, TimerColor) UserInterface.SetMissionText(Timer, TimerColor)
end end
ticked = ticked - 1 Ticked = Ticked - 1
elseif ticked == 0 and not TimerFinished then elseif Ticked == 0 and not TimerFinished then
MissileSubEscape() MissileSubEscape()
TimerFinished = true TimerFinished = true
end end

View File

@@ -48,11 +48,11 @@ SendBGAttackGroup = function()
end end
ProduceBadGuyInfantry = function() ProduceBadGuyInfantry = function()
if BadGuyRax.IsDead or BadGuyRax.Owner ~= badguy then if BadGuyRax.IsDead or BadGuyRax.Owner ~= BadGuy then
return return
end end
badguy.Build({ Utils.Random(SovietInfantry) }, function(units) BadGuy.Build({ Utils.Random(SovietInfantry) }, function(units)
table.insert(BGAttackGroup, units[1]) table.insert(BGAttackGroup, units[1])
SendBGAttackGroup() SendBGAttackGroup()
Trigger.AfterDelay(ProductionInterval[Difficulty], ProduceBadGuyInfantry) Trigger.AfterDelay(ProductionInterval[Difficulty], ProduceBadGuyInfantry)
@@ -74,11 +74,11 @@ SendAttackGroup = function()
end end
ProduceUSSRInfantry = function() ProduceUSSRInfantry = function()
if USSRRax.IsDead or USSRRax.Owner ~= ussr then if USSRRax.IsDead or USSRRax.Owner ~= USSR then
return return
end end
ussr.Build({ Utils.Random(SovietInfantry) }, function(units) USSR.Build({ Utils.Random(SovietInfantry) }, function(units)
table.insert(AttackGroup, units[1]) table.insert(AttackGroup, units[1])
SendAttackGroup() SendAttackGroup()
Trigger.AfterDelay(ProductionInterval[Difficulty], ProduceUSSRInfantry) Trigger.AfterDelay(ProductionInterval[Difficulty], ProduceUSSRInfantry)
@@ -86,11 +86,11 @@ ProduceUSSRInfantry = function()
end end
ProduceVehicles = function() ProduceVehicles = function()
if USSRWarFactory.IsDead or USSRWarFactory.Owner ~= ussr then if USSRWarFactory.IsDead or USSRWarFactory.Owner ~= USSR then
return return
end end
ussr.Build({ Utils.Random(SovietVehicles) }, function(units) USSR.Build({ Utils.Random(SovietVehicles) }, function(units)
table.insert(AttackGroup, units[1]) table.insert(AttackGroup, units[1])
SendAttackGroup() SendAttackGroup()
Trigger.AfterDelay(ProductionInterval[Difficulty], ProduceVehicles) Trigger.AfterDelay(ProductionInterval[Difficulty], ProduceVehicles)
@@ -98,7 +98,7 @@ ProduceVehicles = function()
end end
GroundWaves = function() GroundWaves = function()
Reinforcements.Reinforce(ussr, Utils.Random(GroundAttackUnits), Utils.Random(GroundAttackPaths), 0, function(unit) Reinforcements.Reinforce(USSR, Utils.Random(GroundAttackUnits), Utils.Random(GroundAttackPaths), 0, function(unit)
unit.Hunt() unit.Hunt()
end) end)

View File

@@ -25,28 +25,28 @@ CombatTeam2 =
SetupTriggers = function() SetupTriggers = function()
Trigger.OnInfiltrated(RadarDome, function() Trigger.OnInfiltrated(RadarDome, function()
greece.MarkCompletedObjective(objRadarSpy) Greece.MarkCompletedObjective(RadarSpyObjective)
Actor.Create("camera", true, { Owner = greece, Location = Cam1.Location }) Actor.Create("camera", true, { Owner = Greece, Location = Cam1.Location })
Actor.Create("camera", true, { Owner = greece, Location = Cam2.Location }) Actor.Create("camera", true, { Owner = Greece, Location = Cam2.Location })
Actor.Create("camera", true, { Owner = greece, Location = Cam3.Location }) Actor.Create("camera", true, { Owner = Greece, Location = Cam3.Location })
Actor.Create("camera", true, { Owner = greece, Location = Cam4.Location }) Actor.Create("camera", true, { Owner = Greece, Location = Cam4.Location })
end) end)
Trigger.OnKilled(RadarDome, function() Trigger.OnKilled(RadarDome, function()
if not greece.IsObjectiveCompleted(objRadarSpy) then if not Greece.IsObjectiveCompleted(RadarSpyObjective) then
greece.MarkFailedObjective(objRadarSpy) Greece.MarkFailedObjective(RadarSpyObjective)
end end
end) end)
Trigger.OnAllKilled(ConvoyTrucks, function() Trigger.OnAllKilled(ConvoyTrucks, function()
greece.MarkCompletedObjective(objDestroyAllTrucks) Greece.MarkCompletedObjective(DestroyAllTrucksObjective)
end) end)
end end
MissionStart = function() MissionStart = function()
Trigger.AfterDelay(DateTime.Seconds(1), function() Trigger.AfterDelay(DateTime.Seconds(1), function()
Reinforcements.Reinforce(greece, CombatTeam1, { TruckEscapeCenter.Location, DefaultCameraPosition.Location }) Reinforcements.Reinforce(Greece, CombatTeam1, { TruckEscapeCenter.Location, DefaultCameraPosition.Location })
local StartCamera = Actor.Create("camera", true, { Owner = greece, Location = DefaultCameraPosition.Location }) local StartCamera = Actor.Create("camera", true, { Owner = Greece, Location = DefaultCameraPosition.Location })
Trigger.AfterDelay(DateTime.Seconds(10), function() Trigger.AfterDelay(DateTime.Seconds(10), function()
StartCamera.Destroy() StartCamera.Destroy()
end) end)
@@ -87,8 +87,8 @@ MissionStart = function()
Trigger.AfterDelay(DateTime.Minutes(1), function() Trigger.AfterDelay(DateTime.Minutes(1), function()
CombatTeam2 = CombatTeam2[Difficulty] CombatTeam2 = CombatTeam2[Difficulty]
Reinforcements.Reinforce(greece, CombatTeam2, { TruckEscapeCenter.Location, DefaultCameraPosition.Location }) Reinforcements.Reinforce(Greece, CombatTeam2, { TruckEscapeCenter.Location, DefaultCameraPosition.Location })
Media.PlaySpeechNotification(greece, "ReinforcementsArrived") Media.PlaySpeechNotification(Greece, "ReinforcementsArrived")
end) end)
end end
@@ -103,7 +103,7 @@ MoveTruckEscapeRoute = function(truck, route)
return return
else else
Media.DisplayMessage(UserInterface.Translate("convoy-truck-escaping")) Media.DisplayMessage(UserInterface.Translate("convoy-truck-escaping"))
Media.PlaySoundNotification(greece, "AlertBleep") Media.PlaySoundNotification(Greece, "AlertBleep")
Utils.Do(route, function(waypoint) Utils.Do(route, function(waypoint)
truck.Move(waypoint.Location) truck.Move(waypoint.Location)
end) end)
@@ -111,7 +111,7 @@ MoveTruckEscapeRoute = function(truck, route)
Trigger.OnIdle(truck, function() Trigger.OnIdle(truck, function()
if truck.Location == route[#route].Location then if truck.Location == route[#route].Location then
truck.Destroy() truck.Destroy()
greece.MarkFailedObjective(objDestroyAllTrucks) Greece.MarkFailedObjective(DestroyAllTrucksObjective)
else else
truck.Move(route[#route].Location) truck.Move(route[#route].Location)
end end
@@ -120,29 +120,29 @@ MoveTruckEscapeRoute = function(truck, route)
end end
Tick = function() Tick = function()
ussr.Cash = 5000 USSR.Cash = 5000
badguy.Cash = 5000 BadGuy.Cash = 5000
if ussr.HasNoRequiredUnits() and badguy.HasNoRequiredUnits() then if USSR.HasNoRequiredUnits() and BadGuy.HasNoRequiredUnits() then
greece.MarkCompletedObjective(objKillAll) Greece.MarkCompletedObjective(KillAllObjective)
end end
if greece.HasNoRequiredUnits() then if Greece.HasNoRequiredUnits() then
ussr.MarkCompletedObjective(ussrObj) USSR.MarkCompletedObjective(USSRobjective)
end end
end end
WorldLoaded = function() WorldLoaded = function()
greece = Player.GetPlayer("Greece") Greece = Player.GetPlayer("Greece")
ussr = Player.GetPlayer("USSR") USSR = Player.GetPlayer("USSR")
badguy = Player.GetPlayer("BadGuy") BadGuy = Player.GetPlayer("BadGuy")
InitObjectives(greece) InitObjectives(Greece)
objDestroyAllTrucks = AddPrimaryObjective(greece, "prevent-soviet-trucks-escaping") DestroyAllTrucksObjective = AddPrimaryObjective(Greece, "prevent-soviet-trucks-escaping")
objKillAll = AddPrimaryObjective(greece, "clear-sector-soviet-presence") KillAllObjective = AddPrimaryObjective(Greece, "clear-sector-soviet-presence")
objRadarSpy = AddSecondaryObjective(greece, "infiltrate-radar-reveal-escape-routes") RadarSpyObjective = AddSecondaryObjective(Greece, "infiltrate-radar-reveal-escape-routes")
ussrObj = ussr.AddObjective("") USSRobjective = USSR.AddObjective("")
ActivateAI() ActivateAI()
SetupTriggers() SetupTriggers()

View File

@@ -28,49 +28,49 @@ WinTriggerArea = { CPos.New(111, 59), CPos.New(111, 60), CPos.New(111, 61), CPos
ObjectiveTriggers = function() ObjectiveTriggers = function()
Trigger.OnEnteredFootprint(WinTriggerArea, function(a, id) Trigger.OnEnteredFootprint(WinTriggerArea, function(a, id)
if not EscapeGoalTrigger and a.Owner == greece then if not EscapeGoalTrigger and a.Owner == Greece then
EscapeGoalTrigger = true EscapeGoalTrigger = true
greece.MarkCompletedObjective(ExitBase) Greece.MarkCompletedObjective(ExitBase)
if Difficulty == "hard" then if Difficulty == "hard" then
greece.MarkCompletedObjective(NoCasualties) Greece.MarkCompletedObjective(NoCasualties)
end end
if not TanyaFreed then if not TanyaFreed then
greece.MarkFailedObjective(FreeTanya) Greece.MarkFailedObjective(FreeTanyaObjective)
else else
greece.MarkCompletedObjective(FreeTanya) Greece.MarkCompletedObjective(FreeTanyaObjective)
end end
end end
end) end)
Trigger.OnKilled(Tanya, function() Trigger.OnKilled(Tanya, function()
greece.MarkFailedObjective(FreeTanya) Greece.MarkFailedObjective(FreeTanyaObjective)
end) end)
Trigger.OnAllKilled(TanyaTowers, function() Trigger.OnAllKilled(TanyaTowers, function()
TanyaFreed = true TanyaFreed = true
if not Tanya.IsDead then if not Tanya.IsDead then
Media.PlaySpeechNotification(greece, "TanyaRescued") Media.PlaySpeechNotification(Greece, "TanyaRescued")
Tanya.Owner = greece Tanya.Owner = Greece
end end
end) end)
Trigger.OnAllKilled(SovietImportantGuys, function() Trigger.OnAllKilled(SovietImportantGuys, function()
greece.MarkCompletedObjective(KillVIPs) Greece.MarkCompletedObjective(KillVIPs)
end) end)
Trigger.OnInfiltrated(WarFactory2, function() Trigger.OnInfiltrated(WarFactory2, function()
if not StealMammoth.IsDead or StealMammoth.Owner == ussr then if not StealMammoth.IsDead or StealMammoth.Owner == USSR then
greece.MarkCompletedObjective(StealTank) Greece.MarkCompletedObjective(StealTank)
StealMammoth.Owner = greece StealMammoth.Owner = Greece
end end
end) end)
end end
ConsoleTriggers = function() ConsoleTriggers = function()
Trigger.OnEnteredProximityTrigger(Terminal1.CenterPosition, WDist.FromCells(1), function(actor, id) Trigger.OnEnteredProximityTrigger(Terminal1.CenterPosition, WDist.FromCells(1), function(actor, id)
if actor.Owner == greece then if actor.Owner == Greece then
Trigger.RemoveProximityTrigger(id) Trigger.RemoveProximityTrigger(id)
if not FlameTower1.IsDead then if not FlameTower1.IsDead then
Media.DisplayMessage(UserInterface.Translate("flame-turret-deactivated"), UserInterface.Translate("console")) Media.DisplayMessage(UserInterface.Translate("flame-turret-deactivated"), UserInterface.Translate("console"))
@@ -80,7 +80,7 @@ ConsoleTriggers = function()
end) end)
Trigger.OnEnteredProximityTrigger(Terminal2.CenterPosition, WDist.FromCells(1), function(actor, id) Trigger.OnEnteredProximityTrigger(Terminal2.CenterPosition, WDist.FromCells(1), function(actor, id)
if actor.Owner == greece then if actor.Owner == Greece then
Trigger.RemoveProximityTrigger(id) Trigger.RemoveProximityTrigger(id)
if not FlameTower2.IsDead then if not FlameTower2.IsDead then
Media.DisplayMessage(UserInterface.Translate("flame-turret-deactivated"), UserInterface.Translate("console")) Media.DisplayMessage(UserInterface.Translate("flame-turret-deactivated"), UserInterface.Translate("console"))
@@ -90,7 +90,7 @@ ConsoleTriggers = function()
end) end)
Trigger.OnEnteredProximityTrigger(Terminal3.CenterPosition, WDist.FromCells(1), function(actor, id) Trigger.OnEnteredProximityTrigger(Terminal3.CenterPosition, WDist.FromCells(1), function(actor, id)
if actor.Owner == greece then if actor.Owner == Greece then
Trigger.RemoveProximityTrigger(id) Trigger.RemoveProximityTrigger(id)
if not FlameTower3.IsDead then if not FlameTower3.IsDead then
Media.DisplayMessage(UserInterface.Translate("flame-turret-deactivated"), UserInterface.Translate("console")) Media.DisplayMessage(UserInterface.Translate("flame-turret-deactivated"), UserInterface.Translate("console"))
@@ -101,16 +101,16 @@ ConsoleTriggers = function()
local gasActive local gasActive
Trigger.OnEnteredProximityTrigger(Terminal4.CenterPosition, WDist.FromCells(1), function(actor, id) Trigger.OnEnteredProximityTrigger(Terminal4.CenterPosition, WDist.FromCells(1), function(actor, id)
if actor.Owner == greece and not gasActive then if actor.Owner == Greece and not gasActive then
Trigger.RemoveProximityTrigger(id) Trigger.RemoveProximityTrigger(id)
gasActive = true gasActive = true
Media.DisplayMessage(UserInterface.Translate("sarin-dispenser-activated"), UserInterface.Translate("console")) Media.DisplayMessage(UserInterface.Translate("sarin-dispenser-activated"), UserInterface.Translate("console"))
local KillCamera = Actor.Create("camera", true, { Owner = greece, Location = Sarin2.Location }) local KillCamera = Actor.Create("camera", true, { Owner = Greece, Location = Sarin2.Location })
local flare1 = Actor.Create("flare", true, { Owner = england, Location = Sarin1.Location }) local flare1 = Actor.Create("flare", true, { Owner = England, Location = Sarin1.Location })
local flare2 = Actor.Create("flare", true, { Owner = england, Location = Sarin2.Location }) local flare2 = Actor.Create("flare", true, { Owner = England, Location = Sarin2.Location })
local flare3 = Actor.Create("flare", true, { Owner = england, Location = Sarin3.Location }) local flare3 = Actor.Create("flare", true, { Owner = England, Location = Sarin3.Location })
local flare4 = Actor.Create("flare", true, { Owner = england, Location = Sarin4.Location }) local flare4 = Actor.Create("flare", true, { Owner = England, Location = Sarin4.Location })
Trigger.AfterDelay(DateTime.Seconds(4), function() Trigger.AfterDelay(DateTime.Seconds(4), function()
Utils.Do(SarinVictims, function(actor) Utils.Do(SarinVictims, function(actor)
if not actor.IsDead then if not actor.IsDead then
@@ -130,7 +130,7 @@ ConsoleTriggers = function()
end) end)
Trigger.OnEnteredProximityTrigger(Terminal5.CenterPosition, WDist.FromCells(1), function(actor, id) Trigger.OnEnteredProximityTrigger(Terminal5.CenterPosition, WDist.FromCells(1), function(actor, id)
if actor.Owner == greece then if actor.Owner == Greece then
Trigger.RemoveProximityTrigger(id) Trigger.RemoveProximityTrigger(id)
if not BadCoil.IsDead then if not BadCoil.IsDead then
Media.DisplayMessage(UserInterface.Translate("tesla-coil-deactivated"), UserInterface.Translate("console")) Media.DisplayMessage(UserInterface.Translate("tesla-coil-deactivated"), UserInterface.Translate("console"))
@@ -141,13 +141,13 @@ ConsoleTriggers = function()
local teslaActive local teslaActive
Trigger.OnEnteredProximityTrigger(Terminal6.CenterPosition, WDist.FromCells(1), function(actor, id) Trigger.OnEnteredProximityTrigger(Terminal6.CenterPosition, WDist.FromCells(1), function(actor, id)
if actor.Owner == greece and not teslaActive then if actor.Owner == Greece and not teslaActive then
Trigger.RemoveProximityTrigger(id) Trigger.RemoveProximityTrigger(id)
teslaActive = true teslaActive = true
Media.DisplayMessage(UserInterface.Translate("tesla-coil-activated"), UserInterface.Translate("console")) Media.DisplayMessage(UserInterface.Translate("tesla-coil-activated"), UserInterface.Translate("console"))
local tesla1 = Actor.Create("tsla", true, { Owner = turkey, Location = TurkeyCoil1.Location }) local tesla1 = Actor.Create("tsla", true, { Owner = Turkey, Location = TurkeyCoil1.Location })
local tesla2 = Actor.Create("tsla", true, { Owner = turkey, Location = TurkeyCoil2.Location }) local tesla2 = Actor.Create("tsla", true, { Owner = Turkey, Location = TurkeyCoil2.Location })
Trigger.AfterDelay(DateTime.Seconds(10), function() Trigger.AfterDelay(DateTime.Seconds(10), function()
if not tesla1.IsDead then if not tesla1.IsDead then
tesla1.Kill() tesla1.Kill()
@@ -160,7 +160,7 @@ ConsoleTriggers = function()
end) end)
Trigger.OnEnteredProximityTrigger(Terminal7.CenterPosition, WDist.FromCells(1), function(actor, id) Trigger.OnEnteredProximityTrigger(Terminal7.CenterPosition, WDist.FromCells(1), function(actor, id)
if actor.Owner == greece then if actor.Owner == Greece then
Trigger.RemoveProximityTrigger(id) Trigger.RemoveProximityTrigger(id)
if not FlameTowerTanya1.IsDead then if not FlameTowerTanya1.IsDead then
Media.DisplayMessage(UserInterface.Translate("flame-turret-deactivated"), UserInterface.Translate("console")) Media.DisplayMessage(UserInterface.Translate("flame-turret-deactivated"), UserInterface.Translate("console"))
@@ -174,7 +174,7 @@ ConsoleTriggers = function()
end) end)
Trigger.OnEnteredProximityTrigger(Terminal8.CenterPosition, WDist.FromCells(1), function(actor, id) Trigger.OnEnteredProximityTrigger(Terminal8.CenterPosition, WDist.FromCells(1), function(actor, id)
if actor.Owner == greece then if actor.Owner == Greece then
Trigger.RemoveProximityTrigger(id) Trigger.RemoveProximityTrigger(id)
if not FlameTowerExit1.IsDead then if not FlameTowerExit1.IsDead then
Media.DisplayMessage(UserInterface.Translate("flame-turret-deactivated"), UserInterface.Translate("console")) Media.DisplayMessage(UserInterface.Translate("flame-turret-deactivated"), UserInterface.Translate("console"))
@@ -190,7 +190,7 @@ end
CameraTriggers = function() CameraTriggers = function()
Trigger.AfterDelay(DateTime.Seconds(1), function() Trigger.AfterDelay(DateTime.Seconds(1), function()
local startCamera = Actor.Create("camera", true, { Owner = greece, Location = start.Location }) local startCamera = Actor.Create("camera", true, { Owner = Greece, Location = start.Location })
Trigger.AfterDelay(DateTime.Seconds(10), function() Trigger.AfterDelay(DateTime.Seconds(10), function()
startCamera.Destroy() startCamera.Destroy()
end) end)
@@ -198,11 +198,11 @@ CameraTriggers = function()
local cam1Triggered local cam1Triggered
Trigger.OnEnteredProximityTrigger(CameraTrigger1.CenterPosition, WDist.FromCells(8), function(actor, id) Trigger.OnEnteredProximityTrigger(CameraTrigger1.CenterPosition, WDist.FromCells(8), function(actor, id)
if actor.Owner == greece and not cam1Triggered then if actor.Owner == Greece and not cam1Triggered then
Trigger.RemoveProximityTrigger(id) Trigger.RemoveProximityTrigger(id)
cam1Triggered = true cam1Triggered = true
local camera1 = Actor.Create("camera", true, { Owner = greece, Location = CameraTrigger1.Location }) local camera1 = Actor.Create("camera", true, { Owner = Greece, Location = CameraTrigger1.Location })
Trigger.OnAllKilled(Camera1Towers, function() Trigger.OnAllKilled(Camera1Towers, function()
camera1.Destroy() camera1.Destroy()
end) end)
@@ -211,11 +211,11 @@ CameraTriggers = function()
local cam2Triggered local cam2Triggered
Trigger.OnEnteredProximityTrigger(CameraTrigger2.CenterPosition, WDist.FromCells(8), function(actor, id) Trigger.OnEnteredProximityTrigger(CameraTrigger2.CenterPosition, WDist.FromCells(8), function(actor, id)
if actor.Owner == greece and not cam2Triggered then if actor.Owner == Greece and not cam2Triggered then
Trigger.RemoveProximityTrigger(id) Trigger.RemoveProximityTrigger(id)
cam2Triggered = true cam2Triggered = true
local camera2 = Actor.Create("camera", true, { Owner = greece, Location = CameraTrigger2.Location }) local camera2 = Actor.Create("camera", true, { Owner = Greece, Location = CameraTrigger2.Location })
Utils.Do(Camera2Team, function(actor) Utils.Do(Camera2Team, function(actor)
actor.AttackMove(CameraTrigger1.Location) actor.AttackMove(CameraTrigger1.Location)
end) end)
@@ -227,13 +227,13 @@ CameraTriggers = function()
local cam3Triggered local cam3Triggered
Trigger.OnEnteredProximityTrigger(CameraTrigger3.CenterPosition, WDist.FromCells(8), function(actor, id) Trigger.OnEnteredProximityTrigger(CameraTrigger3.CenterPosition, WDist.FromCells(8), function(actor, id)
if actor.Owner == greece and not cam3Triggered then if actor.Owner == Greece and not cam3Triggered then
Trigger.RemoveProximityTrigger(id) Trigger.RemoveProximityTrigger(id)
cam3Triggered = true cam3Triggered = true
local camera3 = Actor.Create("camera", true, { Owner = greece, Location = CameraTrigger3.Location }) local camera3 = Actor.Create("camera", true, { Owner = Greece, Location = CameraTrigger3.Location })
Actor.Create("apwr", true, { Owner = france, Location = PowerPlantSpawn1.Location }) Actor.Create("apwr", true, { Owner = France, Location = PowerPlantSpawn1.Location })
Actor.Create("apwr", true, { Owner = germany, Location = PowerPlantSpawn2.Location }) Actor.Create("apwr", true, { Owner = Germany, Location = PowerPlantSpawn2.Location })
if not Mammoth1.IsDead then if not Mammoth1.IsDead then
Mammoth1.AttackMove(MammothGo.Location) Mammoth1.AttackMove(MammothGo.Location)
end end
@@ -246,11 +246,11 @@ CameraTriggers = function()
local cam4Triggered local cam4Triggered
Trigger.OnEnteredProximityTrigger(CameraTrigger4.CenterPosition, WDist.FromCells(9), function(actor, id) Trigger.OnEnteredProximityTrigger(CameraTrigger4.CenterPosition, WDist.FromCells(9), function(actor, id)
if actor.Owner == greece and not cam4Triggered then if actor.Owner == Greece and not cam4Triggered then
Trigger.RemoveProximityTrigger(id) Trigger.RemoveProximityTrigger(id)
cam4Triggered = true cam4Triggered = true
local camera4 = Actor.Create("camera", true, { Owner = greece, Location = CameraTrigger4.Location }) local camera4 = Actor.Create("camera", true, { Owner = Greece, Location = CameraTrigger4.Location })
Trigger.OnKilled(Mammoth2, function() Trigger.OnKilled(Mammoth2, function()
camera4.Destroy() camera4.Destroy()
end) end)
@@ -259,11 +259,11 @@ CameraTriggers = function()
local cam5Triggered local cam5Triggered
Trigger.OnEnteredProximityTrigger(CameraTrigger5.CenterPosition, WDist.FromCells(8), function(actor, id) Trigger.OnEnteredProximityTrigger(CameraTrigger5.CenterPosition, WDist.FromCells(8), function(actor, id)
if actor.Owner == greece and not cam5Triggered then if actor.Owner == Greece and not cam5Triggered then
Trigger.RemoveProximityTrigger(id) Trigger.RemoveProximityTrigger(id)
cam5Triggered = true cam5Triggered = true
local camera5 = Actor.Create("camera", true, { Owner = greece, Location = CameraTrigger5.Location }) local camera5 = Actor.Create("camera", true, { Owner = Greece, Location = CameraTrigger5.Location })
Trigger.AfterDelay(DateTime.Seconds(10), function() Trigger.AfterDelay(DateTime.Seconds(10), function()
camera5.Destroy() camera5.Destroy()
end) end)
@@ -272,21 +272,21 @@ CameraTriggers = function()
local cam6Triggered local cam6Triggered
Trigger.OnEnteredProximityTrigger(CameraTrigger6.CenterPosition, WDist.FromCells(11), function(actor, id) Trigger.OnEnteredProximityTrigger(CameraTrigger6.CenterPosition, WDist.FromCells(11), function(actor, id)
if actor.Owner == greece and not cam6Triggered then if actor.Owner == Greece and not cam6Triggered then
Trigger.RemoveProximityTrigger(id) Trigger.RemoveProximityTrigger(id)
cam6Triggered = true cam6Triggered = true
Actor.Create("camera", true, { Owner = greece, Location = CameraTrigger6.Location }) Actor.Create("camera", true, { Owner = Greece, Location = CameraTrigger6.Location })
end end
end) end)
local executionTriggered local executionTriggered
Trigger.OnEnteredFootprint(ExecutionArea, function(actor, id) Trigger.OnEnteredFootprint(ExecutionArea, function(actor, id)
if actor.Owner == greece and not executionTriggered then if actor.Owner == Greece and not executionTriggered then
Trigger.RemoveFootprintTrigger(id) Trigger.RemoveFootprintTrigger(id)
executionTriggered = true executionTriggered = true
local camera7 = Actor.Create("camera", true, { Owner = greece, Location = CameraTrigger7.Location }) local camera7 = Actor.Create("camera", true, { Owner = Greece, Location = CameraTrigger7.Location })
Trigger.AfterDelay(DateTime.Seconds(25), function() Trigger.AfterDelay(DateTime.Seconds(25), function()
camera7.Destroy() camera7.Destroy()
end) end)
@@ -301,7 +301,7 @@ TruckSteal = function()
if not TruckStolen and not StealTruck.IsDead then if not TruckStolen and not StealTruck.IsDead then
TruckStolen = true TruckStolen = true
local truckSteal1 = Actor.Create("camera", true, { Owner = greece, Location = TruckDrive1.Location }) local truckSteal1 = Actor.Create("camera", true, { Owner = Greece, Location = TruckDrive1.Location })
Trigger.AfterDelay(DateTime.Seconds(10), function() Trigger.AfterDelay(DateTime.Seconds(10), function()
truckSteal1.Destroy() truckSteal1.Destroy()
end) end)
@@ -326,8 +326,8 @@ TruckSteal = function()
end end
SpyTruckDrive = function() SpyTruckDrive = function()
StealTruck = Reinforcements.Reinforce(ussr, TruckType, TruckEntry) StealTruck = Reinforcements.Reinforce(USSR, TruckType, TruckEntry)
local truckSteal2 = Actor.Create("camera", true, { Owner = greece, Location = TruckCamera.Location }) local truckSteal2 = Actor.Create("camera", true, { Owner = Greece, Location = TruckCamera.Location })
Trigger.AfterDelay(DateTime.Seconds(10), function() Trigger.AfterDelay(DateTime.Seconds(10), function()
truckSteal2.Destroy() truckSteal2.Destroy()
end) end)
@@ -338,11 +338,11 @@ SpyTruckDrive = function()
Trigger.RemoveFootprintTrigger(id) Trigger.RemoveFootprintTrigger(id)
spyCreated = true spyCreated = true
Spy = Actor.Create("spy", true, { Owner = greece, Location = TruckDrive5.Location }) Spy = Actor.Create("spy", true, { Owner = Greece, Location = TruckDrive5.Location })
Spy.DisguiseAsType("e1", ussr) Spy.DisguiseAsType("e1", USSR)
Spy.Move(SpyMove.Location) Spy.Move(SpyMove.Location)
local dogCrewCamera = Actor.Create("camera", true, { Owner = greece, Location = DoggyCam.Location }) local dogCrewCamera = Actor.Create("camera", true, { Owner = Greece, Location = DoggyCam.Location })
Trigger.AfterDelay(DateTime.Seconds(10), function() Trigger.AfterDelay(DateTime.Seconds(10), function()
dogCrewCamera.Destroy() dogCrewCamera.Destroy()
end) end)
@@ -367,13 +367,13 @@ PrisonEscape = function()
Trigger.RemoveFootprintTrigger(id) Trigger.RemoveFootprintTrigger(id)
Media.DisplayMessage(UserInterface.Translate("prisoners-escaping"), UserInterface.Translate("intercom")) Media.DisplayMessage(UserInterface.Translate("prisoners-escaping"), UserInterface.Translate("intercom"))
Media.PlaySoundNotification(greece, "AlertBuzzer") Media.PlaySoundNotification(Greece, "AlertBuzzer")
Utils.Do(GuardDogs, IdleHunt) Utils.Do(GuardDogs, IdleHunt)
end) end)
end end
ScientistExecution = function() ScientistExecution = function()
Media.PlaySoundNotification(greece, "AlertBleep") Media.PlaySoundNotification(Greece, "AlertBleep")
Media.DisplayMessage(UserInterface.Translate("hurry-base-compromised"), UserInterface.Translate("soviet-officer")) Media.DisplayMessage(UserInterface.Translate("hurry-base-compromised"), UserInterface.Translate("soviet-officer"))
Utils.Do(DemoTeam, function(actor) Utils.Do(DemoTeam, function(actor)
actor.AttackMove(DemoDrive2.Location) actor.AttackMove(DemoDrive2.Location)
@@ -440,35 +440,35 @@ end
AcceptableLosses = 0 AcceptableLosses = 0
Tick = function() Tick = function()
if greece.HasNoRequiredUnits() then if Greece.HasNoRequiredUnits() then
greece.MarkFailedObjective(ExitBase) Greece.MarkFailedObjective(ExitBase)
end end
if Difficulty == "hard" and greece.UnitsLost > AcceptableLosses then if Difficulty == "hard" and Greece.UnitsLost > AcceptableLosses then
greece.MarkFailedObjective(NoCasualties) Greece.MarkFailedObjective(NoCasualties)
end end
end end
WorldLoaded = function() WorldLoaded = function()
greece = Player.GetPlayer("Greece") Greece = Player.GetPlayer("Greece")
england = Player.GetPlayer("England") England = Player.GetPlayer("England")
turkey = Player.GetPlayer("Turkey") Turkey = Player.GetPlayer("Turkey")
ussr = Player.GetPlayer("USSR") USSR = Player.GetPlayer("USSR")
france = Player.GetPlayer("France") France = Player.GetPlayer("France")
germany = Player.GetPlayer("Germany") Germany = Player.GetPlayer("Germany")
InitObjectives(greece) InitObjectives(Greece)
ussrObj = ussr.AddObjective("") USSRobjective = USSR.AddObjective("")
ExitBase = AddPrimaryObjective(greece, "reach-eastern-exit") ExitBase = AddPrimaryObjective(Greece, "reach-eastern-exit")
FreeTanya = AddPrimaryObjective(greece, "free-tanya-keep-alive") FreeTanyaObjective = AddPrimaryObjective(Greece, "free-tanya-keep-alive")
KillVIPs = AddSecondaryObjective(greece, "kill-soviet-officers-scientists") KillVIPs = AddSecondaryObjective(Greece, "kill-soviet-officers-scientists")
StealTank = AddSecondaryObjective(greece, "steal-soviet-mammoth-tank") StealTank = AddSecondaryObjective(Greece, "steal-soviet-mammoth-tank")
if Difficulty == "hard" then if Difficulty == "hard" then
NoCasualties = AddPrimaryObjective(greece, "no-casualties") NoCasualties = AddPrimaryObjective(Greece, "no-casualties")
end end
StartSpy.DisguiseAsType("e1", ussr) StartSpy.DisguiseAsType("e1", USSR)
StartAttacker1.AttackMove(start.Location) StartAttacker1.AttackMove(start.Location)
StartAttacker2.AttackMove(start.Location) StartAttacker2.AttackMove(start.Location)

View File

@@ -44,10 +44,10 @@ MissionStart = function()
TroopsArrived = true TroopsArrived = true
end) end)
InfantryProduction() ProduceInfantry()
end end
InfantryProduction = function() ProduceInfantry = function()
if (SETent1.IsDead or SETent1.Owner ~= Greece) and (SETent2.IsDead or SETent2.Owner ~= Greece) then if (SETent1.IsDead or SETent1.Owner ~= Greece) and (SETent2.IsDead or SETent2.Owner ~= Greece) then
return return
end end
@@ -56,7 +56,7 @@ InfantryProduction = function()
Greece.Build(toBuild, function(unit) Greece.Build(toBuild, function(unit)
IdlingUnits[#IdlingUnits + 1] = unit[1] IdlingUnits[#IdlingUnits + 1] = unit[1]
Trigger.AfterDelay(InfantryDelay, InfantryProduction) Trigger.AfterDelay(InfantryDelay, ProduceInfantry)
if #IdlingUnits >= (AttackGroupSize * 1.5) then if #IdlingUnits >= (AttackGroupSize * 1.5) then
SendAttack() SendAttack()

View File

@@ -217,16 +217,16 @@ FinishTimer = function()
Trigger.AfterDelay(DateTime.Seconds(6), function() UserInterface.SetMissionText("") end) Trigger.AfterDelay(DateTime.Seconds(6), function() UserInterface.SetMissionText("") end)
end end
ticked = TimerTicks Ticked = TimerTicks
ConvoysSent = false ConvoysSent = false
Tick = function() Tick = function()
if ticked > 0 then if Ticked > 0 then
if (ticked % DateTime.Seconds(1)) == 0 then if (Ticked % DateTime.Seconds(1)) == 0 then
Timer = UserInterface.Translate("first-trucks-arrive-in", { ["time"] = Utils.FormatTime(ticked) }) Timer = UserInterface.Translate("first-trucks-arrive-in", { ["time"] = Utils.FormatTime(Ticked) })
UserInterface.SetMissionText(Timer, TimerColor) UserInterface.SetMissionText(Timer, TimerColor)
end end
ticked = ticked - 1 Ticked = Ticked - 1
elseif ticked == 0 and not ConvoysSent then elseif Ticked == 0 and not ConvoysSent then
SendConvoys() SendConvoys()
FinishTimer() FinishTimer()
end end

Some files were not shown because too many files have changed in this diff Show More