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
SetupWorld = function()
Utils.Do(Nod.GetGroundAttackers(Nod), function(unit)
Utils.Do(Nod.GetGroundAttackers(), function(unit)
Trigger.OnKilled(unit, NodUnitKilled)
end)

View File

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

View File

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

View File

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

View File

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

View File

@@ -47,7 +47,7 @@ SamSiteGoal = 3
CaptureStructures = function(actor)
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
actor.Capture(structures[1])
return

View File

@@ -61,16 +61,16 @@ Messages =
CachedResources = -1
Tick = function()
if HarkonnenArrived and harkonnen.HasNoRequiredUnits() then
player.MarkCompletedObjective(KillHarkonnen)
if HarkonnenArrived and Harkonnen.HasNoRequiredUnits() then
Atreides.MarkCompletedObjective(KillHarkonnen)
end
if player.Resources > SpiceToHarvest - 1 then
player.MarkCompletedObjective(GatherSpice)
if Atreides.Resources > SpiceToHarvest - 1 then
Atreides.MarkCompletedObjective(GatherSpice)
end
-- 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
Media.DisplayMessage(Messages[2], Mentat)
else
@@ -78,40 +78,40 @@ Tick = function()
end
-- 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)
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)
end
if player.Resources ~= CachedResources then
local parameters = { ["harvested"] = player.Resources, ["goal"] = SpiceToHarvest }
if Atreides.Resources ~= CachedResources then
local parameters = { ["harvested"] = Atreides.Resources, ["goal"] = SpiceToHarvest }
local harvestedResources = UserInterface.Translate("harvested-resources", parameters)
UserInterface.SetMissionText(harvestedResources)
CachedResources = player.Resources
CachedResources = Atreides.Resources
end
end
WorldLoaded = function()
player = Player.GetPlayer("Atreides")
harkonnen = Player.GetPlayer("Harkonnen")
Atreides = Player.GetPlayer("Atreides")
Harkonnen = Player.GetPlayer("Harkonnen")
SpiceToHarvest = ToHarvest[Difficulty]
InitObjectives(player)
KillAtreides = AddPrimaryObjective(harkonnen, "")
InitObjectives(Atreides)
KillAtreides = AddPrimaryObjective(Harkonnen, "")
local harvestSpice = UserInterface.Translate("harvest-spice", { ["spice"] = SpiceToHarvest })
GatherSpice = AddPrimaryObjective(player, harvestSpice)
KillHarkonnen = AddSecondaryObjective(player, "eliminate-harkonnen-units-reinforcements")
GatherSpice = AddPrimaryObjective(Atreides, harvestSpice)
KillHarkonnen = AddSecondaryObjective(Atreides, "eliminate-harkonnen-units-reinforcements")
local checkResourceCapacity = function()
Trigger.AfterDelay(0, function()
if player.ResourceCapacity < SpiceToHarvest then
if Atreides.ResourceCapacity < SpiceToHarvest then
Media.DisplayMessage(UserInterface.Translate("not-enough-silos"), Mentat)
Trigger.AfterDelay(DateTime.Seconds(3), function()
harkonnen.MarkCompletedObjective(KillAtreides)
Harkonnen.MarkCompletedObjective(KillAtreides)
end)
return true
@@ -126,15 +126,15 @@ WorldLoaded = function()
return
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
harkonnen.MarkCompletedObjective(KillAtreides)
Harkonnen.MarkCompletedObjective(KillAtreides)
else
Trigger.OnAllRemovedFromWorld(refs, function()
harkonnen.MarkCompletedObjective(KillAtreides)
Harkonnen.MarkCompletedObjective(KillAtreides)
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(silos, function(actor) Trigger.OnRemovedFromWorld(actor, checkResourceCapacity) end)
end
@@ -143,8 +143,8 @@ WorldLoaded = function()
Media.DisplayMessage(Messages[1], Mentat)
Trigger.AfterDelay(DateTime.Seconds(25), function()
Media.PlaySpeechNotification(player, "Reinforce")
Reinforcements.Reinforce(player, AtreidesReinforcements, AtreidesEntryPath)
Media.PlaySpeechNotification(Atreides, "Reinforce")
Reinforcements.Reinforce(Atreides, AtreidesReinforcements, AtreidesEntryPath)
end)
WavesLeft = HarkonnenAttackWaves[Difficulty]
@@ -158,7 +158,7 @@ SendReinforcements = function()
if HarkonnenAttackDelay < 0 then HarkonnenAttackDelay = 0 end
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
if WavesLeft == 0 then

View File

@@ -61,16 +61,16 @@ Messages =
CachedResources = -1
Tick = function()
if HarkonnenArrived and harkonnen.HasNoRequiredUnits() then
player.MarkCompletedObjective(KillHarkonnen)
if HarkonnenArrived and Harkonnen.HasNoRequiredUnits() then
Atreides.MarkCompletedObjective(KillHarkonnen)
end
if player.Resources > SpiceToHarvest - 1 then
player.MarkCompletedObjective(GatherSpice)
if Atreides.Resources > SpiceToHarvest - 1 then
Atreides.MarkCompletedObjective(GatherSpice)
end
-- 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
Media.DisplayMessage(Messages[2], Mentat)
else
@@ -78,40 +78,40 @@ Tick = function()
end
-- 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)
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)
end
if player.Resources ~= CachedResources then
local parameters = { ["harvested"] = player.Resources, ["goal"] = SpiceToHarvest }
if Atreides.Resources ~= CachedResources then
local parameters = { ["harvested"] = Atreides.Resources, ["goal"] = SpiceToHarvest }
local harvestedResources = UserInterface.Translate("harvested-resources", parameters)
UserInterface.SetMissionText(harvestedResources)
CachedResources = player.Resources
CachedResources = Atreides.Resources
end
end
WorldLoaded = function()
player = Player.GetPlayer("Atreides")
harkonnen = Player.GetPlayer("Harkonnen")
Atreides = Player.GetPlayer("Atreides")
Harkonnen = Player.GetPlayer("Harkonnen")
SpiceToHarvest = ToHarvest[Difficulty]
InitObjectives(player)
KillAtreides = AddPrimaryObjective(harkonnen, "")
InitObjectives(Atreides)
KillAtreides = AddPrimaryObjective(Harkonnen, "")
local harvestSpice = UserInterface.Translate("harvest-spice", { ["spice"] = SpiceToHarvest })
GatherSpice = AddPrimaryObjective(player, harvestSpice)
KillHarkonnen = AddSecondaryObjective(player, "eliminate-harkonnen-units-reinforcements")
GatherSpice = AddPrimaryObjective(Atreides, harvestSpice)
KillHarkonnen = AddSecondaryObjective(Atreides, "eliminate-harkonnen-units-reinforcements")
local checkResourceCapacity = function()
Trigger.AfterDelay(0, function()
if player.ResourceCapacity < SpiceToHarvest then
if Atreides.ResourceCapacity < SpiceToHarvest then
Media.DisplayMessage(UserInterface.Translate("not-enough-silos"), Mentat)
Trigger.AfterDelay(DateTime.Seconds(3), function()
harkonnen.MarkCompletedObjective(KillAtreides)
Harkonnen.MarkCompletedObjective(KillAtreides)
end)
return true
@@ -126,15 +126,15 @@ WorldLoaded = function()
return
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
harkonnen.MarkCompletedObjective(KillAtreides)
Harkonnen.MarkCompletedObjective(KillAtreides)
else
Trigger.OnAllRemovedFromWorld(refs, function()
harkonnen.MarkCompletedObjective(KillAtreides)
Harkonnen.MarkCompletedObjective(KillAtreides)
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(silos, function(actor) Trigger.OnRemovedFromWorld(actor, checkResourceCapacity) end)
end
@@ -143,8 +143,8 @@ WorldLoaded = function()
Media.DisplayMessage(Messages[1], Mentat)
Trigger.AfterDelay(DateTime.Seconds(25), function()
Media.PlaySpeechNotification(player, "Reinforce")
Reinforcements.Reinforce(player, AtreidesReinforcements, AtreidesEntryPath)
Media.PlaySpeechNotification(Atreides, "Reinforce")
Reinforcements.Reinforce(Atreides, AtreidesReinforcements, AtreidesEntryPath)
end)
WavesLeft = HarkonnenAttackWaves[Difficulty]
@@ -158,7 +158,7 @@ SendReinforcements = function()
if HarkonnenAttackDelay < 0 then HarkonnenAttackDelay = 0 end
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
if WavesLeft == 0 then

View File

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

View File

@@ -65,31 +65,31 @@ HarkonnenAttackWaves =
}
Tick = function()
if player.HasNoRequiredUnits() then
harkonnen.MarkCompletedObjective(KillAtreides)
if Atreides.HasNoRequiredUnits() then
Harkonnen.MarkCompletedObjective(KillAtreides)
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)
player.MarkCompletedObjective(KillHarkonnen)
Atreides.MarkCompletedObjective(KillHarkonnen)
end
end
WorldLoaded = function()
harkonnen = Player.GetPlayer("Harkonnen")
player = Player.GetPlayer("Atreides")
Harkonnen = Player.GetPlayer("Harkonnen")
Atreides = Player.GetPlayer("Atreides")
InitObjectives(player)
KillAtreides = AddPrimaryObjective(harkonnen, "")
KillHarkonnen = AddPrimaryObjective(player, "destroy-harkonnen-forces")
InitObjectives(Atreides)
KillAtreides = AddPrimaryObjective(Harkonnen, "")
KillHarkonnen = AddPrimaryObjective(Atreides, "destroy-harkonnen-forces")
Camera.Position = AConyard.CenterPosition
Trigger.OnAllKilled(HarkonnenBase, function()
Utils.Do(harkonnen.GetGroundAttackers(), IdleHunt)
Utils.Do(Harkonnen.GetGroundAttackers(), IdleHunt)
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)
end

View File

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

View File

@@ -65,31 +65,31 @@ HarkonnenAttackWaves =
}
Tick = function()
if player.HasNoRequiredUnits() then
harkonnen.MarkCompletedObjective(KillAtreides)
if Atreides.HasNoRequiredUnits() then
Harkonnen.MarkCompletedObjective(KillAtreides)
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)
player.MarkCompletedObjective(KillHarkonnen)
Atreides.MarkCompletedObjective(KillHarkonnen)
end
end
WorldLoaded = function()
harkonnen = Player.GetPlayer("Harkonnen")
player = Player.GetPlayer("Atreides")
Harkonnen = Player.GetPlayer("Harkonnen")
Atreides = Player.GetPlayer("Atreides")
InitObjectives(player)
KillAtreides = AddPrimaryObjective(harkonnen, "")
KillHarkonnen = AddPrimaryObjective(player, "destroy-harkonnen-forces")
InitObjectives(Atreides)
KillAtreides = AddPrimaryObjective(Harkonnen, "")
KillHarkonnen = AddPrimaryObjective(Atreides, "destroy-harkonnen-forces")
Camera.Position = AConyard.CenterPosition
Trigger.OnAllKilled(HarkonnenBase, function()
Utils.Do(harkonnen.GetGroundAttackers(), IdleHunt)
Utils.Do(Harkonnen.GetGroundAttackers(), IdleHunt)
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)
end

View File

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

View File

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

View File

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

View File

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

View File

@@ -46,13 +46,13 @@ SendAttack = function(owner, size)
end
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
ActivateAI = function()
LastHarvesterEaten[harkonnen] = true
LastHarvesterEaten[Harkonnen] = true
InitAIUnits()
FremenProduction()
@@ -61,6 +61,6 @@ ActivateAI = function()
local tanksToBuild = function() return HarkonnenTankType end
local attackThresholdSize = AttackGroupSize[Difficulty] * 2.5
ProduceUnits(harkonnen, HarkonnenBarracks, delay, infantryToBuild, AttackGroupSize[Difficulty], attackThresholdSize)
ProduceUnits(harkonnen, HarkonnenHeavyFact, delay, tanksToBuild, AttackGroupSize[Difficulty], attackThresholdSize)
ProduceUnits(Harkonnen, HarkonnenBarracks, delay, infantryToBuild, AttackGroupSize[Difficulty], attackThresholdSize)
ProduceUnits(Harkonnen, HarkonnenHeavyFact, delay, tanksToBuild, AttackGroupSize[Difficulty], attackThresholdSize)
end

View File

@@ -96,30 +96,30 @@ FremenProduction = function()
end
local delay = Utils.RandomInteger(FremenInterval[Difficulty][1], FremenInterval[Difficulty][2] + 1)
fremen.Build({ "nsfremen" }, function()
Fremen.Build({ "nsfremen" }, function()
Trigger.AfterDelay(delay, FremenProduction)
end)
end
AttackNotifier = 0
Tick = function()
if player.HasNoRequiredUnits() then
harkonnen.MarkCompletedObjective(KillAtreides)
if Atreides.HasNoRequiredUnits() then
Harkonnen.MarkCompletedObjective(KillAtreides)
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)
player.MarkCompletedObjective(KillHarkonnen)
player.MarkCompletedObjective(ProtectFremen)
player.MarkCompletedObjective(KeepIntegrity)
Atreides.MarkCompletedObjective(KillHarkonnen)
Atreides.MarkCompletedObjective(ProtectFremen)
Atreides.MarkCompletedObjective(KeepIntegrity)
end
if DateTime.GameTime % DateTime.Seconds(10) == 0 and LastHarvesterEaten[harkonnen] then
local units = harkonnen.GetActorsByType("harvester")
if DateTime.GameTime % DateTime.Seconds(10) == 0 and LastHarvesterEaten[Harkonnen] then
local units = Harkonnen.GetActorsByType("harvester")
if #units > 0 then
LastHarvesterEaten[harkonnen] = false
ProtectHarvester(units[1], harkonnen, AttackGroupSize[Difficulty])
LastHarvesterEaten[Harkonnen] = false
ProtectHarvester(units[1], Harkonnen, AttackGroupSize[Difficulty])
end
end
@@ -127,50 +127,50 @@ Tick = function()
AttackNotifier = AttackNotifier - 1
local integrity = math.floor((Sietch.Health * 100) / Sietch.MaxHealth)
SiegeIntegrity = UserInterface.Translate("sietch-integrity", { ["integrity"] = integrity })
UserInterface.SetMissionText(SiegeIntegrity, player.Color)
UserInterface.SetMissionText(SiegeIntegrity, Atreides.Color)
if integrity < IntegrityLevel[Difficulty] then
player.MarkFailedObjective(KeepIntegrity)
Atreides.MarkFailedObjective(KeepIntegrity)
end
end
end
WorldLoaded = function()
harkonnen = Player.GetPlayer("Harkonnen")
fremen = Player.GetPlayer("Fremen")
player = Player.GetPlayer("Atreides")
Harkonnen = Player.GetPlayer("Harkonnen")
Fremen = Player.GetPlayer("Fremen")
Atreides = Player.GetPlayer("Atreides")
InitObjectives(player)
KillAtreides = AddPrimaryObjective(harkonnen, "")
ProtectFremen = AddPrimaryObjective(player, "protect-fremen-sietch")
KillHarkonnen = AddPrimaryObjective(player, "destroy-harkonnen")
InitObjectives(Atreides)
KillAtreides = AddPrimaryObjective(Harkonnen, "")
ProtectFremen = AddPrimaryObjective(Atreides, "protect-fremen-sietch")
KillHarkonnen = AddPrimaryObjective(Atreides, "destroy-harkonnen")
local keepSietchIntact = UserInterface.Translate("keep-sietch-intact", { ["integrity"] = IntegrityLevel[Difficulty] })
KeepIntegrity = AddPrimaryObjective(player, keepSietchIntact)
KeepIntegrity = AddPrimaryObjective(Atreides, keepSietchIntact)
Camera.Position = AConyard.CenterPosition
HarkonnenAttackLocation = AConyard.Location
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)
end)
Trigger.OnAllKilledOrCaptured(HarkonnenBase, function()
Utils.Do(harkonnen.GetGroundAttackers(), IdleHunt)
Utils.Do(Harkonnen.GetGroundAttackers(), IdleHunt)
end)
Trigger.OnKilled(Sietch, function()
Actor.Create("invisibleBlocker", true, { Owner = fremen, Location = CPos.New(62, 59) })
UserInterface.SetMissionText(UserInterface.Translate("sietch-destroyed"), player.Color)
player.MarkFailedObjective(ProtectFremen)
Actor.Create("invisibleBlocker", true, { Owner = Fremen, Location = CPos.New(62, 59) })
UserInterface.SetMissionText(UserInterface.Translate("sietch-destroyed"), Atreides.Color)
Atreides.MarkFailedObjective(ProtectFremen)
end)
Trigger.OnDamaged(Sietch, function()
if AttackNotifier <= 0 then
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)
local defenders = fremen.GetGroundAttackers()
local defenders = Fremen.GetGroundAttackers()
if #defenders > 0 then
Utils.Do(defenders, function(unit)
unit.Guard(Sietch)
@@ -180,35 +180,35 @@ WorldLoaded = function()
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)
unit.AttackMove(HarkonnenAttackLocation)
IdleHunt(unit)
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(DateTime.Seconds(50), function()
Media.PlaySpeechNotification(player, "Reinforce")
Reinforcements.Reinforce(player, AtreidesReinforcements[1], AtreidesPath)
Media.PlaySpeechNotification(Atreides, "Reinforce")
Reinforcements.Reinforce(Atreides, AtreidesReinforcements[1], AtreidesPath)
end)
Trigger.AfterDelay(DateTime.Minutes(1) + DateTime.Seconds(40), function()
Media.PlaySpeechNotification(player, "Reinforce")
Reinforcements.ReinforceWithTransport(player, "carryall.reinforce", AtreidesReinforcements[2], AtreidesPath, { AtreidesPath[1] })
Media.PlaySpeechNotification(Atreides, "Reinforce")
Reinforcements.ReinforceWithTransport(Atreides, "carryall.reinforce", AtreidesReinforcements[2], AtreidesPath, { AtreidesPath[1] })
end)
Trigger.OnEnteredProximityTrigger(HarkonnenRally1.CenterPosition, WDist.New(6 * 1024), function(a, id)
if a.Owner == player then
if a.Owner == Atreides then
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)
end
end)
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)
Trigger.OnIdle(a, function()
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" }
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])
DefendActor(HarkonnenBarracks, harkonnen, AttackGroupSize[Difficulty])
RepairBuilding(harkonnen, HarkonnenBarracks, 0.75)
DefendAndRepairBase(Harkonnen, HarkonnenBase, 0.75, AttackGroupSize[Difficulty])
DefendActor(HarkonnenBarracks, Harkonnen, AttackGroupSize[Difficulty])
RepairBuilding(Harkonnen, HarkonnenBarracks, 0.75)
Utils.Do(SmugglerBase, function(actor)
RepairBuilding(smuggler, actor, 0.75)
RepairBuilding(Smuggler, actor, 0.75)
end)
RepairBuilding(smuggler, Starport, 0.75)
RepairBuilding(Smuggler, Starport, 0.75)
end
-- Not using ProduceUnits because of the custom StopInfantryProduction condition
ProduceInfantry = function()
if StopInfantryProduction or HarkonnenBarracks.IsDead or HarkonnenBarracks.Owner ~= harkonnen then
if StopInfantryProduction or HarkonnenBarracks.IsDead or HarkonnenBarracks.Owner ~= Harkonnen then
return
end
if HoldProduction[harkonnen] then
if HoldProduction[Harkonnen] then
Trigger.AfterDelay(DateTime.Seconds(30), ProduceInfantry)
return
end
local delay = Utils.RandomInteger(AttackDelays[Difficulty][1], AttackDelays[Difficulty][2] + 1)
local toBuild = { Utils.Random(HarkonnenInfantryTypes) }
harkonnen.Build(toBuild, function(unit)
IdlingUnits[harkonnen][#IdlingUnits[harkonnen] + 1] = unit[1]
Harkonnen.Build(toBuild, function(unit)
IdlingUnits[Harkonnen][#IdlingUnits[Harkonnen] + 1] = unit[1]
Trigger.AfterDelay(delay, ProduceInfantry)
if #IdlingUnits[harkonnen] >= (AttackGroupSize[Difficulty] * 2.5) then
SendAttack(harkonnen, AttackGroupSize[Difficulty])
if #IdlingUnits[Harkonnen] >= (AttackGroupSize[Difficulty] * 2.5) then
SendAttack(Harkonnen, AttackGroupSize[Difficulty])
end
end)
end
ActivateAI = function()
harkonnen.Cash = 15000
LastHarvesterEaten[harkonnen] = true
Harkonnen.Cash = 15000
LastHarvesterEaten[Harkonnen] = true
InitAIUnits()
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
ProduceInfantry()
ProduceUnits(harkonnen, HarkonnenLightFactory, delay, vehilcesToBuild, AttackGroupSize[Difficulty], attackThresholdSize)
ProduceUnits(harkonnen, HarkonnenHeavyFactory, delay, tanksToBuild, AttackGroupSize[Difficulty], attackThresholdSize)
ProduceUnits(Harkonnen, HarkonnenLightFactory, delay, vehilcesToBuild, AttackGroupSize[Difficulty], attackThresholdSize)
ProduceUnits(Harkonnen, HarkonnenHeavyFactory, delay, tanksToBuild, AttackGroupSize[Difficulty], attackThresholdSize)
end

View File

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

View File

@@ -61,16 +61,16 @@ Messages =
CachedResources = -1
Tick = function()
if AtreidesArrived and atreides.HasNoRequiredUnits() then
player.MarkCompletedObjective(KillAtreides)
if AtreidesArrived and Atreides.HasNoRequiredUnits() then
Harkonnen.MarkCompletedObjective(KillAtreides)
end
if player.Resources > SpiceToHarvest - 1 then
player.MarkCompletedObjective(GatherSpice)
if Harkonnen.Resources > SpiceToHarvest - 1 then
Harkonnen.MarkCompletedObjective(GatherSpice)
end
-- 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
Media.DisplayMessage(Messages[2], Mentat)
else
@@ -78,40 +78,40 @@ Tick = function()
end
-- 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)
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)
end
if player.Resources ~= CachedResources then
local parameters = { ["harvested"] = player.Resources, ["goal"] = SpiceToHarvest }
if Harkonnen.Resources ~= CachedResources then
local parameters = { ["harvested"] = Harkonnen.Resources, ["goal"] = SpiceToHarvest }
local harvestedResources = UserInterface.Translate("harvested-resources", parameters)
UserInterface.SetMissionText(harvestedResources)
CachedResources = player.Resources
CachedResources = Harkonnen.Resources
end
end
WorldLoaded = function()
player = Player.GetPlayer("Harkonnen")
atreides = Player.GetPlayer("Atreides")
Harkonnen = Player.GetPlayer("Harkonnen")
Atreides = Player.GetPlayer("Atreides")
SpiceToHarvest = ToHarvest[Difficulty]
InitObjectives(player)
KillHarkonnen = AddPrimaryObjective(atreides, "")
InitObjectives(Harkonnen)
KillHarkonnen = AddPrimaryObjective(Atreides, "")
local harvestSpice = UserInterface.Translate("harvest-spice", { ["spice"] = SpiceToHarvest })
GatherSpice = AddPrimaryObjective(player, harvestSpice)
KillAtreides = AddSecondaryObjective(player, "eliminate-atreides-units-reinforcements")
GatherSpice = AddPrimaryObjective(Harkonnen, harvestSpice)
KillAtreides = AddSecondaryObjective(Harkonnen, "eliminate-atreides-units-reinforcements")
local checkResourceCapacity = function()
Trigger.AfterDelay(0, function()
if player.ResourceCapacity < SpiceToHarvest then
if Harkonnen.ResourceCapacity < SpiceToHarvest then
Media.DisplayMessage(UserInterface.Translate("not-enough-silos"), Mentat)
Trigger.AfterDelay(DateTime.Seconds(3), function()
harkonnen.MarkCompletedObjective(KillAtreides)
Harkonnen.MarkCompletedObjective(KillAtreides)
end)
return true
@@ -126,16 +126,16 @@ WorldLoaded = function()
return
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
atreides.MarkCompletedObjective(KillHarkonnen)
Atreides.MarkCompletedObjective(KillHarkonnen)
else
Trigger.OnAllRemovedFromWorld(refs, function()
atreides.MarkCompletedObjective(KillHarkonnen)
Atreides.MarkCompletedObjective(KillHarkonnen)
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(silos, function(actor) Trigger.OnRemovedFromWorld(actor, checkResourceCapacity) end)
end
@@ -144,8 +144,8 @@ WorldLoaded = function()
Media.DisplayMessage(Messages[1], Mentat)
Trigger.AfterDelay(DateTime.Seconds(25), function()
Media.PlaySpeechNotification(player, "Reinforce")
Reinforcements.Reinforce(player, HarkonnenReinforcements, HarkonnenEntryPath)
Media.PlaySpeechNotification(Harkonnen, "Reinforce")
Reinforcements.Reinforce(Harkonnen, HarkonnenReinforcements, HarkonnenEntryPath)
end)
WavesLeft = AtreidesAttackWaves[Difficulty]
@@ -159,7 +159,7 @@ SendReinforcements = function()
if AtreidesAttackDelay < 0 then AtreidesAttackDelay = 0 end
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
if WavesLeft == 0 then

View File

@@ -61,16 +61,16 @@ Messages =
CachedResources = -1
Tick = function()
if AtreidesArrived and atreides.HasNoRequiredUnits() then
player.MarkCompletedObjective(KillAtreides)
if AtreidesArrived and Atreides.HasNoRequiredUnits() then
Harkonnen.MarkCompletedObjective(KillAtreides)
end
if player.Resources > SpiceToHarvest - 1 then
player.MarkCompletedObjective(GatherSpice)
if Harkonnen.Resources > SpiceToHarvest - 1 then
Harkonnen.MarkCompletedObjective(GatherSpice)
end
-- 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
Media.DisplayMessage(Messages[2], Mentat)
else
@@ -78,40 +78,40 @@ Tick = function()
end
-- 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)
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)
end
if player.Resources ~= CachedResources then
local parameters = { ["harvested"] = player.Resources, ["goal"] = SpiceToHarvest }
if Harkonnen.Resources ~= CachedResources then
local parameters = { ["harvested"] = Harkonnen.Resources, ["goal"] = SpiceToHarvest }
local harvestedResources = UserInterface.Translate("harvested-resources", parameters)
UserInterface.SetMissionText(harvestedResources)
CachedResources = player.Resources
CachedResources = Harkonnen.Resources
end
end
WorldLoaded = function()
player = Player.GetPlayer("Harkonnen")
atreides = Player.GetPlayer("Atreides")
Harkonnen = Player.GetPlayer("Harkonnen")
Atreides = Player.GetPlayer("Atreides")
SpiceToHarvest = ToHarvest[Difficulty]
InitObjectives(player)
KillHarkonnen = AddPrimaryObjective(atreides, "")
InitObjectives(Harkonnen)
KillHarkonnen = AddPrimaryObjective(Atreides, "")
local harvestSpice = UserInterface.Translate("harvest-spice", { ["spice"] = SpiceToHarvest })
GatherSpice = AddPrimaryObjective(player, harvestSpice)
KillAtreides = AddSecondaryObjective(player, "eliminate-atreides-units-reinforcements")
GatherSpice = AddPrimaryObjective(Harkonnen, harvestSpice)
KillAtreides = AddSecondaryObjective(Harkonnen, "eliminate-atreides-units-reinforcements")
local checkResourceCapacity = function()
Trigger.AfterDelay(0, function()
if player.ResourceCapacity < SpiceToHarvest then
if Harkonnen.ResourceCapacity < SpiceToHarvest then
Media.DisplayMessage(UserInterface.Translate("not-enough-silos"), Mentat)
Trigger.AfterDelay(DateTime.Seconds(3), function()
harkonnen.MarkCompletedObjective(KillAtreides)
Harkonnen.MarkCompletedObjective(KillAtreides)
end)
return true
@@ -126,16 +126,16 @@ WorldLoaded = function()
return
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
atreides.MarkCompletedObjective(KillHarkonnen)
Atreides.MarkCompletedObjective(KillHarkonnen)
else
Trigger.OnAllRemovedFromWorld(refs, function()
atreides.MarkCompletedObjective(KillHarkonnen)
Atreides.MarkCompletedObjective(KillHarkonnen)
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(silos, function(actor) Trigger.OnRemovedFromWorld(actor, checkResourceCapacity) end)
end
@@ -144,8 +144,8 @@ WorldLoaded = function()
Media.DisplayMessage(Messages[1], Mentat)
Trigger.AfterDelay(DateTime.Seconds(25), function()
Media.PlaySpeechNotification(player, "Reinforce")
Reinforcements.Reinforce(player, HarkonnenReinforcements, HarkonnenEntryPath)
Media.PlaySpeechNotification(Harkonnen, "Reinforce")
Reinforcements.Reinforce(Harkonnen, HarkonnenReinforcements, HarkonnenEntryPath)
end)
WavesLeft = AtreidesAttackWaves[Difficulty]
@@ -159,7 +159,7 @@ SendReinforcements = function()
if AtreidesAttackDelay < 0 then AtreidesAttackDelay = 0 end
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
if WavesLeft == 0 then

View File

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

View File

@@ -65,31 +65,31 @@ AtreidesAttackWaves =
}
Tick = function()
if player.HasNoRequiredUnits() then
atreides.MarkCompletedObjective(KillHarkonnen)
if Harkonnen.HasNoRequiredUnits() then
Atreides.MarkCompletedObjective(KillHarkonnen)
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)
player.MarkCompletedObjective(KillAtreides)
Harkonnen.MarkCompletedObjective(KillAtreides)
end
end
WorldLoaded = function()
atreides = Player.GetPlayer("Atreides")
player = Player.GetPlayer("Harkonnen")
Atreides = Player.GetPlayer("Atreides")
Harkonnen = Player.GetPlayer("Harkonnen")
InitObjectives(player)
KillHarkonnen = AddPrimaryObjective(atreides, "")
KillAtreides = AddSecondaryObjective(player, "destroy-atreides-forces")
InitObjectives(Harkonnen)
KillHarkonnen = AddPrimaryObjective(Atreides, "")
KillAtreides = AddSecondaryObjective(Harkonnen, "destroy-atreides-forces")
Camera.Position = HConyard.CenterPosition
Trigger.OnAllKilled(AtreidesBase, function()
Utils.Do(atreides.GetGroundAttackers(), IdleHunt)
Utils.Do(Atreides.GetGroundAttackers(), IdleHunt)
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)
end

View File

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

View File

@@ -65,31 +65,31 @@ AtreidesAttackWaves =
}
Tick = function()
if player.HasNoRequiredUnits() then
atreides.MarkCompletedObjective(KillHarkonnen)
if Harkonnen.HasNoRequiredUnits() then
Atreides.MarkCompletedObjective(KillHarkonnen)
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)
player.MarkCompletedObjective(KillAtreides)
Harkonnen.MarkCompletedObjective(KillAtreides)
end
end
WorldLoaded = function()
atreides = Player.GetPlayer("Atreides")
player = Player.GetPlayer("Harkonnen")
Atreides = Player.GetPlayer("Atreides")
Harkonnen = Player.GetPlayer("Harkonnen")
InitObjectives(player)
KillHarkonnen = AddPrimaryObjective(atreides, "")
KillAtreides = AddSecondaryObjective(player, "destroy-atreides-forces")
InitObjectives(Harkonnen)
KillHarkonnen = AddPrimaryObjective(Atreides, "")
KillAtreides = AddSecondaryObjective(Harkonnen, "destroy-atreides-forces")
Camera.Position = HConyard.CenterPosition
Trigger.OnAllKilled(AtreidesBase, function()
Utils.Do(atreides.GetGroundAttackers(), IdleHunt)
Utils.Do(Atreides.GetGroundAttackers(), IdleHunt)
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)
end

View File

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

View File

@@ -94,25 +94,25 @@ HarkonnenBaseBuildings = { "barracks", "light_factory" }
HarkonnenUpgrades = { "upgrade.barracks", "upgrade.light" }
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
Tick = function()
if player.HasNoRequiredUnits() then
atreides.MarkCompletedObjective(KillHarkonnen)
if Harkonnen.HasNoRequiredUnits() then
Atreides.MarkCompletedObjective(KillHarkonnen)
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)
player.MarkCompletedObjective(KillAtreides)
Harkonnen.MarkCompletedObjective(KillAtreides)
end
if DateTime.GameTime % DateTime.Seconds(10) == 0 and LastHarvesterEaten[atreides] then
local units = atreides.GetActorsByType("harvester")
if DateTime.GameTime % DateTime.Seconds(10) == 0 and LastHarvesterEaten[Atreides] then
local units = Atreides.GetActorsByType("harvester")
if #units > 0 then
LastHarvesterEaten[atreides] = false
ProtectHarvester(units[1], atreides, AttackGroupSize[Difficulty])
LastHarvesterEaten[Atreides] = false
ProtectHarvester(units[1], Atreides, AttackGroupSize[Difficulty])
end
end
@@ -122,31 +122,31 @@ Tick = function()
end
WorldLoaded = function()
atreides = Player.GetPlayer("Atreides")
player = Player.GetPlayer("Harkonnen")
Atreides = Player.GetPlayer("Atreides")
Harkonnen = Player.GetPlayer("Harkonnen")
InitObjectives(player)
KillHarkonnen = AddPrimaryObjective(atreides, "")
KillAtreides = AddPrimaryObjective(player, "eliminate-atreides-units-reinforcements")
InitObjectives(Harkonnen)
KillHarkonnen = AddPrimaryObjective(Atreides, "")
KillAtreides = AddPrimaryObjective(Harkonnen, "eliminate-atreides-units-reinforcements")
Camera.Position = HConyard.CenterPosition
Trigger.OnAllKilled(AtreidesBase, function()
Utils.Do(atreides.GetGroundAttackers(), IdleHunt)
Utils.Do(Atreides.GetGroundAttackers(), IdleHunt)
end)
local path = function() return Utils.Random(AtreidesPaths) end
local waveCondition = function() return player.IsObjectiveCompleted(KillAtreides) end
SendCarryallReinforcements(atreides, 0, AtreidesAttackWaves[Difficulty], AtreidesAttackDelay[Difficulty], path, AtreidesReinforcements[Difficulty], waveCondition)
local waveCondition = function() return Harkonnen.IsObjectiveCompleted(KillAtreides) end
SendCarryallReinforcements(Atreides, 0, AtreidesAttackWaves[Difficulty], AtreidesAttackDelay[Difficulty], path, AtreidesReinforcements[Difficulty], waveCondition)
Trigger.AfterDelay(0, ActivateAI)
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)
TriggerCarryallReinforcements(player, atreides, AtreidesBaseAreaTriggers[1], AtreidesHunters[1], AtreidesHunterPaths[1])
TriggerCarryallReinforcements(player, atreides, AtreidesBaseAreaTriggers[1], AtreidesHunters[2], AtreidesHunterPaths[2])
TriggerCarryallReinforcements(player, atreides, AtreidesBaseAreaTriggers[2], AtreidesHunters[3], AtreidesHunterPaths[3])
TriggerCarryallReinforcements(player, atreides, AtreidesBaseAreaTriggers[2], AtreidesHunters[4], AtreidesHunterPaths[4])
TriggerCarryallReinforcements(player, atreides, AtreidesBaseAreaTriggers[3], AtreidesHunters[5], AtreidesHunterPaths[5])
TriggerCarryallReinforcements(Harkonnen, Atreides, AtreidesBaseAreaTriggers[1], AtreidesHunters[1], AtreidesHunterPaths[1])
TriggerCarryallReinforcements(Harkonnen, Atreides, AtreidesBaseAreaTriggers[1], AtreidesHunters[2], AtreidesHunterPaths[2])
TriggerCarryallReinforcements(Harkonnen, Atreides, AtreidesBaseAreaTriggers[2], AtreidesHunters[3], AtreidesHunterPaths[3])
TriggerCarryallReinforcements(Harkonnen, Atreides, AtreidesBaseAreaTriggers[2], AtreidesHunters[4], AtreidesHunterPaths[4])
TriggerCarryallReinforcements(Harkonnen, Atreides, AtreidesBaseAreaTriggers[3], AtreidesHunters[5], AtreidesHunterPaths[5])
end

View File

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

View File

@@ -96,25 +96,25 @@ HarkonnenBaseBuildings = { "barracks", "light_factory" }
HarkonnenUpgrades = { "upgrade.barracks", "upgrade.light" }
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
Tick = function()
if player.HasNoRequiredUnits() then
atreides.MarkCompletedObjective(KillHarkonnen)
if Harkonnen.HasNoRequiredUnits() then
Atreides.MarkCompletedObjective(KillHarkonnen)
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)
player.MarkCompletedObjective(KillAtreides)
Harkonnen.MarkCompletedObjective(KillAtreides)
end
if DateTime.GameTime % DateTime.Seconds(10) == 0 and LastHarvesterEaten[atreides] then
local units = atreides.GetActorsByType("harvester")
if DateTime.GameTime % DateTime.Seconds(10) == 0 and LastHarvesterEaten[Atreides] then
local units = Atreides.GetActorsByType("harvester")
if #units > 0 then
LastHarvesterEaten[atreides] = false
ProtectHarvester(units[1], atreides, AttackGroupSize[Difficulty])
LastHarvesterEaten[Atreides] = false
ProtectHarvester(units[1], Atreides, AttackGroupSize[Difficulty])
end
end
@@ -124,30 +124,30 @@ Tick = function()
end
WorldLoaded = function()
atreides = Player.GetPlayer("Atreides")
player = Player.GetPlayer("Harkonnen")
Atreides = Player.GetPlayer("Atreides")
Harkonnen = Player.GetPlayer("Harkonnen")
InitObjectives(player)
KillHarkonnen = AddPrimaryObjective(atreides, "")
KillAtreides = AddPrimaryObjective(player, "eliminate-atreides-units-reinforcements")
InitObjectives(Harkonnen)
KillHarkonnen = AddPrimaryObjective(Atreides, "")
KillAtreides = AddPrimaryObjective(Harkonnen, "eliminate-atreides-units-reinforcements")
Camera.Position = HConyard.CenterPosition
Trigger.OnAllKilled(AtreidesBase, function()
Utils.Do(atreides.GetGroundAttackers(), IdleHunt)
Utils.Do(Atreides.GetGroundAttackers(), IdleHunt)
end)
local path = function() return Utils.Random(AtreidesPaths) end
local waveCondition = function() return player.IsObjectiveCompleted(KillAtreides) end
SendCarryallReinforcements(atreides, 0, AtreidesAttackWaves[Difficulty], AtreidesAttackDelay[Difficulty], path, AtreidesReinforcements[Difficulty], waveCondition)
local waveCondition = function() return Harkonnen.IsObjectiveCompleted(KillAtreides) end
SendCarryallReinforcements(Atreides, 0, AtreidesAttackWaves[Difficulty], AtreidesAttackDelay[Difficulty], path, AtreidesReinforcements[Difficulty], waveCondition)
ActivateAI()
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)
TriggerCarryallReinforcements(player, atreides, AtreidesBaseAreaTriggers[1], AtreidesHunters[1], AtreidesHunterPaths[1])
TriggerCarryallReinforcements(player, atreides, AtreidesBaseAreaTriggers[2], AtreidesHunters[2], AtreidesHunterPaths[2])
TriggerCarryallReinforcements(player, atreides, AtreidesBaseAreaTriggers[3], AtreidesHunters[3], AtreidesHunterPaths[3])
TriggerCarryallReinforcements(player, atreides, AtreidesBaseAreaTriggers[4], AtreidesHunters[4], AtreidesHunterPaths[4])
TriggerCarryallReinforcements(Harkonnen, Atreides, AtreidesBaseAreaTriggers[1], AtreidesHunters[1], AtreidesHunterPaths[1])
TriggerCarryallReinforcements(Harkonnen, Atreides, AtreidesBaseAreaTriggers[2], AtreidesHunters[2], AtreidesHunterPaths[2])
TriggerCarryallReinforcements(Harkonnen, Atreides, AtreidesBaseAreaTriggers[3], AtreidesHunters[3], AtreidesHunterPaths[3])
TriggerCarryallReinforcements(Harkonnen, Atreides, AtreidesBaseAreaTriggers[4], AtreidesHunters[4], AtreidesHunterPaths[4])
end

View File

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

View File

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

View File

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

View File

@@ -131,11 +131,11 @@ HarkonnenPaths =
SendStarportReinforcements = function()
Trigger.AfterDelay(CorrinoStarportDelay[Difficulty], function()
if CStarport.IsDead or CStarport.Owner ~= corrino then
if CStarport.IsDead or CStarport.Owner ~= Corrino then
return
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)
unit.AttackMove(OrdosAttackLocation)
IdleHunt(unit)
@@ -143,7 +143,7 @@ SendStarportReinforcements = function()
SendStarportReinforcements()
if player.IsObjectiveFailed(GuardOutpost) then
if Harkonnen.IsObjectiveFailed(GuardOutpost) then
return
end
@@ -153,16 +153,16 @@ end
SendHarkonnenReinforcements = function(delay, number)
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()
Media.PlaySpeechNotification(player, "Reinforce")
Media.PlaySpeechNotification(Harkonnen, "Reinforce")
end)
end)
end
OrdosReinforcementNotification = function(currentWave, totalWaves)
Trigger.AfterDelay(OrdosAttackDelay[Difficulty], function()
if player.IsObjectiveFailed(GuardOutpost) or player.IsObjectiveCompleted(KillOrdos) then
if Harkonnen.IsObjectiveFailed(GuardOutpost) or Harkonnen.IsObjectiveCompleted(KillOrdos) then
return
end
@@ -179,62 +179,62 @@ end
Tick = function()
if player.HasNoRequiredUnits() then
ordos_main.MarkCompletedObjective(KillHarkonnen1)
ordos_small.MarkCompletedObjective(KillHarkonnen2)
corrino.MarkCompletedObjective(KillHarkonnen3)
if Harkonnen.HasNoRequiredUnits() then
OrdosMain.MarkCompletedObjective(KillHarkonnen1)
OrdosSmall.MarkCompletedObjective(KillHarkonnen2)
Corrino.MarkCompletedObjective(KillHarkonnen3)
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)
player.MarkCompletedObjective(KillOrdos)
Harkonnen.MarkCompletedObjective(KillOrdos)
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)
player.MarkCompletedObjective(KillCorrino)
Harkonnen.MarkCompletedObjective(KillCorrino)
end
if player.IsObjectiveCompleted(KillOrdos) and player.IsObjectiveCompleted(KillCorrino) and not player.IsObjectiveCompleted(GuardOutpost) then
player.MarkCompletedObjective(GuardOutpost)
if Harkonnen.IsObjectiveCompleted(KillOrdos) and Harkonnen.IsObjectiveCompleted(KillCorrino) and not Harkonnen.IsObjectiveCompleted(GuardOutpost) then
Harkonnen.MarkCompletedObjective(GuardOutpost)
end
if (HOutpost.IsDead or HOutpost.Owner ~= player) and not player.IsObjectiveFailed(GuardOutpost) then
player.MarkFailedObjective(GuardOutpost)
if (HOutpost.IsDead or HOutpost.Owner ~= Harkonnen) and not Harkonnen.IsObjectiveFailed(GuardOutpost) then
Harkonnen.MarkFailedObjective(GuardOutpost)
end
if DateTime.GameTime % DateTime.Seconds(10) == 0 and LastHarvesterEaten[ordos_main] then
local units = ordos_main.GetActorsByType("harvester")
if DateTime.GameTime % DateTime.Seconds(10) == 0 and LastHarvesterEaten[OrdosMain] then
local units = OrdosMain.GetActorsByType("harvester")
if #units > 0 then
LastHarvesterEaten[ordos_main] = false
ProtectHarvester(units[1], ordos_main, AttackGroupSize[Difficulty])
LastHarvesterEaten[OrdosMain] = false
ProtectHarvester(units[1], OrdosMain, AttackGroupSize[Difficulty])
end
end
if DateTime.GameTime % DateTime.Seconds(10) == 0 and LastHarvesterEaten[ordos_small] then
local units = ordos_small.GetActorsByType("harvester")
if DateTime.GameTime % DateTime.Seconds(10) == 0 and LastHarvesterEaten[OrdosSmall] then
local units = OrdosSmall.GetActorsByType("harvester")
if #units > 0 then
LastHarvesterEaten[ordos_small] = false
ProtectHarvester(units[1], ordos_small, AttackGroupSize[Difficulty])
LastHarvesterEaten[OrdosSmall] = false
ProtectHarvester(units[1], OrdosSmall, AttackGroupSize[Difficulty])
end
end
end
WorldLoaded = function()
ordos_main = Player.GetPlayer("Ordos Main Base")
ordos_small = Player.GetPlayer("Ordos Small Base")
corrino = Player.GetPlayer("Corrino")
player = Player.GetPlayer("Harkonnen")
OrdosMain = Player.GetPlayer("Ordos Main Base")
OrdosSmall = Player.GetPlayer("Ordos Small Base")
Corrino = Player.GetPlayer("Corrino")
Harkonnen = Player.GetPlayer("Harkonnen")
InitObjectives(player)
KillOrdos = AddPrimaryObjective(player, "destroy-ordos")
KillCorrino = AddPrimaryObjective(player, "destroy-imperial-forces")
GuardOutpost = AddSecondaryObjective(player, "keep-modified-outpost-intact")
KillHarkonnen1 = AddPrimaryObjective(ordos_main, "")
KillHarkonnen2 = AddPrimaryObjective(ordos_small, "")
KillHarkonnen3 = AddPrimaryObjective(corrino, "")
InitObjectives(Harkonnen)
KillOrdos = AddPrimaryObjective(Harkonnen, "destroy-ordos")
KillCorrino = AddPrimaryObjective(Harkonnen, "destroy-imperial-forces")
GuardOutpost = AddSecondaryObjective(Harkonnen, "keep-modified-outpost-intact")
KillHarkonnen1 = AddPrimaryObjective(OrdosMain, "")
KillHarkonnen2 = AddPrimaryObjective(OrdosSmall, "")
KillHarkonnen3 = AddPrimaryObjective(Corrino, "")
HOutpost.GrantCondition("modified")
@@ -242,15 +242,15 @@ WorldLoaded = function()
OrdosAttackLocation = HConYard.Location
Trigger.OnAllKilledOrCaptured(OrdosMainBase, function()
Utils.Do(ordos_main.GetGroundAttackers(), IdleHunt)
Utils.Do(OrdosMain.GetGroundAttackers(), IdleHunt)
end)
Trigger.OnAllKilledOrCaptured(OrdosSmallBase, function()
Utils.Do(ordos_small.GetGroundAttackers(), IdleHunt)
Utils.Do(OrdosSmall.GetGroundAttackers(), IdleHunt)
end)
Trigger.OnAllKilledOrCaptured(CorrinoBase, function()
Utils.Do(corrino.GetGroundAttackers(), IdleHunt)
Utils.Do(Corrino.GetGroundAttackers(), IdleHunt)
end)
Trigger.AfterDelay(DateTime.Seconds(5), function()
@@ -258,28 +258,28 @@ WorldLoaded = function()
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)
unit.AttackMove(OrdosAttackLocation)
IdleHunt(unit)
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])
SendStarportReinforcements()
Actor.Create("upgrade.barracks", true, { Owner = ordos_main })
Actor.Create("upgrade.light", true, { Owner = ordos_main })
Actor.Create("upgrade.heavy", true, { Owner = ordos_main })
Actor.Create("upgrade.barracks", true, { Owner = ordos_small })
Actor.Create("upgrade.light", true, { Owner = ordos_small })
Actor.Create("upgrade.barracks", true, { Owner = OrdosMain })
Actor.Create("upgrade.light", true, { Owner = OrdosMain })
Actor.Create("upgrade.heavy", true, { Owner = OrdosMain })
Actor.Create("upgrade.barracks", true, { Owner = OrdosSmall })
Actor.Create("upgrade.light", true, { Owner = OrdosSmall })
Trigger.AfterDelay(0, ActivateAI)
SendHarkonnenReinforcements(DateTime.Seconds(15), 1)
SendHarkonnenReinforcements(DateTime.Seconds(30), 1)
SendHarkonnenReinforcements(DateTime.Seconds(35), 2)
local ordosCondition = function() return player.IsObjectiveCompleted(KillOrdos) end
TriggerCarryallReinforcements(player, ordos_main, BaseAreaTriggers[1], OrdosHunters[1], OrdosHunterPaths[2], ordosCondition)
TriggerCarryallReinforcements(player, ordos_main, BaseAreaTriggers[2], OrdosHunters[2], OrdosHunterPaths[1], ordosCondition)
local ordosCondition = function() return Harkonnen.IsObjectiveCompleted(KillOrdos) end
TriggerCarryallReinforcements(Harkonnen, OrdosMain, BaseAreaTriggers[1], OrdosHunters[1], OrdosHunterPaths[2], ordosCondition)
TriggerCarryallReinforcements(Harkonnen, OrdosMain, BaseAreaTriggers[2], OrdosHunters[2], OrdosHunterPaths[1], ordosCondition)
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" }
ActivateAI = function()
IdlingUnits[ordos_main] = Reinforcements.Reinforce(ordos_main, InitialOrdosReinforcements[1], InitialOrdosPaths[1]), Reinforcements.Reinforce(ordos_main, InitialOrdosReinforcements[2], InitialOrdosPaths[2])
IdlingUnits[ordos_small] = Reinforcements.Reinforce(ordos_small, InitialOrdosReinforcements[1], InitialOrdosPaths[3])
IdlingUnits[OrdosMain] = Reinforcements.Reinforce(OrdosMain, InitialOrdosReinforcements[1], InitialOrdosPaths[1]), Reinforcements.Reinforce(OrdosMain, InitialOrdosReinforcements[2], InitialOrdosPaths[2])
IdlingUnits[OrdosSmall] = Reinforcements.Reinforce(OrdosSmall, InitialOrdosReinforcements[1], InitialOrdosPaths[3])
DefendAndRepairBase(ordos_main, OrdosMainBase, 0.75, AttackGroupSize[Difficulty])
DefendAndRepairBase(ordos_small, OrdosSmallBase, 0.75, AttackGroupSize[Difficulty])
DefendAndRepairBase(OrdosMain, OrdosMainBase, 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 infantryToBuild = function() return { Utils.Random(OrdosInfantryTypes) } end
@@ -40,11 +40,11 @@ ActivateAI = function()
local unitsToBuy = function() return { Utils.Random(OrdosStarportTypes) } end
local attackThresholdSize = AttackGroupSize[Difficulty] * 2.5
ProduceUnits(ordos_main, OBarracks1, delay, infantryToBuild, AttackGroupSize[Difficulty], attackThresholdSize)
ProduceUnits(ordos_main, OLightFactory1, delay, vehilcesToBuild, AttackGroupSize[Difficulty], attackThresholdSize)
ProduceUnits(ordos_main, OHeavyFactory1, delay, tanksToBuild, AttackGroupSize[Difficulty], attackThresholdSize)
ProduceUnits(ordos_main, OStarport, delay, unitsToBuy, AttackGroupSize[Difficulty], attackThresholdSize)
ProduceUnits(OrdosMain, OBarracks1, delay, infantryToBuild, AttackGroupSize[Difficulty], attackThresholdSize)
ProduceUnits(OrdosMain, OLightFactory1, delay, vehilcesToBuild, AttackGroupSize[Difficulty], attackThresholdSize)
ProduceUnits(OrdosMain, OHeavyFactory1, delay, tanksToBuild, AttackGroupSize[Difficulty], attackThresholdSize)
ProduceUnits(OrdosMain, OStarport, delay, unitsToBuy, AttackGroupSize[Difficulty], attackThresholdSize)
ProduceUnits(ordos_small, OBarracks2, delay, infantryToBuild, AttackGroupSize[Difficulty], attackThresholdSize)
ProduceUnits(ordos_small, OLightFactory2, delay, vehilcesToBuild, AttackGroupSize[Difficulty], attackThresholdSize)
ProduceUnits(OrdosSmall, OBarracks2, delay, infantryToBuild, AttackGroupSize[Difficulty], attackThresholdSize)
ProduceUnits(OrdosSmall, OLightFactory2, delay, vehilcesToBuild, AttackGroupSize[Difficulty], attackThresholdSize)
end

View File

@@ -115,11 +115,11 @@ HarkonnenPaths =
SendStarportReinforcements = function()
Trigger.AfterDelay(OrdosStarportDelay[Difficulty], function()
if OStarport.IsDead or OStarport.Owner ~= ordos_main then
if OStarport.IsDead or OStarport.Owner ~= OrdosMain then
return
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)
unit.AttackMove(OrdosAttackLocation)
IdleHunt(unit)
@@ -133,9 +133,9 @@ end
SendHarkonnenReinforcements = function(delay, number)
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()
Media.PlaySpeechNotification(player, "Reinforce")
Media.PlaySpeechNotification(Harkonnen, "Reinforce")
end)
end)
end
@@ -152,45 +152,45 @@ end
CheckSmugglerEnemies = function()
Utils.Do(SmugglerUnits, function(unit)
Trigger.OnDamaged(unit, function(self, attacker)
if unit.Owner == smuggler_neutral and attacker.Owner == player then
ChangeOwner(smuggler_neutral, smuggler_harkonnen)
if unit.Owner == SmugglerNeutral and attacker.Owner == Harkonnen then
ChangeOwner(SmugglerNeutral, SmugglerHarkonnen)
-- Ensure that harvesters that was on a carryall switched sides.
Trigger.AfterDelay(DateTime.Seconds(15), function()
ChangeOwner(smuggler_neutral, smuggler_harkonnen)
ChangeOwner(SmugglerNeutral, SmugglerHarkonnen)
end)
end
if unit.Owner == smuggler_ordos and attacker.Owner == player then
ChangeOwner(smuggler_ordos, smuggler_both)
if unit.Owner == SmugglerOrdos and attacker.Owner == Harkonnen then
ChangeOwner(SmugglerOrdos, SmugglerBoth)
-- Ensure that harvesters that was on a carryall switched sides.
Trigger.AfterDelay(DateTime.Seconds(15), function()
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
ChangeOwner(smuggler_neutral, smuggler_ordos)
if unit.Owner == SmugglerNeutral and (attacker.Owner == OrdosMain or attacker.Owner == OrdosSmall) then
ChangeOwner(SmugglerNeutral, SmugglerOrdos)
-- Ensure that harvesters that was on a carryall switched sides.
Trigger.AfterDelay(DateTime.Seconds(15), function()
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
ChangeOwner(smuggler_harkonnen, smuggler_both)
if unit.Owner == SmugglerHarkonnen and (attacker.Owner == OrdosMain or attacker.Owner == OrdosSmall) then
ChangeOwner(SmugglerHarkonnen, SmugglerBoth)
-- Ensure that harvesters that was on a carryall switched sides.
Trigger.AfterDelay(DateTime.Seconds(15), function()
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)
end
end)
@@ -198,61 +198,61 @@ CheckSmugglerEnemies = function()
end
Tick = function()
if player.HasNoRequiredUnits() then
ordos_main.MarkCompletedObjective(KillHarkonnen1)
ordos_small.MarkCompletedObjective(KillHarkonnen2)
if Harkonnen.HasNoRequiredUnits() then
OrdosMain.MarkCompletedObjective(KillHarkonnen1)
OrdosSmall.MarkCompletedObjective(KillHarkonnen2)
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)
OrdosKilled = true
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)
SmugglersKilled = true
end
if (OStarport.IsDead or OStarport.Owner == player) and not player.IsObjectiveCompleted(DestroyStarport) then
player.MarkCompletedObjective(DestroyStarport)
if (OStarport.IsDead or OStarport.Owner == Harkonnen) and not Harkonnen.IsObjectiveCompleted(DestroyStarport) then
Harkonnen.MarkCompletedObjective(DestroyStarport)
end
if DateTime.GameTime % DateTime.Seconds(10) == 0 and LastHarvesterEaten[ordos_main] then
local units = ordos_main.GetActorsByType("harvester")
if DateTime.GameTime % DateTime.Seconds(10) == 0 and LastHarvesterEaten[OrdosMain] then
local units = OrdosMain.GetActorsByType("harvester")
if #units > 0 then
LastHarvesterEaten[ordos_main] = false
ProtectHarvester(units[1], ordos_main, AttackGroupSize[Difficulty])
LastHarvesterEaten[OrdosMain] = false
ProtectHarvester(units[1], OrdosMain, AttackGroupSize[Difficulty])
end
end
if DateTime.GameTime % DateTime.Seconds(10) == 0 and LastHarvesterEaten[ordos_small] then
local units = ordos_small.GetActorsByType("harvester")
if DateTime.GameTime % DateTime.Seconds(10) == 0 and LastHarvesterEaten[OrdosSmall] then
local units = OrdosSmall.GetActorsByType("harvester")
if #units > 0 then
LastHarvesterEaten[ordos_small] = false
ProtectHarvester(units[1], ordos_small, AttackGroupSize[Difficulty])
LastHarvesterEaten[OrdosSmall] = false
ProtectHarvester(units[1], OrdosSmall, AttackGroupSize[Difficulty])
end
end
end
WorldLoaded = function()
ordos_main = Player.GetPlayer("Ordos Main Base")
ordos_small = Player.GetPlayer("Ordos Small Base")
smuggler_neutral = Player.GetPlayer("Smugglers - Neutral")
smuggler_harkonnen = Player.GetPlayer("Smugglers - Enemy to Harkonnen")
smuggler_ordos = Player.GetPlayer("Smugglers - Enemy to Ordos")
smuggler_both = Player.GetPlayer("Smugglers - Enemy to Both")
player = Player.GetPlayer("Harkonnen")
OrdosMain = Player.GetPlayer("Ordos Main Base")
OrdosSmall = Player.GetPlayer("Ordos Small Base")
SmugglerNeutral = Player.GetPlayer("Smugglers - Neutral")
SmugglerHarkonnen = Player.GetPlayer("Smugglers - Enemy to Harkonnen")
SmugglerOrdos = Player.GetPlayer("Smugglers - Enemy to Ordos")
SmugglerBoth = Player.GetPlayer("Smugglers - Enemy to Both")
Harkonnen = Player.GetPlayer("Harkonnen")
InitObjectives(player)
DestroyStarport = AddPrimaryObjective(player, "capture-destroy-ordos-starport")
KillHarkonnen1 = AddPrimaryObjective(ordos_main, "")
KillHarkonnen2 = AddPrimaryObjective(ordos_small, "")
InitObjectives(Harkonnen)
DestroyStarport = AddPrimaryObjective(Harkonnen, "capture-destroy-ordos-starport")
KillHarkonnen1 = AddPrimaryObjective(OrdosMain, "")
KillHarkonnen2 = AddPrimaryObjective(OrdosSmall, "")
-- Wait for carryall drop
Trigger.AfterDelay(DateTime.Seconds(10), function()
SmugglerUnits = smuggler_neutral.GetActors()
SmugglerUnits = SmugglerNeutral.GetActors()
CheckSmugglerEnemies()
end)
@@ -260,11 +260,11 @@ WorldLoaded = function()
OrdosAttackLocation = HMCV.Location
Trigger.OnAllKilledOrCaptured(OrdosMainBase, function()
Utils.Do(ordos_main.GetGroundAttackers(), IdleHunt)
Utils.Do(OrdosMain.GetGroundAttackers(), IdleHunt)
end)
Trigger.OnAllKilledOrCaptured(OrdosSmallBase, function()
Utils.Do(ordos_small.GetGroundAttackers(), IdleHunt)
Utils.Do(OrdosSmall.GetGroundAttackers(), IdleHunt)
end)
local path = function() return Utils.Random(OrdosPaths) end
@@ -273,15 +273,15 @@ WorldLoaded = function()
unit.AttackMove(OrdosAttackLocation)
IdleHunt(unit)
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()
Actor.Create("upgrade.barracks", true, { Owner = ordos_main })
Actor.Create("upgrade.light", true, { Owner = ordos_main })
Actor.Create("upgrade.heavy", true, { Owner = ordos_main })
Actor.Create("upgrade.barracks", true, { Owner = ordos_small })
Actor.Create("upgrade.light", true, { Owner = ordos_small })
Actor.Create("upgrade.barracks", true, { Owner = OrdosMain })
Actor.Create("upgrade.light", true, { Owner = OrdosMain })
Actor.Create("upgrade.heavy", true, { Owner = OrdosMain })
Actor.Create("upgrade.barracks", true, { Owner = OrdosSmall })
Actor.Create("upgrade.light", true, { Owner = OrdosSmall })
Trigger.AfterDelay(0, ActivateAI)
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" }
ActivateAI = function()
IdlingUnits[ordos_main] = Reinforcements.Reinforce(ordos_main, InitialOrdosReinforcements[1], InitialOrdosPaths[1]), Reinforcements.Reinforce(ordos_main, InitialOrdosReinforcements[2], InitialOrdosPaths[2])
IdlingUnits[ordos_small] = Reinforcements.Reinforce(ordos_small, InitialOrdosReinforcements[1], InitialOrdosPaths[3])
IdlingUnits[OrdosMain] = Reinforcements.Reinforce(OrdosMain, InitialOrdosReinforcements[1], InitialOrdosPaths[1]), Reinforcements.Reinforce(OrdosMain, InitialOrdosReinforcements[2], InitialOrdosPaths[2])
IdlingUnits[OrdosSmall] = Reinforcements.Reinforce(OrdosSmall, InitialOrdosReinforcements[1], InitialOrdosPaths[3])
DefendAndRepairBase(ordos_main, OrdosMainBase, 0.75, AttackGroupSize[Difficulty])
DefendAndRepairBase(ordos_small, OrdosSmallBase, 0.75, AttackGroupSize[Difficulty])
DefendAndRepairBase(OrdosMain, OrdosMainBase, 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 infantryToBuild = function() return { Utils.Random(OrdosInfantryTypes) } end
@@ -40,11 +40,11 @@ ActivateAI = function()
local unitsToBuy = function() return { Utils.Random(OrdosStarportTypes) } end
local attackThresholdSize = AttackGroupSize[Difficulty] * 2.5
ProduceUnits(ordos_main, OBarracks1, delay, infantryToBuild, AttackGroupSize[Difficulty], attackThresholdSize)
ProduceUnits(ordos_main, OLightFactory1, delay, vehilcesToBuild, AttackGroupSize[Difficulty], attackThresholdSize)
ProduceUnits(ordos_main, OHeavyFactory, delay, tanksToBuild, AttackGroupSize[Difficulty], attackThresholdSize)
ProduceUnits(ordos_main, OStarport, delay, unitsToBuy, AttackGroupSize[Difficulty], attackThresholdSize)
ProduceUnits(OrdosMain, OBarracks1, delay, infantryToBuild, AttackGroupSize[Difficulty], attackThresholdSize)
ProduceUnits(OrdosMain, OLightFactory1, delay, vehilcesToBuild, AttackGroupSize[Difficulty], attackThresholdSize)
ProduceUnits(OrdosMain, OHeavyFactory, delay, tanksToBuild, AttackGroupSize[Difficulty], attackThresholdSize)
ProduceUnits(OrdosMain, OStarport, delay, unitsToBuy, AttackGroupSize[Difficulty], attackThresholdSize)
ProduceUnits(ordos_small, OBarracks2, delay, infantryToBuild, AttackGroupSize[Difficulty], attackThresholdSize)
ProduceUnits(ordos_small, OLightFactory2, delay, vehilcesToBuild, AttackGroupSize[Difficulty], attackThresholdSize)
ProduceUnits(OrdosSmall, OBarracks2, delay, infantryToBuild, AttackGroupSize[Difficulty], attackThresholdSize)
ProduceUnits(OrdosSmall, OLightFactory2, delay, vehilcesToBuild, AttackGroupSize[Difficulty], attackThresholdSize)
end

View File

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

View File

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

View File

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

View File

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

View File

@@ -105,7 +105,7 @@ SendStarportReinforcements = function(faction)
return
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]
Utils.Do(units, function(unit)
@@ -118,11 +118,11 @@ SendStarportReinforcements = function(faction)
end
SendAirStrike = function()
if AHiTechFactory.IsDead or AHiTechFactory.Owner ~= atreides_enemy then
if AHiTechFactory.IsDead or AHiTechFactory.Owner ~= AtreidesEnemy then
return
end
local targets = Utils.Where(player.GetActors(), function(actor)
local targets = Utils.Where(Harkonnen.GetActors(), function(actor)
return
actor.HasProperty("Sell") and
actor.Type ~= "wall" and
@@ -151,13 +151,13 @@ GetSaboteurTargets = function(player)
end
BuildSaboteur = function()
if OPalace.IsDead or OPalace.Owner ~= ordos then
if OPalace.IsDead or OPalace.Owner ~= Ordos then
return
end
local targets = GetSaboteurTargets(player)
local targets = GetSaboteurTargets(Harkonnen)
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.Wait(DateTime.Seconds(5))
@@ -173,7 +173,7 @@ BuildSaboteur = function()
end
SendSaboteur = function(saboteur)
local targets = GetSaboteurTargets(player)
local targets = GetSaboteurTargets(Harkonnen)
if #targets < 1 then
return
end
@@ -188,19 +188,19 @@ SendSaboteur = function(saboteur)
end
CheckAttackToAtreides = function()
AtreidesUnits = atreides_neutral.GetActors()
AtreidesUnits = AtreidesNeutral.GetActors()
Utils.Do(AtreidesUnits, function(unit)
Trigger.OnDamaged(unit, function(self, attacker)
if attacker.Owner == player and not check then
ChangeOwner(atreides_neutral, atreides_enemy)
if attacker.Owner == Harkonnen and not Check then
ChangeOwner(AtreidesNeutral, AtreidesEnemy)
-- Ensure that harvesters that was on a carryall switched sides.
Trigger.AfterDelay(DateTime.Seconds(15), function()
ChangeOwner(atreides_neutral, atreides_enemy)
ChangeOwner(AtreidesNeutral, AtreidesEnemy)
end)
check = true
Check = true
Media.DisplayMessage(UserInterface.Translate("atreides-hostile"), Mentat)
end
end)
@@ -217,59 +217,59 @@ ChangeOwner = function(old_owner, new_owner)
end
Tick = function()
if player.HasNoRequiredUnits() then
ordos.MarkCompletedObjective(KillHarkonnen1)
atreides_enemy.MarkCompletedObjective(KillHarkonnen2)
if Harkonnen.HasNoRequiredUnits() then
Ordos.MarkCompletedObjective(KillHarkonnen1)
AtreidesEnemy.MarkCompletedObjective(KillHarkonnen2)
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)
player.MarkCompletedObjective(KillOrdos)
Harkonnen.MarkCompletedObjective(KillOrdos)
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)
player.MarkCompletedObjective(KillAtreides)
Harkonnen.MarkCompletedObjective(KillAtreides)
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)
MercenariesDestroyed = true
end
if DateTime.GameTime % DateTime.Seconds(10) == 0 and LastHarvesterEaten[ordos] then
local units = ordos.GetActorsByType("harvester")
if DateTime.GameTime % DateTime.Seconds(10) == 0 and LastHarvesterEaten[Ordos] then
local units = Ordos.GetActorsByType("harvester")
if #units > 0 then
LastHarvesterEaten[ordos] = false
ProtectHarvester(units[1], ordos, AttackGroupSize[Difficulty])
LastHarvesterEaten[Ordos] = false
ProtectHarvester(units[1], Ordos, AttackGroupSize[Difficulty])
end
end
if DateTime.GameTime % DateTime.Seconds(10) == 0 and LastHarvesterEaten[atreides_enemy] then
local units = atreides_enemy.GetActorsByType("harvester")
if DateTime.GameTime % DateTime.Seconds(10) == 0 and LastHarvesterEaten[AtreidesEnemy] then
local units = AtreidesEnemy.GetActorsByType("harvester")
if #units > 0 then
LastHarvesterEaten[atreides_enemy] = false
ProtectHarvester(units[1], atreides_enemy, AttackGroupSize[Difficulty])
LastHarvesterEaten[AtreidesEnemy] = false
ProtectHarvester(units[1], AtreidesEnemy, AttackGroupSize[Difficulty])
end
end
end
WorldLoaded = function()
ordos = Player.GetPlayer("Ordos")
atreides_enemy = Player.GetPlayer("Ordos Aligned Atreides")
atreides_neutral = Player.GetPlayer("Neutral Atreides")
mercenary_enemy = Player.GetPlayer("Ordos Aligned Mercenaries")
mercenary_ally = Player.GetPlayer("Harkonnen Aligned Mercenaries")
player = Player.GetPlayer("Harkonnen")
Ordos = Player.GetPlayer("Ordos")
AtreidesEnemy = Player.GetPlayer("Ordos Aligned Atreides")
AtreidesNeutral = Player.GetPlayer("Neutral Atreides")
MercenaryEnemy = Player.GetPlayer("Ordos Aligned Mercenaries")
MercenaryAlly = Player.GetPlayer("Harkonnen Aligned Mercenaries")
Harkonnen = Player.GetPlayer("Harkonnen")
InitObjectives(player)
KillOrdos = AddPrimaryObjective(player, "destroy-ordos")
KillAtreides = AddSecondaryObjective(player, "destroy-atreides")
AllyWithMercenaries = AddSecondaryObjective(player, "ally-mercenaries")
KillHarkonnen1 = AddPrimaryObjective(ordos, "")
KillHarkonnen2 = AddPrimaryObjective(atreides_enemy, "")
InitObjectives(Harkonnen)
KillOrdos = AddPrimaryObjective(Harkonnen, "destroy-ordos")
KillAtreides = AddSecondaryObjective(Harkonnen, "destroy-atreides")
AllyWithMercenaries = AddSecondaryObjective(Harkonnen, "ally-mercenaries")
KillHarkonnen1 = AddPrimaryObjective(Ordos, "")
KillHarkonnen2 = AddPrimaryObjective(AtreidesEnemy, "")
Camera.Position = HMCV.CenterPosition
OrdosAttackLocation = HMCV.Location
@@ -279,66 +279,66 @@ WorldLoaded = function()
Trigger.AfterDelay(DateTime.Minutes(1) + DateTime.Seconds(30), BuildSaboteur)
Trigger.OnCapture(MHeavyFactory, function()
player.MarkCompletedObjective(AllyWithMercenaries)
Harkonnen.MarkCompletedObjective(AllyWithMercenaries)
Media.DisplayMessage(UserInterface.Translate("mercenary-leader-captured-allied"), Mentat)
MercenaryAttackLocation = MercenaryAttackPoint.Location
ChangeOwner(mercenary_enemy, mercenary_ally)
SendStarportReinforcements(mercenary_ally)
DefendAndRepairBase(mercenary_ally, MercenaryBase, 0.75, AttackGroupSize[Difficulty])
IdlingUnits[mercenary_ally] = IdlingUnits[mercenary_enemy]
ChangeOwner(MercenaryEnemy, MercenaryAlly)
SendStarportReinforcements(MercenaryAlly)
DefendAndRepairBase(MercenaryAlly, MercenaryBase, 0.75, AttackGroupSize[Difficulty])
IdlingUnits[MercenaryAlly] = IdlingUnits[MercenaryEnemy]
end)
Trigger.OnKilled(MHeavyFactory, function()
if not player.IsObjectiveCompleted(AllyWithMercenaries) then
player.MarkFailedObjective(AllyWithMercenaries)
if not Harkonnen.IsObjectiveCompleted(AllyWithMercenaries) then
Harkonnen.MarkFailedObjective(AllyWithMercenaries)
end
end)
Trigger.OnKilledOrCaptured(OPalace, function()
Media.DisplayMessage(UserInterface.Translate("can-not-stand-harkonnen-must-become-neutral"), UserInterface.Translate("atreides-commander"))
ChangeOwner(atreides_enemy, atreides_neutral)
DefendAndRepairBase(atreides_neutral, AtreidesBase, 0.75, AttackGroupSize[Difficulty])
IdlingUnits[atreides_neutral] = IdlingUnits[atreides_enemy]
ChangeOwner(AtreidesEnemy, AtreidesNeutral)
DefendAndRepairBase(AtreidesNeutral, AtreidesBase, 0.75, AttackGroupSize[Difficulty])
IdlingUnits[AtreidesNeutral] = IdlingUnits[AtreidesEnemy]
-- Ensure that harvesters that was on a carryall switched sides.
Trigger.AfterDelay(DateTime.Seconds(15), function()
ChangeOwner(atreides_enemy, atreides_neutral)
ChangeOwner(AtreidesEnemy, AtreidesNeutral)
CheckAttackToAtreides()
end)
end)
Trigger.OnAllKilledOrCaptured(OrdosBase, function()
Utils.Do(ordos.GetGroundAttackers(), IdleHunt)
Utils.Do(Ordos.GetGroundAttackers(), IdleHunt)
end)
Trigger.OnAllKilledOrCaptured(AtreidesBase, function()
Utils.Do(atreides_enemy.GetGroundAttackers(), IdleHunt)
Utils.Do(AtreidesEnemy.GetGroundAttackers(), IdleHunt)
end)
Trigger.OnAllKilledOrCaptured(MercenaryBase, function()
Utils.Do(mercenary_enemy.GetGroundAttackers(), IdleHunt)
Utils.Do(mercenary_ally.GetGroundAttackers(), IdleHunt)
Utils.Do(MercenaryEnemy.GetGroundAttackers(), IdleHunt)
Utils.Do(MercenaryAlly.GetGroundAttackers(), IdleHunt)
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)
unit.AttackMove(OrdosAttackLocation)
IdleHunt(unit)
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.light", true, { Owner = ordos })
Actor.Create("upgrade.heavy", true, { Owner = ordos })
Actor.Create("upgrade.barracks", true, { Owner = atreides_enemy })
Actor.Create("upgrade.light", true, { Owner = atreides_enemy })
Actor.Create("upgrade.heavy", true, { Owner = atreides_enemy })
Actor.Create("upgrade.hightech", true, { Owner = atreides_enemy })
Actor.Create("upgrade.heavy", true, { Owner = mercenary_enemy })
Actor.Create("upgrade.barracks", true, { Owner = Ordos })
Actor.Create("upgrade.light", true, { Owner = Ordos })
Actor.Create("upgrade.heavy", true, { Owner = Ordos })
Actor.Create("upgrade.barracks", true, { Owner = AtreidesEnemy })
Actor.Create("upgrade.light", true, { Owner = AtreidesEnemy })
Actor.Create("upgrade.heavy", true, { Owner = AtreidesEnemy })
Actor.Create("upgrade.hightech", true, { Owner = AtreidesEnemy })
Actor.Create("upgrade.heavy", true, { Owner = MercenaryEnemy })
Trigger.AfterDelay(0, ActivateAI)
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" }
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[atreides_small_1] = Reinforcements.Reinforce(atreides_small_1, InitialAtreidesReinforcements[4], InitialAtreidesPaths[4]), Reinforcements.Reinforce(atreides_small_1, InitialAtreidesReinforcements[5], InitialAtreidesPaths[5])
IdlingUnits[atreides_small_2] = Reinforcements.Reinforce(atreides_small_2, InitialAtreidesReinforcements[6], InitialAtreidesPaths[6])
IdlingUnits[corrino_main] = Reinforcements.Reinforce(corrino_main, InitialCorrinoReinforcements, InitialCorrinoPaths[1])
IdlingUnits[corrino_small] = Reinforcements.Reinforce(corrino_main, InitialCorrinoReinforcements, InitialCorrinoPaths[2])
IdlingUnits[AtreidesMain] = Reinforcements.Reinforce(AtreidesMain, InitialAtreidesReinforcements[1], InitialAtreidesPaths[1]), Reinforcements.Reinforce(AtreidesMain, InitialAtreidesReinforcements[2], InitialAtreidesPaths[2]), Reinforcements.Reinforce(AtreidesMain, InitialAtreidesReinforcements[3], InitialAtreidesPaths[3])
IdlingUnits[AtreidesSmall1] = Reinforcements.Reinforce(AtreidesSmall1, InitialAtreidesReinforcements[4], InitialAtreidesPaths[4]), Reinforcements.Reinforce(AtreidesSmall1, InitialAtreidesReinforcements[5], InitialAtreidesPaths[5])
IdlingUnits[AtreidesSmall2] = Reinforcements.Reinforce(AtreidesSmall2, InitialAtreidesReinforcements[6], InitialAtreidesPaths[6])
IdlingUnits[CorrinoMain] = Reinforcements.Reinforce(CorrinoMain, InitialCorrinoReinforcements, InitialCorrinoPaths[1])
IdlingUnits[CorrinoSmall] = Reinforcements.Reinforce(CorrinoMain, InitialCorrinoReinforcements, InitialCorrinoPaths[2])
DefendAndRepairBase(atreides_main, AtreidesMainBase, 0.75, AttackGroupSize[Difficulty])
DefendAndRepairBase(atreides_small_1, AtreidesSmall1Base, 0.75, AttackGroupSize[Difficulty])
DefendAndRepairBase(atreides_small_2, AtreidesSmall2Base, 0.75, AttackGroupSize[Difficulty])
DefendAndRepairBase(corrino_main, CorrinoMainBase, 0.75, AttackGroupSize[Difficulty])
DefendAndRepairBase(corrino_small, CorrinoSmallBase, 0.75, AttackGroupSize[Difficulty])
DefendAndRepairBase(AtreidesMain, AtreidesMainBase, 0.75, AttackGroupSize[Difficulty])
DefendAndRepairBase(AtreidesSmall1, AtreidesSmall1Base, 0.75, AttackGroupSize[Difficulty])
DefendAndRepairBase(AtreidesSmall2, AtreidesSmall2Base, 0.75, AttackGroupSize[Difficulty])
DefendAndRepairBase(CorrinoMain, CorrinoMainBase, 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 infantryToBuild = function() return { Utils.Random(EnemyInfantryTypes) } end
@@ -58,23 +58,23 @@ ActivateAI = function()
local unitsToBuyCorrino = function() return { Utils.Random(CorrinoStarportTypes) } end
local attackThresholdSize = AttackGroupSize[Difficulty] * 2.5
ProduceUnits(atreides_main, ABarracks1, delay, infantryToBuild, AttackGroupSize[Difficulty], attackThresholdSize)
ProduceUnits(atreides_main, ALightFactory1, delay, vehilcesToBuild, AttackGroupSize[Difficulty], attackThresholdSize)
ProduceUnits(atreides_main, AHeavyFactory1, delay, tanksToBuildAtreidesMain, AttackGroupSize[Difficulty], attackThresholdSize)
ProduceUnits(atreides_main, AStarport, delay, unitsToBuyAtreides, AttackGroupSize[Difficulty], attackThresholdSize)
ProduceUnits(AtreidesMain, ABarracks1, delay, infantryToBuild, AttackGroupSize[Difficulty], attackThresholdSize)
ProduceUnits(AtreidesMain, ALightFactory1, delay, vehilcesToBuild, AttackGroupSize[Difficulty], attackThresholdSize)
ProduceUnits(AtreidesMain, AHeavyFactory1, delay, tanksToBuildAtreidesMain, AttackGroupSize[Difficulty], attackThresholdSize)
ProduceUnits(AtreidesMain, AStarport, delay, unitsToBuyAtreides, AttackGroupSize[Difficulty], attackThresholdSize)
ProduceUnits(atreides_small_1, ABarracks3, delay, infantryToBuild, AttackGroupSize[Difficulty], attackThresholdSize)
ProduceUnits(atreides_small_1, ALightFactory2, delay, vehilcesToBuild, AttackGroupSize[Difficulty], attackThresholdSize)
ProduceUnits(atreides_small_1, AHeavyFactory2, delay, tanksToBuildAtreidesSmall, AttackGroupSize[Difficulty], attackThresholdSize)
ProduceUnits(AtreidesSmall1, ABarracks3, delay, infantryToBuild, AttackGroupSize[Difficulty], attackThresholdSize)
ProduceUnits(AtreidesSmall1, ALightFactory2, delay, vehilcesToBuild, 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(corrino_main, CLightFactory1, delay, vehilcesToBuild, AttackGroupSize[Difficulty], attackThresholdSize)
ProduceUnits(corrino_main, CHeavyFactory1, delay, tanksToBuildCorrinoMain, AttackGroupSize[Difficulty], attackThresholdSize)
ProduceUnits(corrino_main, CStarport, delay, unitsToBuyCorrino, AttackGroupSize[Difficulty], attackThresholdSize)
ProduceUnits(CorrinoMain, CBarracks1, delay, infantryToBuildCorrinoMain, AttackGroupSize[Difficulty], attackThresholdSize)
ProduceUnits(CorrinoMain, CLightFactory1, delay, vehilcesToBuild, AttackGroupSize[Difficulty], attackThresholdSize)
ProduceUnits(CorrinoMain, CHeavyFactory1, delay, tanksToBuildCorrinoMain, AttackGroupSize[Difficulty], attackThresholdSize)
ProduceUnits(CorrinoMain, CStarport, delay, unitsToBuyCorrino, AttackGroupSize[Difficulty], attackThresholdSize)
ProduceUnits(corrino_small, CBarracks2, delay, infantryToBuild, AttackGroupSize[Difficulty], attackThresholdSize)
ProduceUnits(corrino_small, CLightFactory2, delay, vehilcesToBuild, AttackGroupSize[Difficulty], attackThresholdSize)
ProduceUnits(corrino_small, CHeavyFactory2, delay, tanksToBuildCorrinoSmall, AttackGroupSize[Difficulty], attackThresholdSize)
ProduceUnits(CorrinoSmall, CBarracks2, delay, infantryToBuild, AttackGroupSize[Difficulty], attackThresholdSize)
ProduceUnits(CorrinoSmall, CLightFactory2, delay, vehilcesToBuild, AttackGroupSize[Difficulty], attackThresholdSize)
ProduceUnits(CorrinoSmall, CHeavyFactory2, delay, tanksToBuildCorrinoSmall, AttackGroupSize[Difficulty], attackThresholdSize)
end

View File

@@ -137,13 +137,13 @@ HarkonnenPath = { HarkonnenEntry.Location, HarkonnenRally.Location }
SendStarportReinforcements = function()
Trigger.AfterDelay(CorrinoStarportDelay[Difficulty], function()
if CStarport.IsDead or CStarport.Owner ~= corrino_main then
if CStarport.IsDead or CStarport.Owner ~= CorrinoMain then
return
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)
unit.AttackMove(AtreidesAttackLocation)
IdleHunt(unit)
@@ -155,19 +155,19 @@ end
SendHarkonnenReinforcements = function(delay)
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()
Media.PlaySpeechNotification(player, "Reinforce")
Media.PlaySpeechNotification(Harkonnen, "Reinforce")
end)
end)
end
SendAirStrike = function()
if AHiTechFactory.IsDead or AHiTechFactory.Owner ~= atreides_main then
if AHiTechFactory.IsDead or AHiTechFactory.Owner ~= AtreidesMain then
return
end
local targets = Utils.Where(player.GetActors(), function(actor)
local targets = Utils.Where(Harkonnen.GetActors(), function(actor)
return
actor.HasProperty("Sell") and
actor.Type ~= "wall" and
@@ -185,7 +185,7 @@ SendAirStrike = function()
end
BuildFremen = function()
if APalace.IsDead or APalace.Owner ~= atreides_main then
if APalace.IsDead or APalace.Owner ~= AtreidesMain then
return
end
@@ -193,7 +193,7 @@ BuildFremen = function()
APalace.Produce("fremen")
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
SendFremen()
@@ -211,77 +211,77 @@ SendFremen = function()
end
Tick = function()
if player.HasNoRequiredUnits() then
atreides_main.MarkCompletedObjective(KillHarkonnen1)
atreides_small_1.MarkCompletedObjective(KillHarkonnen2)
atreides_small_2.MarkCompletedObjective(KillHarkonnen3)
corrino_main.MarkCompletedObjective(KillHarkonnen4)
corrino_small.MarkCompletedObjective(KillHarkonnen5)
if Harkonnen.HasNoRequiredUnits() then
AtreidesMain.MarkCompletedObjective(KillHarkonnen1)
AtreidesSmall1.MarkCompletedObjective(KillHarkonnen2)
AtreidesSmall2.MarkCompletedObjective(KillHarkonnen3)
CorrinoMain.MarkCompletedObjective(KillHarkonnen4)
CorrinoSmall.MarkCompletedObjective(KillHarkonnen5)
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)
player.MarkCompletedObjective(KillAtreides)
Harkonnen.MarkCompletedObjective(KillAtreides)
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)
player.MarkCompletedObjective(KillCorrino)
Harkonnen.MarkCompletedObjective(KillCorrino)
end
if DateTime.GameTime % DateTime.Seconds(10) == 0 and LastHarvesterEaten[atreides_main] then
local units = atreides_main.GetActorsByType("harvester")
if DateTime.GameTime % DateTime.Seconds(10) == 0 and LastHarvesterEaten[AtreidesMain] then
local units = AtreidesMain.GetActorsByType("harvester")
if #units > 0 then
LastHarvesterEaten[atreides_main] = false
ProtectHarvester(units[1], atreides_main, AttackGroupSize[Difficulty])
LastHarvesterEaten[AtreidesMain] = false
ProtectHarvester(units[1], AtreidesMain, AttackGroupSize[Difficulty])
end
end
if DateTime.GameTime % DateTime.Seconds(10) == 0 and LastHarvesterEaten[atreides_small_1] then
local units = atreides_small_1.GetActorsByType("harvester")
if DateTime.GameTime % DateTime.Seconds(10) == 0 and LastHarvesterEaten[AtreidesSmall1] then
local units = AtreidesSmall1.GetActorsByType("harvester")
if #units > 0 then
LastHarvesterEaten[atreides_small_1] = false
ProtectHarvester(units[1], atreides_small_1, AttackGroupSize[Difficulty])
LastHarvesterEaten[AtreidesSmall1] = false
ProtectHarvester(units[1], AtreidesSmall1, AttackGroupSize[Difficulty])
end
end
if DateTime.GameTime % DateTime.Seconds(10) == 0 and LastHarvesterEaten[corrino_main] then
local units = corrino_main.GetActorsByType("harvester")
if DateTime.GameTime % DateTime.Seconds(10) == 0 and LastHarvesterEaten[CorrinoMain] then
local units = CorrinoMain.GetActorsByType("harvester")
if #units > 0 then
LastHarvesterEaten[corrino_main] = false
ProtectHarvester(units[1], corrino_main, AttackGroupSize[Difficulty])
LastHarvesterEaten[CorrinoMain] = false
ProtectHarvester(units[1], CorrinoMain, AttackGroupSize[Difficulty])
end
end
if DateTime.GameTime % DateTime.Seconds(10) == 0 and LastHarvesterEaten[corrino_small] then
local units = corrino_small.GetActorsByType("harvester")
if DateTime.GameTime % DateTime.Seconds(10) == 0 and LastHarvesterEaten[CorrinoSmall] then
local units = CorrinoSmall.GetActorsByType("harvester")
if #units > 0 then
LastHarvesterEaten[corrino_small] = false
ProtectHarvester(units[1], corrino_small, AttackGroupSize[Difficulty])
LastHarvesterEaten[CorrinoSmall] = false
ProtectHarvester(units[1], CorrinoSmall, AttackGroupSize[Difficulty])
end
end
end
WorldLoaded = function()
atreides_main = Player.GetPlayer("Atreides Main Base")
atreides_small_1 = Player.GetPlayer("Atreides Small Base 1")
atreides_small_2 = Player.GetPlayer("Atreides Small Base 2")
corrino_main = Player.GetPlayer("Corrino Main Base")
corrino_small = Player.GetPlayer("Corrino Small Base")
player = Player.GetPlayer("Harkonnen")
AtreidesMain = Player.GetPlayer("Atreides Main Base")
AtreidesSmall1 = Player.GetPlayer("Atreides Small Base 1")
AtreidesSmall2 = Player.GetPlayer("Atreides Small Base 2")
CorrinoMain = Player.GetPlayer("Corrino Main Base")
CorrinoSmall = Player.GetPlayer("Corrino Small Base")
Harkonnen = Player.GetPlayer("Harkonnen")
InitObjectives(player)
KillAtreides = AddPrimaryObjective(player, "destroy-atreides")
KillCorrino = AddPrimaryObjective(player, "destroy-imperial-forces")
KillHarkonnen1 = AddPrimaryObjective(atreides_main, "")
KillHarkonnen2 = AddPrimaryObjective(atreides_small_1, "")
KillHarkonnen3 = AddPrimaryObjective(atreides_small_2, "")
KillHarkonnen4 = AddPrimaryObjective(corrino_main, "")
KillHarkonnen5 = AddPrimaryObjective(corrino_small, "")
InitObjectives(Harkonnen)
KillAtreides = AddPrimaryObjective(Harkonnen, "destroy-atreides")
KillCorrino = AddPrimaryObjective(Harkonnen, "destroy-imperial-forces")
KillHarkonnen1 = AddPrimaryObjective(AtreidesMain, "")
KillHarkonnen2 = AddPrimaryObjective(AtreidesSmall1, "")
KillHarkonnen3 = AddPrimaryObjective(AtreidesSmall2, "")
KillHarkonnen4 = AddPrimaryObjective(CorrinoMain, "")
KillHarkonnen5 = AddPrimaryObjective(CorrinoSmall, "")
Camera.Position = HMCV.CenterPosition
AtreidesAttackLocation = HarkonnenRally.Location
@@ -290,49 +290,49 @@ WorldLoaded = function()
Trigger.AfterDelay(DateTime.Minutes(1) + DateTime.Seconds (30), BuildFremen)
Trigger.OnAllKilledOrCaptured(AtreidesMainBase, function()
Utils.Do(atreides_main.GetGroundAttackers(), IdleHunt)
Utils.Do(AtreidesMain.GetGroundAttackers(), IdleHunt)
end)
Trigger.OnAllKilledOrCaptured(AtreidesSmall1Base, function()
Utils.Do(atreides_small_1.GetGroundAttackers(), IdleHunt)
Utils.Do(AtreidesSmall1.GetGroundAttackers(), IdleHunt)
end)
Trigger.OnAllKilledOrCaptured(AtreidesSmall2Base, function()
Utils.Do(atreides_small_2.GetGroundAttackers(), IdleHunt)
Utils.Do(AtreidesSmall2.GetGroundAttackers(), IdleHunt)
end)
Trigger.OnAllKilledOrCaptured(CorrinoMainBase, function()
Utils.Do(corrino_main.GetGroundAttackers(), IdleHunt)
Utils.Do(CorrinoMain.GetGroundAttackers(), IdleHunt)
end)
Trigger.OnAllKilledOrCaptured(CorrinoSmallBase, function()
Utils.Do(corrino_small.GetGroundAttackers(), IdleHunt)
Utils.Do(CorrinoSmall.GetGroundAttackers(), IdleHunt)
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)
unit.AttackMove(AtreidesAttackLocation)
IdleHunt(unit)
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()
Actor.Create("upgrade.barracks", true, { Owner = atreides_main })
Actor.Create("upgrade.light", true, { Owner = atreides_main })
Actor.Create("upgrade.heavy", true, { Owner = atreides_main })
Actor.Create("upgrade.hightech", true, { Owner = atreides_main })
Actor.Create("upgrade.barracks", true, { Owner = atreides_small_1 })
Actor.Create("upgrade.light", true, { Owner = atreides_small_1 })
Actor.Create("upgrade.heavy", true, { Owner = atreides_small_1 })
Actor.Create("upgrade.barracks", true, { Owner = atreides_small_2 })
Actor.Create("upgrade.barracks", true, { Owner = corrino_main })
Actor.Create("upgrade.light", true, { Owner = corrino_main })
Actor.Create("upgrade.heavy", true, { Owner = corrino_main })
Actor.Create("upgrade.barracks", true, { Owner = corrino_small })
Actor.Create("upgrade.light", true, { Owner = corrino_small })
Actor.Create("upgrade.heavy", true, { Owner = corrino_small })
Actor.Create("upgrade.barracks", true, { Owner = AtreidesMain })
Actor.Create("upgrade.light", true, { Owner = AtreidesMain })
Actor.Create("upgrade.heavy", true, { Owner = AtreidesMain })
Actor.Create("upgrade.hightech", true, { Owner = AtreidesMain })
Actor.Create("upgrade.barracks", true, { Owner = AtreidesSmall1 })
Actor.Create("upgrade.light", true, { Owner = AtreidesSmall1 })
Actor.Create("upgrade.heavy", true, { Owner = AtreidesSmall1 })
Actor.Create("upgrade.barracks", true, { Owner = AtreidesSmall2 })
Actor.Create("upgrade.barracks", true, { Owner = CorrinoMain })
Actor.Create("upgrade.light", true, { Owner = CorrinoMain })
Actor.Create("upgrade.heavy", true, { Owner = CorrinoMain })
Actor.Create("upgrade.barracks", true, { Owner = CorrinoSmall })
Actor.Create("upgrade.light", true, { Owner = CorrinoSmall })
Actor.Create("upgrade.heavy", true, { Owner = CorrinoSmall })
Trigger.AfterDelay(0, ActivateAI)
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" }
ActivateAI = function()
IdlingUnits[atreides_main] = Reinforcements.Reinforce(atreides_main, InitialAtreidesReinforcements[1], InitialAtreidesPaths[1]), Reinforcements.Reinforce(atreides_main, InitialAtreidesReinforcements[2], InitialAtreidesPaths[2])
IdlingUnits[atreides_small] = Reinforcements.Reinforce(atreides_small, InitialAtreidesReinforcements[3], InitialAtreidesPaths[3])
IdlingUnits[corrino_main] = Reinforcements.Reinforce(corrino_main, InitialCorrinoReinforcements[1], InitialCorrinoPaths[1]), Reinforcements.Reinforce(corrino_main, InitialCorrinoReinforcements[2], InitialCorrinoPaths[2])
IdlingUnits[corrino_small] = Reinforcements.Reinforce(corrino_main, InitialCorrinoReinforcements[3], InitialCorrinoPaths[3])
IdlingUnits[AtreidesMain] = Reinforcements.Reinforce(AtreidesMain, InitialAtreidesReinforcements[1], InitialAtreidesPaths[1]), Reinforcements.Reinforce(AtreidesMain, InitialAtreidesReinforcements[2], InitialAtreidesPaths[2])
IdlingUnits[AtreidesSmall] = Reinforcements.Reinforce(AtreidesSmall, InitialAtreidesReinforcements[3], InitialAtreidesPaths[3])
IdlingUnits[CorrinoMain] = Reinforcements.Reinforce(CorrinoMain, InitialCorrinoReinforcements[1], InitialCorrinoPaths[1]), Reinforcements.Reinforce(CorrinoMain, InitialCorrinoReinforcements[2], InitialCorrinoPaths[2])
IdlingUnits[CorrinoSmall] = Reinforcements.Reinforce(CorrinoMain, InitialCorrinoReinforcements[3], InitialCorrinoPaths[3])
DefendAndRepairBase(atreides_main, AtreidesMainBase, 0.75, AttackGroupSize[Difficulty])
DefendAndRepairBase(atreides_small, AtreidesSmallBase, 0.75, AttackGroupSize[Difficulty])
DefendAndRepairBase(corrino_main, CorrinoMainBase, 0.75, AttackGroupSize[Difficulty])
DefendAndRepairBase(corrino_small, CorrinoSmallBase, 0.75, AttackGroupSize[Difficulty])
DefendAndRepairBase(AtreidesMain, AtreidesMainBase, 0.75, AttackGroupSize[Difficulty])
DefendAndRepairBase(AtreidesSmall, AtreidesSmallBase, 0.75, AttackGroupSize[Difficulty])
DefendAndRepairBase(CorrinoMain, CorrinoMainBase, 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 infantryToBuild = function() return { Utils.Random(EnemyInfantryTypes) } end
@@ -54,20 +54,20 @@ ActivateAI = function()
local unitsToBuyCorrino = function() return { Utils.Random(CorrinoStarportTypes) } end
local attackThresholdSize = AttackGroupSize[Difficulty] * 2.5
ProduceUnits(atreides_main, ABarracks1, delay, infantryToBuild, AttackGroupSize[Difficulty], attackThresholdSize)
ProduceUnits(atreides_main, ALightFactory1, delay, vehilcesToBuild, AttackGroupSize[Difficulty], attackThresholdSize)
ProduceUnits(atreides_main, AHeavyFactory1, delay, tanksToBuildAtreidesMain, AttackGroupSize[Difficulty], attackThresholdSize)
ProduceUnits(atreides_main, AStarport1, delay, unitsToBuyAtreides, AttackGroupSize[Difficulty], attackThresholdSize)
ProduceUnits(AtreidesMain, ABarracks1, delay, infantryToBuild, AttackGroupSize[Difficulty], attackThresholdSize)
ProduceUnits(AtreidesMain, ALightFactory1, delay, vehilcesToBuild, AttackGroupSize[Difficulty], attackThresholdSize)
ProduceUnits(AtreidesMain, AHeavyFactory1, delay, tanksToBuildAtreidesMain, AttackGroupSize[Difficulty], attackThresholdSize)
ProduceUnits(AtreidesMain, AStarport1, delay, unitsToBuyAtreides, AttackGroupSize[Difficulty], attackThresholdSize)
ProduceUnits(atreides_small, ABarracks3, delay, infantryToBuild, AttackGroupSize[Difficulty], attackThresholdSize)
ProduceUnits(atreides_small, ALightFactory2, delay, vehilcesToBuild, AttackGroupSize[Difficulty], attackThresholdSize)
ProduceUnits(atreides_small, AHeavyFactory2, delay, tanksToBuildAtreidesSmall, AttackGroupSize[Difficulty], attackThresholdSize)
ProduceUnits(atreides_small, AStarport2, delay, unitsToBuyAtreides, AttackGroupSize[Difficulty], attackThresholdSize)
ProduceUnits(AtreidesSmall, ABarracks3, delay, infantryToBuild, AttackGroupSize[Difficulty], attackThresholdSize)
ProduceUnits(AtreidesSmall, ALightFactory2, delay, vehilcesToBuild, AttackGroupSize[Difficulty], attackThresholdSize)
ProduceUnits(AtreidesSmall, AHeavyFactory2, delay, tanksToBuildAtreidesSmall, AttackGroupSize[Difficulty], attackThresholdSize)
ProduceUnits(AtreidesSmall, AStarport2, delay, unitsToBuyAtreides, AttackGroupSize[Difficulty], attackThresholdSize)
ProduceUnits(corrino_main, CBarracks1, delay, infantryToBuildCorrinoMain, AttackGroupSize[Difficulty], attackThresholdSize)
ProduceUnits(corrino_main, CHeavyFactory, delay, tanksToBuildCorrino, AttackGroupSize[Difficulty], attackThresholdSize)
ProduceUnits(CorrinoMain, CBarracks1, delay, infantryToBuildCorrinoMain, AttackGroupSize[Difficulty], attackThresholdSize)
ProduceUnits(CorrinoMain, CHeavyFactory, delay, tanksToBuildCorrino, AttackGroupSize[Difficulty], attackThresholdSize)
ProduceUnits(corrino_small, CBarracks3, delay, infantryToBuild, AttackGroupSize[Difficulty], attackThresholdSize)
ProduceUnits(corrino_small, CLightFactory, delay, vehilcesToBuild, AttackGroupSize[Difficulty], attackThresholdSize)
ProduceUnits(corrino_small, CStarport, delay, unitsToBuyCorrino, AttackGroupSize[Difficulty], attackThresholdSize)
ProduceUnits(CorrinoSmall, CBarracks3, delay, infantryToBuild, AttackGroupSize[Difficulty], attackThresholdSize)
ProduceUnits(CorrinoSmall, CLightFactory, delay, vehilcesToBuild, AttackGroupSize[Difficulty], attackThresholdSize)
ProduceUnits(CorrinoSmall, CStarport, delay, unitsToBuyCorrino, AttackGroupSize[Difficulty], attackThresholdSize)
end

View File

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

View File

@@ -61,16 +61,16 @@ Messages =
CachedResources = -1
Tick = function()
if HarkonnenArrived and harkonnen.HasNoRequiredUnits() then
player.MarkCompletedObjective(KillHarkonnen)
if HarkonnenArrived and Harkonnen.HasNoRequiredUnits() then
Ordos.MarkCompletedObjective(KillHarkonnen)
end
if player.Resources > SpiceToHarvest - 1 then
player.MarkCompletedObjective(GatherSpice)
if Ordos.Resources > SpiceToHarvest - 1 then
Ordos.MarkCompletedObjective(GatherSpice)
end
-- 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
Media.DisplayMessage(Messages[2], Mentat)
else
@@ -78,40 +78,40 @@ Tick = function()
end
-- 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)
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)
end
if player.Resources ~= CachedResources then
local parameters = { ["harvested"] = player.Resources, ["goal"] = SpiceToHarvest }
if Ordos.Resources ~= CachedResources then
local parameters = { ["harvested"] = Ordos.Resources, ["goal"] = SpiceToHarvest }
local harvestedResources = UserInterface.Translate("harvested-resources", parameters)
UserInterface.SetMissionText(harvestedResources)
CachedResources = player.Resources
CachedResources = Ordos.Resources
end
end
WorldLoaded = function()
player = Player.GetPlayer("Ordos")
harkonnen = Player.GetPlayer("Harkonnen")
Ordos = Player.GetPlayer("Ordos")
Harkonnen = Player.GetPlayer("Harkonnen")
SpiceToHarvest = ToHarvest[Difficulty]
InitObjectives(player)
KillOrdos = AddPrimaryObjective(harkonnen, "")
InitObjectives(Ordos)
KillOrdos = AddPrimaryObjective(Harkonnen, "")
local harvestSpice = UserInterface.Translate("harvest-spice", { ["spice"] = SpiceToHarvest })
GatherSpice = AddPrimaryObjective(player, harvestSpice)
KillHarkonnen = AddSecondaryObjective(player, "eliminate-harkonnen-units-reinforcements")
GatherSpice = AddPrimaryObjective(Ordos, harvestSpice)
KillHarkonnen = AddSecondaryObjective(Ordos, "eliminate-harkonnen-units-reinforcements")
local checkResourceCapacity = function()
Trigger.AfterDelay(0, function()
if player.ResourceCapacity < SpiceToHarvest then
if Ordos.ResourceCapacity < SpiceToHarvest then
Media.DisplayMessage(UserInterface.Translate("not-enough-silos"), Mentat)
Trigger.AfterDelay(DateTime.Seconds(3), function()
harkonnen.MarkCompletedObjective(KillAtreides)
Harkonnen.MarkCompletedObjective(KillAtreides)
end)
return true
@@ -126,16 +126,16 @@ WorldLoaded = function()
return
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
harkonnen.MarkCompletedObjective(KillOrdos)
Harkonnen.MarkCompletedObjective(KillOrdos)
else
Trigger.OnAllRemovedFromWorld(refs, function()
harkonnen.MarkCompletedObjective(KillOrdos)
Harkonnen.MarkCompletedObjective(KillOrdos)
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(silos, function(actor) Trigger.OnRemovedFromWorld(actor, checkResourceCapacity) end)
end
@@ -144,8 +144,8 @@ WorldLoaded = function()
Media.DisplayMessage(Messages[1], Mentat)
Trigger.AfterDelay(DateTime.Seconds(25), function()
Media.PlaySpeechNotification(player, "Reinforce")
Reinforcements.Reinforce(player, OrdosReinforcements, OrdosEntryPath)
Media.PlaySpeechNotification(Ordos, "Reinforce")
Reinforcements.Reinforce(Ordos, OrdosReinforcements, OrdosEntryPath)
end)
WavesLeft = HarkonnenAttackWaves[Difficulty]
@@ -159,7 +159,7 @@ SendReinforcements = function()
if HarkonnenAttackDelay < 0 then HarkonnenAttackDelay = 0 end
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
if WavesLeft == 0 then

View File

@@ -61,16 +61,16 @@ Messages =
CachedResources = -1
Tick = function()
if HarkonnenArrived and harkonnen.HasNoRequiredUnits() then
player.MarkCompletedObjective(KillHarkonnen)
if HarkonnenArrived and Harkonnen.HasNoRequiredUnits() then
Ordos.MarkCompletedObjective(KillHarkonnen)
end
if player.Resources > SpiceToHarvest - 1 then
player.MarkCompletedObjective(GatherSpice)
if Ordos.Resources > SpiceToHarvest - 1 then
Ordos.MarkCompletedObjective(GatherSpice)
end
-- 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
Media.DisplayMessage(Messages[2], Mentat)
else
@@ -78,40 +78,40 @@ Tick = function()
end
-- 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)
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)
end
if player.Resources ~= CachedResources then
local parameters = { ["harvested"] = player.Resources, ["goal"] = SpiceToHarvest }
if Ordos.Resources ~= CachedResources then
local parameters = { ["harvested"] = Ordos.Resources, ["goal"] = SpiceToHarvest }
local harvestedResources = UserInterface.Translate("harvested-resources", parameters)
UserInterface.SetMissionText(harvestedResources)
CachedResources = player.Resources
CachedResources = Ordos.Resources
end
end
WorldLoaded = function()
player = Player.GetPlayer("Ordos")
harkonnen = Player.GetPlayer("Harkonnen")
Ordos = Player.GetPlayer("Ordos")
Harkonnen = Player.GetPlayer("Harkonnen")
SpiceToHarvest = ToHarvest[Difficulty]
InitObjectives(player)
KillOrdos = AddPrimaryObjective(harkonnen, "")
InitObjectives(Ordos)
KillOrdos = AddPrimaryObjective(Harkonnen, "")
local harvestSpice = UserInterface.Translate("harvest-spice", { ["spice"] = SpiceToHarvest })
GatherSpice = AddPrimaryObjective(player, harvestSpice)
KillHarkonnen = AddSecondaryObjective(player, "eliminate-harkonnen-units-reinforcements")
GatherSpice = AddPrimaryObjective(Ordos, harvestSpice)
KillHarkonnen = AddSecondaryObjective(Ordos, "eliminate-harkonnen-units-reinforcements")
local checkResourceCapacity = function()
Trigger.AfterDelay(0, function()
if player.ResourceCapacity < SpiceToHarvest then
if Ordos.ResourceCapacity < SpiceToHarvest then
Media.DisplayMessage(UserInterface.Translate("not-enough-silos"), Mentat)
Trigger.AfterDelay(DateTime.Seconds(3), function()
harkonnen.MarkCompletedObjective(KillOrdos)
Harkonnen.MarkCompletedObjective(KillOrdos)
end)
return true
@@ -126,16 +126,16 @@ WorldLoaded = function()
return
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
harkonnen.MarkCompletedObjective(KillOrdos)
Harkonnen.MarkCompletedObjective(KillOrdos)
else
Trigger.OnAllRemovedFromWorld(refs, function()
harkonnen.MarkCompletedObjective(KillOrdos)
Harkonnen.MarkCompletedObjective(KillOrdos)
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(silos, function(actor) Trigger.OnRemovedFromWorld(actor, checkResourceCapacity) end)
end
@@ -144,8 +144,8 @@ WorldLoaded = function()
Media.DisplayMessage(Messages[1], Mentat)
Trigger.AfterDelay(DateTime.Seconds(25), function()
Media.PlaySpeechNotification(player, "Reinforce")
Reinforcements.Reinforce(player, OrdosReinforcements, OrdosEntryPath)
Media.PlaySpeechNotification(Ordos, "Reinforce")
Reinforcements.Reinforce(Ordos, OrdosReinforcements, OrdosEntryPath)
end)
WavesLeft = HarkonnenAttackWaves[Difficulty]
@@ -159,7 +159,7 @@ SendReinforcements = function()
if HarkonnenAttackDelay < 0 then HarkonnenAttackDelay = 0 end
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
if WavesLeft == 0 then

View File

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

View File

@@ -81,39 +81,39 @@ OrdosReinforcements = { "light_inf", "light_inf", "raider" }
OrdosEntryPath = { OrdosEntry.Location, OrdosRally.Location }
Tick = function()
if player.HasNoRequiredUnits() then
harkonnen.MarkCompletedObjective(KillOrdos)
if Ordos.HasNoRequiredUnits() then
Harkonnen.MarkCompletedObjective(KillOrdos)
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)
player.MarkCompletedObjective(KillHarkonnen)
Ordos.MarkCompletedObjective(KillHarkonnen)
end
end
WorldLoaded = function()
harkonnen = Player.GetPlayer("Harkonnen")
player = Player.GetPlayer("Ordos")
Harkonnen = Player.GetPlayer("Harkonnen")
Ordos = Player.GetPlayer("Ordos")
InitObjectives(player)
KillOrdos = AddPrimaryObjective(harkonnen, "")
KillHarkonnen = AddPrimaryObjective(player, "destroy-harkonnen-forces")
InitObjectives(Ordos)
KillOrdos = AddPrimaryObjective(Harkonnen, "")
KillHarkonnen = AddPrimaryObjective(Ordos, "destroy-harkonnen-forces")
Camera.Position = OConyard.CenterPosition
Trigger.OnAllKilled(HarkonnenBase, function()
Utils.Do(harkonnen.GetGroundAttackers(), IdleHunt)
Utils.Do(Harkonnen.GetGroundAttackers(), IdleHunt)
end)
Trigger.AfterDelay(DateTime.Minutes(1), function()
Media.PlaySpeechNotification(player, "Reinforce")
Reinforcements.ReinforceWithTransport(player, "carryall.reinforce", OrdosReinforcements, OrdosEntryPath, { OrdosEntryPath[1] })
Media.PlaySpeechNotification(Ordos, "Reinforce")
Reinforcements.ReinforceWithTransport(Ordos, "carryall.reinforce", OrdosReinforcements, OrdosEntryPath, { OrdosEntryPath[1] })
end)
TriggerCarryallReinforcements(player, harkonnen, HarkonnenBaseAreaTrigger, InitialHarkonnenReinforcements[1], InitialHarkonnenReinforcementsPaths[1])
TriggerCarryallReinforcements(player, harkonnen, HarkonnenBaseAreaTrigger, InitialHarkonnenReinforcements[2], InitialHarkonnenReinforcementsPaths[2])
TriggerCarryallReinforcements(Ordos, Harkonnen, HarkonnenBaseAreaTrigger, InitialHarkonnenReinforcements[1], InitialHarkonnenReinforcementsPaths[1])
TriggerCarryallReinforcements(Ordos, Harkonnen, HarkonnenBaseAreaTrigger, InitialHarkonnenReinforcements[2], InitialHarkonnenReinforcementsPaths[2])
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)
end

View File

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

View File

@@ -65,31 +65,31 @@ HarkonnenAttackWaves =
}
Tick = function()
if player.HasNoRequiredUnits() then
harkonnen.MarkCompletedObjective(KillOrdos)
if Ordos.HasNoRequiredUnits() then
Harkonnen.MarkCompletedObjective(KillOrdos)
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)
player.MarkCompletedObjective(KillHarkonnen)
Ordos.MarkCompletedObjective(KillHarkonnen)
end
end
WorldLoaded = function()
harkonnen = Player.GetPlayer("Harkonnen")
player = Player.GetPlayer("Ordos")
Harkonnen = Player.GetPlayer("Harkonnen")
Ordos = Player.GetPlayer("Ordos")
InitObjectives(player)
KillOrdos = AddPrimaryObjective(harkonnen, "")
KillHarkonnen = AddPrimaryObjective(player, "destroy-harkonnen-forces")
InitObjectives(Ordos)
KillOrdos = AddPrimaryObjective(Harkonnen, "")
KillHarkonnen = AddPrimaryObjective(Ordos, "destroy-harkonnen-forces")
Camera.Position = OConyard.CenterPosition
Trigger.OnAllKilled(HarkonnenBase, function()
Utils.Do(harkonnen.GetGroundAttackers(), IdleHunt)
Utils.Do(Harkonnen.GetGroundAttackers(), IdleHunt)
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)
end

View File

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

View File

@@ -77,25 +77,25 @@ OrdosBaseBuildings = { "barracks", "light_factory" }
OrdosUpgrades = { "upgrade.barracks", "upgrade.light" }
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
Tick = function()
if player.HasNoRequiredUnits() then
harkonnen.MarkCompletedObjective(KillOrdos)
if Ordos.HasNoRequiredUnits() then
Harkonnen.MarkCompletedObjective(KillOrdos)
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)
player.MarkCompletedObjective(KillHarkonnen)
Ordos.MarkCompletedObjective(KillHarkonnen)
end
if DateTime.GameTime % DateTime.Seconds(10) == 0 and LastHarvesterEaten[harkonnen] then
local units = harkonnen.GetActorsByType("harvester")
if DateTime.GameTime % DateTime.Seconds(10) == 0 and LastHarvesterEaten[Harkonnen] then
local units = Harkonnen.GetActorsByType("harvester")
if #units > 0 then
LastHarvesterEaten[harkonnen] = false
ProtectHarvester(units[1], harkonnen, AttackGroupSize[Difficulty])
LastHarvesterEaten[Harkonnen] = false
ProtectHarvester(units[1], Harkonnen, AttackGroupSize[Difficulty])
end
end
@@ -105,27 +105,27 @@ Tick = function()
end
WorldLoaded = function()
harkonnen = Player.GetPlayer("Harkonnen")
player = Player.GetPlayer("Ordos")
Harkonnen = Player.GetPlayer("Harkonnen")
Ordos = Player.GetPlayer("Ordos")
InitObjectives(player)
KillOrdos = AddPrimaryObjective(harkonnen, "")
KillHarkonnen = AddPrimaryObjective(player, "eliminate-harkonnen-units-reinforcements")
InitObjectives(Ordos)
KillOrdos = AddPrimaryObjective(Harkonnen, "")
KillHarkonnen = AddPrimaryObjective(Ordos, "eliminate-harkonnen-units-reinforcements")
Camera.Position = OConyard.CenterPosition
Trigger.OnAllKilled(HarkonnenBase, function()
Utils.Do(harkonnen.GetGroundAttackers(), IdleHunt)
Utils.Do(Harkonnen.GetGroundAttackers(), IdleHunt)
end)
local path = function() return Utils.Random(HarkonnenPaths) end
local waveCondition = function() return player.IsObjectiveCompleted(KillHarkonnen) end
SendCarryallReinforcements(harkonnen, 0, HarkonnenAttackWaves[Difficulty], HarkonnenAttackDelay[Difficulty], path, HarkonnenReinforcements[Difficulty], waveCondition)
local waveCondition = function() return Ordos.IsObjectiveCompleted(KillHarkonnen) end
SendCarryallReinforcements(Harkonnen, 0, HarkonnenAttackWaves[Difficulty], HarkonnenAttackDelay[Difficulty], path, HarkonnenReinforcements[Difficulty], waveCondition)
ActivateAI()
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)
TriggerCarryallReinforcements(player, harkonnen, HarkonnenBaseAreaTrigger, HarkonnenHunters, HarkonnenHunterPath)
TriggerCarryallReinforcements(Ordos, Harkonnen, HarkonnenBaseAreaTrigger, HarkonnenHunters, HarkonnenHunterPath)
end

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@@ -110,57 +110,57 @@ end
CachedResources = -1
Tick = function()
if player.Resources > SpiceToHarvest - 1 then
player.MarkCompletedObjective(GatherSpice)
if Ordos.Resources > SpiceToHarvest - 1 then
Ordos.MarkCompletedObjective(GatherSpice)
end
if player.HasNoRequiredUnits() then
atreides_main.MarkCompletedObjective(KillOrdos1)
atreides_small_1.MarkCompletedObjective(KillOrdos2)
atreides_small_2.MarkCompletedObjective(KillOrdos3)
atreides_small_3.MarkCompletedObjective(KillOrdos4)
if Ordos.HasNoRequiredUnits() then
AtreidesMain.MarkCompletedObjective(KillOrdos1)
AtreidesSmall1.MarkCompletedObjective(KillOrdos2)
AtreidesSmall2.MarkCompletedObjective(KillOrdos3)
AtreidesSmall3.MarkCompletedObjective(KillOrdos4)
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)
player.MarkCompletedObjective(KillAtreides)
Ordos.MarkCompletedObjective(KillAtreides)
end
if #player.GetActorsByType("engineer") == 0 and not player.IsObjectiveCompleted(CaptureStarport) then
player.MarkFailedObjective(CaptureStarport)
if #Ordos.GetActorsByType("engineer") == 0 and not Ordos.IsObjectiveCompleted(CaptureStarport) then
Ordos.MarkFailedObjective(CaptureStarport)
end
if player.IsObjectiveCompleted(CaptureStarport) then
if player.Resources ~= CachedResources then
local parameters = { ["harvested"] = player.Resources, ["goal"] = SpiceToHarvest }
if Ordos.IsObjectiveCompleted(CaptureStarport) then
if Ordos.Resources ~= CachedResources then
local parameters = { ["harvested"] = Ordos.Resources, ["goal"] = SpiceToHarvest }
local harvestedResources = UserInterface.Translate("harvested-resources", parameters)
UserInterface.SetMissionText(harvestedResources)
CachedResources = player.Resources
CachedResources = Ordos.Resources
end
end
CheckHarvester(atreides_main)
CheckHarvester(atreides_small_1)
CheckHarvester(AtreidesMain)
CheckHarvester(AtreidesSmall1)
end
WorldLoaded = function()
atreides_main = Player.GetPlayer("AtreidesMainBase")
atreides_small_1 = Player.GetPlayer("AtreidesSmallBase1")
atreides_small_2 = Player.GetPlayer("AtreidesSmallBase2")
atreides_small_3 = Player.GetPlayer("AtreidesSmallBase3")
player = Player.GetPlayer("Ordos")
AtreidesMain = Player.GetPlayer("AtreidesMainBase")
AtreidesSmall1 = Player.GetPlayer("AtreidesSmallBase1")
AtreidesSmall2 = Player.GetPlayer("AtreidesSmallBase2")
AtreidesSmall3 = Player.GetPlayer("AtreidesSmallBase3")
Ordos = Player.GetPlayer("Ordos")
SpiceToHarvest = ToHarvest[Difficulty]
InitObjectives(player)
KillOrdos1 = AddPrimaryObjective(atreides_main, "")
KillOrdos2 = AddPrimaryObjective(atreides_small_1, "")
KillOrdos3 = AddPrimaryObjective(atreides_small_2, "")
KillOrdos4 = AddPrimaryObjective(atreides_small_3, "")
CaptureStarport = AddPrimaryObjective(player, "capture-atreides-starport-establish-base")
InitObjectives(Ordos)
KillOrdos1 = AddPrimaryObjective(AtreidesMain, "")
KillOrdos2 = AddPrimaryObjective(AtreidesSmall1, "")
KillOrdos3 = AddPrimaryObjective(AtreidesSmall2, "")
KillOrdos4 = AddPrimaryObjective(AtreidesSmall3, "")
CaptureStarport = AddPrimaryObjective(Ordos, "capture-atreides-starport-establish-base")
local harvestSpice = UserInterface.Translate("harvest-spice", { ["spice"] = SpiceToHarvest })
GatherSpice = AddPrimaryObjective(player, harvestSpice)
KillAtreides = AddSecondaryObjective(player, "destroy-atreides")
GatherSpice = AddPrimaryObjective(Ordos, harvestSpice)
KillAtreides = AddSecondaryObjective(Ordos, "destroy-atreides")
Camera.Position = OEngi1.CenterPosition
AtreidesAttackLocation = OEngi1.Location
@@ -173,45 +173,45 @@ WorldLoaded = function()
OCombat2.Destroy()
end
Hunt(atreides_main)
Hunt(atreides_small_1)
Hunt(atreides_small_2)
Hunt(atreides_small_3)
Hunt(AtreidesMain)
Hunt(AtreidesSmall1)
Hunt(AtreidesSmall2)
Hunt(AtreidesSmall3)
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)
unit.AttackMove(AtreidesAttackLocation)
IdleHunt(unit)
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.light", true, { Owner = atreides_main })
Actor.Create("upgrade.heavy", true, { Owner = atreides_main })
Actor.Create("upgrade.barracks", true, { Owner = atreides_small_1 })
Actor.Create("upgrade.barracks", true, { Owner = atreides_small_2 })
Actor.Create("upgrade.barracks", true, { Owner = AtreidesMain })
Actor.Create("upgrade.light", true, { Owner = AtreidesMain })
Actor.Create("upgrade.heavy", true, { Owner = AtreidesMain })
Actor.Create("upgrade.barracks", true, { Owner = AtreidesSmall1 })
Actor.Create("upgrade.barracks", true, { Owner = AtreidesSmall2 })
Trigger.AfterDelay(0, ActivateAI)
Trigger.OnKilled(AStarport, function()
if not player.IsObjectiveCompleted(CaptureStarport) then
player.MarkFailedObjective(CaptureStarport)
if not Ordos.IsObjectiveCompleted(CaptureStarport) then
Ordos.MarkFailedObjective(CaptureStarport)
end
end)
Trigger.OnCapture(AStarport, function()
player.MarkCompletedObjective(CaptureStarport)
Ordos.MarkCompletedObjective(CaptureStarport)
if not AIProductionActivated then
ActivateAIProduction()
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()
end
if APower9.Owner ~= player and not APower9.IsDead then
if APower9.Owner ~= Ordos and not APower9.IsDead then
APower9.Sell()
end
end)

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@@ -41,7 +41,7 @@ Tick = function()
end
ProduceUnits = function(factory, count)
if ussr.IsProducing("e1") then
if USSR.IsProducing("e1") then
Trigger.AfterDelay(DateTime.Seconds(5), function() ProduceUnits(factory, count) end)
return
end
@@ -53,14 +53,14 @@ ProduceUnits = function(factory, count)
if not factory.IsDead then
factory.IsPrimaryBuilding = true
ussr.Build(units, function(soldiers)
USSR.Build(units, function(soldiers)
Utils.Do(soldiers, function(unit) IdleHunt(unit) end)
end)
end
end
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
Trigger.AfterDelay(DateTime.Seconds(2), function()
@@ -74,18 +74,18 @@ SetupAlliedUnits = function()
InsertionHeli.Move(InsertionHeliExit.Location)
InsertionHeli.Destroy()
Trigger.OnKilled(Tanya, function() player.MarkFailedObjective(TanyaSurvive) end)
Trigger.OnKilled(Tanya, function() Greece.MarkFailedObjective(TanyaSurvive) end)
end
SetupTopRightIsland = function()
player.MarkCompletedObjective(FindAllies)
Media.PlaySpeechNotification(player, "AlliedReinforcementsArrived")
Reinforcements.Reinforce(player, AlliedIslandReinforcements, { AlliedIslandReinforcementsEntry.Location, IslandParadropReinforcementsDropzone.Location })
Greece.MarkCompletedObjective(FindAllies)
Media.PlaySpeechNotification(Greece, "AlliedReinforcementsArrived")
Reinforcements.Reinforce(Greece, AlliedIslandReinforcements, { AlliedIslandReinforcementsEntry.Location, IslandParadropReinforcementsDropzone.Location })
SendUSSRParadrops(Angle.New(720), IslandParadropReinforcementsDropzone)
end
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)
Utils.Do(aircraft, function(a)
@@ -98,8 +98,8 @@ SendUSSRParadrops = function(facing, dropzone)
end
SendUSSRTankReinforcements = function()
local camera = Actor.Create("camera", true, { Owner = player, Location = USSRReinforcementsCameraWaypoint.Location })
local ussrTanks = Reinforcements.Reinforce(ussr, USSRTankReinforcements, USSRTankReinforcementsWaypoints)
local camera = Actor.Create("camera", true, { Owner = Greece, Location = USSRReinforcementsCameraWaypoint.Location })
local ussrTanks = Reinforcements.Reinforce(USSR, USSRTankReinforcements, USSRTankReinforcementsWaypoints)
Trigger.OnAllRemovedFromWorld(ussrTanks, function()
Trigger.AfterDelay(DateTime.Seconds(3), function()
if not camera.IsDead then
@@ -110,7 +110,7 @@ SendUSSRTankReinforcements = function()
end
JeepCheckpointMove = function()
JeepCamera = Actor.Create("camera.jeep", true, { Owner = player })
JeepCamera = Actor.Create("camera.jeep", true, { Owner = Greece })
TeleportJeepCamera = true
Trigger.OnIdle(Jeep, function()
@@ -129,7 +129,7 @@ end
JeepSuicideMove = function()
if not JeepCamera then
JeepCamera = Actor.Create("camera.jeep", true, { Owner = player })
JeepCamera = Actor.Create("camera.jeep", true, { Owner = Greece })
TeleportJeepCamera = true
end
@@ -156,7 +156,7 @@ AlertFirstBase = function()
end)
for i = 0, 2 do
Trigger.AfterDelay(DateTime.Seconds(i), function()
Media.PlaySoundNotification(player, "AlertBuzzer")
Media.PlaySoundNotification(Greece, "AlertBuzzer")
end)
end
ProduceUnits(ProductionBuildings[1], Utils.RandomInteger(4, 8))
@@ -164,42 +164,42 @@ AlertFirstBase = function()
end
InitPlayers = function()
player = Player.GetPlayer("Greece")
ussr = Player.GetPlayer("USSR")
Greece = Player.GetPlayer("Greece")
USSR = Player.GetPlayer("USSR")
ussr.Cash = 10000
USSR.Cash = 10000
end
AddObjectives = function()
InitObjectives(player)
InitObjectives(Greece)
KillBridges = AddPrimaryObjective(player, "destroy-bridges")
TanyaSurvive = AddPrimaryObjective(player, "tanya-survive")
FindAllies = AddSecondaryObjective(player, "find-lost-tanks")
FreePrisoners = AddSecondaryObjective(player, "free-prisoners")
KillBridges = AddPrimaryObjective(Greece, "destroy-bridges")
TanyaSurvive = AddPrimaryObjective(Greece, "tanya-survive")
FindAllies = AddSecondaryObjective(Greece, "find-lost-tanks")
FreePrisoners = AddSecondaryObjective(Greece, "free-prisoners")
end
InitTriggers = function()
Utils.Do(ussr.GetGroundAttackers(), function(unit)
Utils.Do(USSR.GetGroundAttackers(), function(unit)
Trigger.OnDamaged(unit, function() IdleHunt(unit) end)
end)
Trigger.OnAnyKilled(Prisoners, function() player.MarkFailedObjective(FreePrisoners) end)
Trigger.OnKilled(PrisonedMedi, function() player.MarkFailedObjective(FreePrisoners) end)
Trigger.OnAnyKilled(Prisoners, function() Greece.MarkFailedObjective(FreePrisoners) end)
Trigger.OnKilled(PrisonedMedi, function() Greece.MarkFailedObjective(FreePrisoners) end)
Trigger.OnKilled(MediHideaway, function()
if not MediFreed then
MediFreed = true
player.MarkFailedObjective(FreePrisoners)
Greece.MarkFailedObjective(FreePrisoners)
end
end)
Trigger.OnKilled(ExplosiveBarrel, function()
if reinforcementsTriggered then
if ReinforcementsTriggered then
return
end
if not ExplodingBridge.IsDead then ExplodingBridge.Kill() end
reinforcementsTriggered = true
ReinforcementsTriggered = true
Trigger.AfterDelay(DateTime.Seconds(1), SendUSSRTankReinforcements)
end)
@@ -215,19 +215,19 @@ InitTriggers = function()
if not tank.IsDead then tank.Kill() end
end)
jeepTriggered = true
JeepTriggered = true
JeepSuicideMove()
end)
Utils.Do(FirstUSSRBase, function(unit)
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()
end)
end)
Trigger.OnAllKilledOrCaptured(FirstUSSRBase, function()
if baseCamera and baseCamera.IsInWorld then
baseCamera.Destroy()
if BaseCamera and BaseCamera.IsInWorld then
BaseCamera.Destroy()
end
end)
@@ -239,19 +239,19 @@ InitTriggers = function()
end)
Trigger.OnCapture(USSRRadarDome, function()
largeCameraA = Actor.Create("camera.verylarge", true, { Owner = player, Location = LargeCameraWaypoint1.Location })
largeCameraB = Actor.Create("camera.verylarge", true, { Owner = player, Location = LargeCameraWaypoint2.Location })
largeCameraC = Actor.Create("camera.verylarge", true, { Owner = player, Location = LargeCameraWaypoint3.Location })
LargeCameraA = Actor.Create("camera.verylarge", true, { Owner = Greece, Location = LargeCameraWaypoint1.Location })
LargeCameraB = Actor.Create("camera.verylarge", true, { Owner = Greece, Location = LargeCameraWaypoint2.Location })
LargeCameraC = Actor.Create("camera.verylarge", true, { Owner = Greece, Location = LargeCameraWaypoint3.Location })
end)
Trigger.OnRemovedFromWorld(USSRRadarDome, function()
if largeCameraA and largeCameraA.IsInWorld then largeCameraA.Destroy() end
if largeCameraB and largeCameraB.IsInWorld then largeCameraB.Destroy() end
if largeCameraC and largeCameraC.IsInWorld then largeCameraC.Destroy() end
if LargeCameraA and LargeCameraA.IsInWorld then LargeCameraA.Destroy() end
if LargeCameraB and LargeCameraB.IsInWorld then LargeCameraB.Destroy() end
if LargeCameraC and LargeCameraC.IsInWorld then LargeCameraC.Destroy() end
end)
Trigger.OnEnteredFootprint(TrukTriggerArea, function(a, id)
if a.Owner == player and not trukTriggered then
trukTriggered = true
if a.Owner == Greece and not TrukTriggered then
TrukTriggered = true
Trigger.RemoveFootprintTrigger(id)
if USSRTruk.IsDead then
@@ -262,7 +262,7 @@ InitTriggers = function()
if USSRTruk.Location == BaseCameraWaypoint.Location then
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
driver.AttackMove(PGuard5.Location)
else
@@ -276,57 +276,57 @@ InitTriggers = function()
end
end)
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)
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(FreeMediTriggerArea, function(a, id)
if a.Owner == player and not MediFreed then
if a.Owner == Greece and not MediFreed then
MediFreed = true
Trigger.RemoveFootprintTrigger(id)
Reinforcements.Reinforce(player, { "medi" }, { MediSpawnpoint.Location, MediRallypoint.Location })
Reinforcements.Reinforce(Greece, { "medi" }, { MediSpawnpoint.Location, MediRallypoint.Location })
end
end)
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)
baseCamera = Actor.Create("camera", true, { Owner = player, Location = BaseCameraWaypoint.Location })
BaseCamera = Actor.Create("camera", true, { Owner = Greece, Location = BaseCameraWaypoint.Location })
end
end)
Trigger.OnEnteredFootprint(BeachTriggerArea, function(a, id)
if a.Owner == player and not beachTransportTriggered then
beachTransportTriggered = true
if a.Owner == Greece and not BeachTransportTriggered then
BeachTransportTriggered = true
Trigger.RemoveFootprintTrigger(id)
SetupTopRightIsland()
end
end)
Trigger.OnEnteredFootprint(ParadropTriggerArea, function(a, id)
if a.Owner == player and a.Type ~= "jeep.mission" and not paradropsTriggered then
paradropsTriggered = true
if a.Owner == Greece and a.Type ~= "jeep.mission" and not ParadropsTriggered then
ParadropsTriggered = true
Trigger.RemoveFootprintTrigger(id)
SendUSSRParadrops(Angle.New(216), ParadropReinforcementsDropzone)
end
end)
Trigger.OnEnteredFootprint(ReinforcementsTriggerArea, function(a, id)
if a.Owner == player and not reinforcementsTriggered then
reinforcementsTriggered = true
if a.Owner == Greece and not ReinforcementsTriggered then
ReinforcementsTriggered = true
Trigger.RemoveFootprintTrigger(id)
Trigger.AfterDelay(DateTime.Seconds(1), SendUSSRTankReinforcements)
end
end)
Trigger.OnEnteredFootprint(Barracks3TriggerArea, function(a, id)
if a.Owner == player and not Barracks3Producing then
if a.Owner == Greece and not Barracks3Producing then
Barracks3Producing = true
Trigger.RemoveFootprintTrigger(id)
ProduceUnits(ProductionBuildings[3], Utils.RandomInteger(2, 5))
end
end)
Trigger.OnEnteredFootprint(JeepTriggerArea, function(a, id)
if a.Owner == player and not jeepTriggered then
jeepTriggered = true
if a.Owner == Greece and not JeepTriggered then
JeepTriggered = true
Trigger.RemoveFootprintTrigger(id)
JeepCheckpointMove()
end
@@ -345,12 +345,12 @@ InitTriggers = function()
ExplodingBridge = bridges[1]
Trigger.OnAllKilled(bridges, function()
player.MarkCompletedObjective(KillBridges)
player.MarkCompletedObjective(TanyaSurvive)
Greece.MarkCompletedObjective(KillBridges)
Greece.MarkCompletedObjective(TanyaSurvive)
-- The medic is freed once his guard is dead
if MediFreed and MediGuard.IsDead and EngisFreed then
player.MarkCompletedObjective(FreePrisoners)
Greece.MarkCompletedObjective(FreePrisoners)
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 }
BuildBase = function()
if Conyard.IsDead or Conyard.Owner ~= ussr then
if Conyard.IsDead or Conyard.Owner ~= USSR then
return
elseif Harvester.IsDead and ussr.Resources <= 299 then
elseif Harvester.IsDead and USSR.Resources <= 299 then
return
end
@@ -77,13 +77,13 @@ end
BuildBuilding = function(building)
Trigger.AfterDelay(Actor.BuildTime(building.name), function()
local actor = Actor.Create(building.name, true, { Owner = ussr, Location = building.pos })
ussr.Cash = ussr.Cash - building.prize
local actor = Actor.Create(building.name, true, { Owner = USSR, Location = building.pos })
USSR.Cash = USSR.Cash - building.prize
building.exists = true
Trigger.OnKilled(actor, function() building.exists = false end)
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()
DefendActor(actor)
end
@@ -163,13 +163,13 @@ DefendActor = function(unit)
end
InitAIUnits = function()
IdlingUnits = ussr.GetGroundAttackers()
IdlingUnits = USSR.GetGroundAttackers()
DefendActor(Conyard)
for i,v in ipairs(InitialBase) do
DefendActor(v)
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()
end
end)
@@ -189,7 +189,7 @@ ProduceInfantry = function()
-- See AttackDelay in WorldLoaded
local delay = Utils.RandomInteger(AttackDelay[1], AttackDelay[2])
local toBuild = { Utils.Random(SovietInfantryTypes) }
ussr.Build(toBuild, function(unit)
USSR.Build(toBuild, function(unit)
IdlingUnits[#IdlingUnits + 1] = unit[1]
Trigger.AfterDelay(delay, ProduceInfantry)
@@ -209,14 +209,14 @@ ProduceVehicles = function()
-- See AttackDelay in WorldLoaded
local delay = Utils.RandomInteger(AttackDelay[1], AttackDelay[2])
if HarvesterKilled then
ussr.Build({ "harv" }, function(harv)
USSR.Build({ "harv" }, function(harv)
ProtectHarvester(harv[1])
HarvesterKilled = false
Trigger.AfterDelay(delay, ProduceVehicles)
end)
else
local toBuild = { Utils.Random(SovietVehicleTypes) }
ussr.Build(toBuild, function(unit)
USSR.Build(toBuild, function(unit)
IdlingUnits[#IdlingUnits + 1] = unit[1]
Trigger.AfterDelay(delay, ProduceVehicles)
@@ -229,7 +229,7 @@ ProduceVehicles = function()
end
ProduceAircraft = function()
ussr.Build(SovietAircraftType, function(units)
USSR.Build(SovietAircraftType, function(units)
local yak = units[1]
Yaks[#Yaks + 1] = yak
@@ -238,7 +238,7 @@ ProduceAircraft = function()
Trigger.AfterDelay(DateTime.Minutes(1), ProduceAircraft)
end
InitializeAttackAircraft(yak, player)
InitializeAttackAircraft(yak, Greece)
end)
end

View File

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

View File

@@ -84,7 +84,7 @@ WaterAttack = function()
types[i] = Utils.Random(SovietInfantryTypes)
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
ProtectHarvester = function(unit)
@@ -111,12 +111,12 @@ ProtectHarvester = function(unit)
end
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)
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()
end
end)
@@ -124,7 +124,7 @@ InitAIUnits = function()
end
InitAIEconomy = function()
ussr.Cash = 6000
USSR.Cash = 6000
if not Harvester.IsDead then
Harvester.FindResources()
@@ -200,7 +200,7 @@ ProduceInfantry = function()
local delay = Utils.RandomInteger(DateTime.Seconds(3), DateTime.Seconds(9))
local toBuild = { Utils.Random(SovietInfantryTypes) }
ussr.Build(toBuild, function(unit)
USSR.Build(toBuild, function(unit)
IdlingUnits[#IdlingUnits + 1] = unit[1]
Trigger.AfterDelay(delay, ProduceInfantry)
@@ -223,7 +223,7 @@ ProduceVehicles = function()
local delay = Utils.RandomInteger(DateTime.Seconds(5), DateTime.Seconds(9))
if HarvesterKilled then
HarvesterKilled = false
ussr.Build({ "harv" }, function(harv)
USSR.Build({ "harv" }, function(harv)
harv[1].FindResources()
ProtectHarvester(harv[1])
Trigger.AfterDelay(delay, ProduceVehicles)
@@ -233,7 +233,7 @@ ProduceVehicles = function()
Warfactory2.RallyPoint = Utils.Random(Rallypoints).Location
local toBuild = { Utils.Random(SovietVehicleTypes) }
ussr.Build(toBuild, function(unit)
USSR.Build(toBuild, function(unit)
IdlingUnits[#IdlingUnits + 1] = unit[1]
Trigger.AfterDelay(delay, ProduceVehicles)
@@ -248,7 +248,7 @@ ProduceAircraft = function()
return
end
ussr.Build(SovietAircraftType, function(units)
USSR.Build(SovietAircraftType, function(units)
local yak = units[1]
Yaks[#Yaks + 1] = yak
@@ -257,7 +257,7 @@ ProduceAircraft = function()
Trigger.AfterDelay(DateTime.Minutes(1), ProduceAircraft)
end
InitializeAttackAircraft(yak, greece)
InitializeAttackAircraft(yak, Greece)
end)
end

View File

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

View File

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

View File

@@ -95,41 +95,41 @@ InitialSovietPatrols = function()
end
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)
Reinforcements.Reinforce(player, AlliedReinforcementsA, { AlliedEntry1.Location, UnitBStopLocation.Location }, 2)
Reinforcements.Reinforce(Greece, AlliedReinforcementsA, { AlliedEntry1.Location, UnitBStopLocation.Location }, 2)
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)
Trigger.AfterDelay(DateTime.Seconds(5), function()
Reinforcements.Reinforce(player, { "mcv" }, { AlliedEntry3.Location, MCVStopLocation.Location })
Reinforcements.Reinforce(Greece, { "mcv" }, { AlliedEntry3.Location, MCVStopLocation.Location })
end)
end
CaptureRadarDome = function()
Trigger.OnKilled(RadarDome, function()
player.MarkFailedObjective(CaptureRadarDomeObj)
Greece.MarkFailedObjective(CaptureRadarDomeObj)
end)
Trigger.OnCapture(RadarDome, function()
player.MarkCompletedObjective(CaptureRadarDomeObj)
Greece.MarkCompletedObjective(CaptureRadarDomeObj)
Utils.Do(SovietTechLabs, function(a)
if a.IsDead then
return
end
Beacon.New(player, a.CenterPosition)
Beacon.New(Greece, a.CenterPosition)
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)
Media.DisplayMessage(UserInterface.Translate("soviet-tech-centers-discovered"))
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
@@ -137,14 +137,14 @@ end
InfiltrateTechCenter = function()
Utils.Do(SovietTechLabs, function(a)
Trigger.OnInfiltrated(a, function()
if infiltrated then
if Infiltrated then
return
end
infiltrated = true
DestroySovietsObj = AddPrimaryObjective(player, "destroy-soviet-buildings-units")
player.MarkCompletedObjective(InfiltrateTechCenterObj)
Infiltrated = true
DestroySovietsObj = AddPrimaryObjective(Greece, "destroy-soviet-buildings-units")
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)
Proxy.TargetParatroopers(waypoint.CenterPosition, Angle.South)
end)
@@ -152,37 +152,37 @@ InfiltrateTechCenter = function()
end)
Trigger.OnCapture(a, function()
if not infiltrated then
if not Infiltrated then
Media.DisplayMessage(UserInterface.Translate("dont-capture-tech-centers"))
end
end)
end)
Trigger.OnAllKilledOrCaptured(SovietTechLabs, function()
if not player.IsObjectiveCompleted(InfiltrateTechCenterObj) then
player.MarkFailedObjective(InfiltrateTechCenterObj)
if not Greece.IsObjectiveCompleted(InfiltrateTechCenterObj) then
Greece.MarkFailedObjective(InfiltrateTechCenterObj)
end
end)
end
Tick = function()
if DateTime.GameTime > DateTime.Seconds(10) and player.HasNoRequiredUnits() then
player.MarkFailedObjective(InfiltrateTechCenterObj)
if DateTime.GameTime > DateTime.Seconds(10) and Greece.HasNoRequiredUnits() then
Greece.MarkFailedObjective(InfiltrateTechCenterObj)
end
if DestroySovietsObj and ussr.HasNoRequiredUnits() then
player.MarkCompletedObjective(DestroySovietsObj)
if DestroySovietsObj and USSR.HasNoRequiredUnits() then
Greece.MarkCompletedObjective(DestroySovietsObj)
end
end
WorldLoaded = function()
player = Player.GetPlayer("Greece")
ussr = Player.GetPlayer("USSR")
Greece = Player.GetPlayer("Greece")
USSR = Player.GetPlayer("USSR")
InitObjectives(player)
InitObjectives(Greece)
InfiltrateTechCenterObj = AddPrimaryObjective(player, "infiltrate-tech-center-spy")
CaptureRadarDomeObj = AddSecondaryObjective(player, "capture-radar-shore")
InfiltrateTechCenterObj = AddPrimaryObjective(Greece, "infiltrate-tech-center-spy")
CaptureRadarDomeObj = AddSecondaryObjective(Greece, "capture-radar-shore")
Camera.Position = DefaultCameraPosition.CenterPosition
@@ -196,9 +196,9 @@ WorldLoaded = function()
end)
Trigger.OnEnteredProximityTrigger(SovietMiniBaseCam.CenterPosition, WDist.New(1024 * 6), function(a, id)
if a.Owner == player then
if a.Owner == Greece then
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)
end
end)

View File

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

View File

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

View File

@@ -64,11 +64,11 @@ SendBGAttackGroup = function()
end
ProduceBadGuyInfantry = function()
if BadGuyRax.IsDead or BadGuyRax.Owner ~= badguy then
if BadGuyRax.IsDead or BadGuyRax.Owner ~= BadGuy then
return
end
badguy.Build({ Utils.Random(SovietInfantry) }, function(units)
BadGuy.Build({ Utils.Random(SovietInfantry) }, function(units)
table.insert(BGAttackGroup, units[1])
SendBGAttackGroup()
Trigger.AfterDelay(ProductionInterval[Difficulty], ProduceBadGuyInfantry)
@@ -90,11 +90,11 @@ SendAttackGroup = function()
end
ProduceUSSRInfantry = function()
if USSRRax.IsDead or USSRRax.Owner ~= ussr then
if USSRRax.IsDead or USSRRax.Owner ~= USSR then
return
end
ussr.Build({ Utils.Random(SovietInfantry) }, function(units)
USSR.Build({ Utils.Random(SovietInfantry) }, function(units)
table.insert(AttackGroup, units[1])
SendAttackGroup()
Trigger.AfterDelay(ProductionInterval[Difficulty], ProduceUSSRInfantry)
@@ -102,11 +102,11 @@ ProduceUSSRInfantry = function()
end
ProduceVehicles = function()
if USSRWarFactory.IsDead or USSRWarFactory.Owner ~= ussr then
if USSRWarFactory.IsDead or USSRWarFactory.Owner ~= USSR then
return
end
ussr.Build({ Utils.Random(SovietVehicles) }, function(units)
USSR.Build({ Utils.Random(SovietVehicles) }, function(units)
table.insert(AttackGroup, units[1])
SendAttackGroup()
Trigger.AfterDelay(ProductionInterval[Difficulty], ProduceVehicles)
@@ -114,11 +114,11 @@ ProduceVehicles = function()
end
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
end
ussr.Build(SovietAircraftType, function(units)
USSR.Build(SovietAircraftType, function(units)
local yak = units[1]
Yaks[#Yaks + 1] = yak
@@ -129,17 +129,17 @@ ProduceAircraft = function()
Trigger.AfterDelay(DateTime.Seconds(ProductionInterval[Difficulty] / 2), ProduceAircraft)
end
InitializeAttackAircraft(yak, greece)
InitializeAttackAircraft(yak, Greece)
end)
end
ActivateAI = function()
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)
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()
end
end)

View File

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

View File

@@ -84,11 +84,11 @@ SendAttackGroup = function()
end
ProduceInfantry = function()
if USSRRax.IsDead or USSRRax.Owner ~= ussr then
if USSRRax.IsDead or USSRRax.Owner ~= USSR then
return
end
ussr.Build({ Utils.Random(SovietInfantry) }, function(units)
USSR.Build({ Utils.Random(SovietInfantry) }, function(units)
table.insert(AttackGroup, units[1])
SendAttackGroup()
Trigger.AfterDelay(ProductionInterval[Difficulty], ProduceInfantry)
@@ -96,11 +96,11 @@ ProduceInfantry = function()
end
ProduceVehicles = function()
if USSRWarFactory.IsDead or USSRWarFactory.Owner ~= ussr then
if USSRWarFactory.IsDead or USSRWarFactory.Owner ~= USSR then
return
end
ussr.Build({ Utils.Random(SovietVehicles) }, function(units)
USSR.Build({ Utils.Random(SovietVehicles) }, function(units)
table.insert(AttackGroup, units[1])
SendAttackGroup()
Trigger.AfterDelay(ProductionInterval[Difficulty], ProduceVehicles)
@@ -108,11 +108,11 @@ ProduceVehicles = function()
end
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
end
ussr.Build(SovietAircraftType, function(units)
USSR.Build(SovietAircraftType, function(units)
local mig = units[1]
Migs[#Migs + 1] = mig
@@ -123,13 +123,13 @@ ProduceAircraft = function()
Trigger.AfterDelay(DateTime.Seconds(ProductionInterval[Difficulty] / 2), ProduceAircraft)
end
InitializeAttackAircraft(mig, greece)
InitializeAttackAircraft(mig, Greece)
end)
end
GroundWaves = function()
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]
Utils.Do(units, function(unit)
Trigger.OnAddedToWorld(unit, function()
@@ -146,7 +146,7 @@ end
WTransWaves = function()
local way = Utils.Random(WTransWays)
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)
Trigger.OnAddedToWorld(a, function()
a.AttackMove(AttackChrono.Location)
@@ -169,15 +169,15 @@ end
SendParabombs = function()
local airfield = Airfield1
if Airfield1.IsDead or Airfield1.Owner ~= ussr then
if Airfield2.IsDead or Airfield2.Owner ~= ussr then
if Airfield1.IsDead or Airfield1.Owner ~= USSR then
if Airfield2.IsDead or Airfield2.Owner ~= USSR then
return
end
airfield = Airfield2
end
local targets = Utils.Where(greece.GetActors(), function(actor)
local targets = Utils.Where(Greece.GetActors(), function(actor)
return
actor.HasProperty("Sell") and
actor.Type ~= "brik" and
@@ -199,10 +199,10 @@ ActivateAI = function()
ParadropDelays = ParadropDelays[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)
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()
end
end)

View File

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

View File

@@ -83,11 +83,11 @@ SendAttackGroup = function()
end
ProduceInfantry = function()
if USSRRax.IsDead or USSRRax.Owner ~= ussr then
if USSRRax.IsDead or USSRRax.Owner ~= USSR then
return
end
ussr.Build({ Utils.Random(SovietInfantry) }, function(units)
USSR.Build({ Utils.Random(SovietInfantry) }, function(units)
table.insert(AttackGroup, units[1])
SendAttackGroup()
Trigger.AfterDelay(ProductionInterval[Difficulty], ProduceInfantry)
@@ -95,11 +95,11 @@ ProduceInfantry = function()
end
ProduceVehicles = function()
if USSRWarFactory.IsDead or USSRWarFactory.Owner ~= ussr then
if USSRWarFactory.IsDead or USSRWarFactory.Owner ~= USSR then
return
end
ussr.Build({ Utils.Random(SovietVehicles) }, function(units)
USSR.Build({ Utils.Random(SovietVehicles) }, function(units)
table.insert(AttackGroup, units[1])
SendAttackGroup()
Trigger.AfterDelay(ProductionInterval[Difficulty], ProduceVehicles)
@@ -107,11 +107,11 @@ ProduceVehicles = function()
end
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
end
ussr.Build(SovietAircraftType, function(units)
USSR.Build(SovietAircraftType, function(units)
local mig = units[1]
Migs[#Migs + 1] = mig
@@ -122,13 +122,13 @@ ProduceAircraft = function()
Trigger.AfterDelay(DateTime.Seconds(ProductionInterval[Difficulty] / 2), ProduceAircraft)
end
InitializeAttackAircraft(mig, greece)
InitializeAttackAircraft(mig, Greece)
end)
end
GroundWaves = function()
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]
Utils.Do(units, function(unit)
Trigger.OnAddedToWorld(unit, function()
@@ -145,7 +145,7 @@ end
WTransWaves = function()
local way = Utils.Random(WTransWays)
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)
Trigger.OnAddedToWorld(a, function()
a.AttackMove(AttackChrono.Location)
@@ -169,15 +169,15 @@ end
SendParabombs = function()
local airfield = Airfield1
if Airfield1.IsDead or Airfield1.Owner ~= ussr then
if Airfield2.IsDead or Airfield2.Owner ~= ussr then
if Airfield1.IsDead or Airfield1.Owner ~= USSR then
if Airfield2.IsDead or Airfield2.Owner ~= USSR then
return
end
airfield = Airfield2
end
local targets = Utils.Where(greece.GetActors(), function(actor)
local targets = Utils.Where(Greece.GetActors(), function(actor)
return
actor.HasProperty("Sell") and
actor.Type ~= "brik" and
@@ -199,10 +199,10 @@ ActivateAI = function()
ParadropDelays = ParadropDelays[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)
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()
end
end)

View File

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

View File

@@ -7,7 +7,7 @@
information, see COPYING.
]]
lstReinforcements =
LstReinforcements =
{
actors = { "mcv" },
entryPath = { AlliedMCVEntry.Location, Unload1.Location },
@@ -28,7 +28,7 @@ KosyginContacted = false
InitialAlliedReinforcements = function()
Trigger.AfterDelay(DateTime.Seconds(1), function()
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

View File

@@ -93,7 +93,7 @@ end
LaunchMissiles = function()
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
Media.PlaySpeechNotification(Greece, "AbombLaunchDetected")
MissileSilo1.ActivateNukePower(CPos.New(127, 127))

View File

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

View File

@@ -46,7 +46,7 @@ Mig2Waypoints = { Mig21, Mig22, Mig23, Mig24 }
BindActorTriggers = function(a)
if a.HasProperty("Hunt") then
if a.Owner == allies then
if a.Owner == Allies then
Trigger.OnIdle(a, function(a)
if a.IsInWorld then
a.Hunt()
@@ -76,7 +76,7 @@ BindActorTriggers = function(a)
end
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)
BindActorTriggers(unit)
end)
@@ -85,7 +85,7 @@ end
SendMigs = function(waypoints)
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)
mig.Move(waypoints[3].Location)
mig.Move(waypoints[4].Location)
@@ -96,7 +96,7 @@ SendMigs = function(waypoints)
end
ShipAlliedUnits = function()
local units = Reinforcements.ReinforceWithTransport(allies, "lst",
local units = Reinforcements.ReinforceWithTransport(Allies, "lst",
ShipUnitTypes, { LstEntry.Location, LstUnload.Location }, { LstEntry.Location })[2]
Utils.Do(units, function(unit)
@@ -108,7 +108,7 @@ end
--- @param hpad actor
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]
Utils.Do(units, function(unit)
@@ -120,7 +120,7 @@ end
ParadropSovietUnits = function()
local lz = Utils.Random(ParadropWaypoints)
local aircraft = powerproxy.TargetParatroopers(lz.CenterPosition)
local aircraft = PowerProxy.TargetParatroopers(lz.CenterPosition)
Utils.Do(aircraft, function(a)
Trigger.OnPassengerExited(a, function(t, p)
@@ -143,7 +143,7 @@ end
SetupAlliedUnits = function()
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.Stance = "Defend"
end
@@ -160,7 +160,7 @@ ChronoshiftAlliedUnits = function()
local cells = Utils.ExpandFootprint({ ChronoshiftLocation.Location }, false)
local units = { }
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)
units[unit] = cells[i]
end
@@ -168,27 +168,27 @@ ChronoshiftAlliedUnits = function()
Trigger.AfterDelay(DateTime.Seconds(60), ChronoshiftAlliedUnits)
end
ticks = 0
speed = 5
Ticks = 0
Speed = 5
Tick = function()
ticks = ticks + 1
Ticks = Ticks + 1
local t = (ticks + 45) % (360 * speed) * (math.pi / 180) / speed;
Camera.Position = viewportOrigin + WVec.New(19200 * math.sin(t), 20480 * math.cos(t), 0)
local t = (Ticks + 45) % (360 * Speed) * (math.pi / 180) / Speed;
Camera.Position = ViewportOrigin + WVec.New(19200 * math.sin(t), 20480 * math.cos(t), 0)
end
WorldLoaded = function()
allies = Player.GetPlayer("Allies")
soviets = Player.GetPlayer("Soviets")
viewportOrigin = Camera.Position
Allies = Player.GetPlayer("Allies")
Soviets = Player.GetPlayer("Soviets")
ViewportOrigin = Camera.Position
SetupAlliedUnits()
SetupFactories()
ShipAlliedUnits()
InsertAlliedChinookReinforcements(Chinook1Entry, HeliPad1)
InsertAlliedChinookReinforcements(Chinook2Entry, HeliPad2)
powerproxy = Actor.Create(ProxyType, false, { Owner = soviets })
PowerProxy = Actor.Create(ProxyType, false, { Owner = Soviets })
ParadropSovietUnits()
Trigger.AfterDelay(DateTime.Seconds(5), ChronoshiftAlliedUnits)
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" }
SpawnAlliedReinforcements = function()
if allies2.IsLocalPlayer then
if Allies2.IsLocalPlayer then
UserInterface.SetMissionText("")
Media.PlaySpeechNotification(allies2, "AlliedReinforcementsArrived")
Media.PlaySpeechNotification(Allies2, "AlliedReinforcementsArrived")
end
Reinforcements.Reinforce(allies2, ReinforcementsUnits, { ReinforcementsEntryPoint.Location, Allies2BasePoint.Location })
Reinforcements.Reinforce(Allies2, ReinforcementsUnits, { ReinforcementsEntryPoint.Location, Allies2BasePoint.Location })
end
Yak = nil
YakAttack = function()
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)
if (#targets > 0) then
@@ -106,7 +106,7 @@ SovietTownAttack = function()
end
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(ParabombPoint2.CenterPosition, (Map.CenterOfCell(BadgerEntryPoint2.Location + CVec.New(0, 3)) - ParabombPoint2.CenterPosition).Facing)
proxy.Destroy()
@@ -114,7 +114,7 @@ end
SendParatroopers = function()
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 dir = target - Map.CenterOfCell(para.entry)
@@ -143,11 +143,11 @@ SendAttackGroup = function()
end
ProduceInfantry = function()
if SovietBarracks.IsDead or SovietBarracks.Owner ~= soviets then
if SovietBarracks.IsDead or SovietBarracks.Owner ~= Soviets then
return
end
soviets.Build({ Utils.Random(SovietInfantry) }, function(units)
Soviets.Build({ Utils.Random(SovietInfantry) }, function(units)
table.insert(AttackGroup, units[1])
SendAttackGroup()
Trigger.AfterDelay(ProductionInterval[Difficulty], ProduceInfantry)
@@ -155,11 +155,11 @@ ProduceInfantry = function()
end
ProduceVehicles = function()
if SovietWarFactory.IsDead or SovietWarFactory.Owner ~= soviets then
if SovietWarFactory.IsDead or SovietWarFactory.Owner ~= Soviets then
return
end
soviets.Build({ Utils.Random(SovietVehicles[SovietVehicleType]) }, function(units)
Soviets.Build({ Utils.Random(SovietVehicles[SovietVehicleType]) }, function(units)
table.insert(AttackGroup, units[1])
SendAttackGroup()
Trigger.AfterDelay(ProductionInterval[Difficulty], ProduceVehicles)
@@ -168,7 +168,7 @@ end
NumBaseBuildings = function()
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)
return #buildings
@@ -176,18 +176,18 @@ end
Tick = function()
if DateTime.GameTime > 1 and DateTime.GameTime % 25 == 0 and NumBaseBuildings() == 0 then
allies2.MarkFailedObjective(objHoldPosition)
Allies2.MarkFailedObjective(HoldPositionObjective)
end
if not allies2.IsObjectiveCompleted(objCutSovietPower) and soviets.PowerState ~= "Normal" then
allies2.MarkCompletedObjective(objCutSovietPower)
if not Allies2.IsObjectiveCompleted(CutSovietPowerObjective) and Soviets.PowerState ~= "Normal" then
Allies2.MarkCompletedObjective(CutSovietPowerObjective)
end
if not allies2.IsObjectiveCompleted(objLimitLosses) and allies2.UnitsLost > DeathThreshold[Difficulty] then
allies2.MarkFailedObjective(objLimitLosses)
if not Allies2.IsObjectiveCompleted(LimitLossesObjective) and Allies2.UnitsLost > DeathThreshold[Difficulty] then
Allies2.MarkFailedObjective(LimitLossesObjective)
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
local time = Utils.FormatTime(ReinforcementsDelay - DateTime.GameTime)
local timer = UserInterface.Translate("allied-reinforcements-arrive-in", { ["time"] = time })
@@ -199,21 +199,21 @@ Tick = function()
end
SetupSoviets = function()
soviets.Cash = 1000
Soviets.Cash = 1000
if Difficulty == "easy" then
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()
camera.Destroy()
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)
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()
end
end)
@@ -233,43 +233,43 @@ end
SetupTriggers = function()
Trigger.OnKilled(Tanya, function()
allies1.MarkFailedObjective(objTanyaMustSurvive)
Allies1.MarkFailedObjective(TanyaMustSurviveObjective)
end)
Trigger.OnAllKilledOrCaptured(Sams, function()
allies1.MarkCompletedObjective(objDestroySamSites)
objExtractEinstein = AddPrimaryObjective(allies1, "wait-for-helicopter-extract-einstein")
Actor.Create("flare", true, { Owner = allies1, Location = ExtractionLZ.Location + CVec.New(1, -1) })
Beacon.New(allies1, ExtractionLZ.CenterPosition)
Media.PlaySpeechNotification(allies1, "SignalFlareNorth")
Allies1.MarkCompletedObjective(DestroySamSitesObjective)
ExtractEinsteinObjective = AddPrimaryObjective(Allies1, "wait-for-helicopter-extract-einstein")
Actor.Create("flare", true, { Owner = Allies1, Location = ExtractionLZ.Location + CVec.New(1, -1) })
Beacon.New(Allies1, ExtractionLZ.CenterPosition)
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()
allies1.MarkFailedObjective(objExtractEinstein)
Allies1.MarkFailedObjective(ExtractEinsteinObjective)
end)
Trigger.OnPassengerEntered(ExtractionHeli, function(heli, passenger)
if passenger == Einstein then
heli.Move(ExtractionLZEntryPoint.Location)
heli.Destroy()
Trigger.OnRemovedFromWorld(heli, function()
allies2.MarkCompletedObjective(objLimitLosses)
allies2.MarkCompletedObjective(objHoldPosition)
allies1.MarkCompletedObjective(objTanyaMustSurvive)
allies1.MarkCompletedObjective(objEinsteinSurvival)
allies1.MarkCompletedObjective(objExtractEinstein)
Allies2.MarkCompletedObjective(LimitLossesObjective)
Allies2.MarkCompletedObjective(HoldPositionObjective)
Allies1.MarkCompletedObjective(TanyaMustSurviveObjective)
Allies1.MarkCompletedObjective(EinsteinSurvivalObjective)
Allies1.MarkCompletedObjective(ExtractEinsteinObjective)
end)
end
end)
end)
Trigger.OnEnteredProximityTrigger(TownPoint.CenterPosition, WDist.FromCells(15), function(actor, trigger)
if actor.Owner == allies1 then
ReassignActors(TownUnits, neutral, allies1)
if actor.Owner == Allies1 then
ReassignActors(TownUnits, Neutral, Allies1)
Utils.Do(TownUnits, function(a) a.Stance = "Defend" end)
allies1.MarkCompletedObjective(objFindEinstein)
objEinsteinSurvival = AddPrimaryObjective(allies1, "keep-einstein-alive-at-all-costs")
Allies1.MarkCompletedObjective(FindEinsteinObjective)
EinsteinSurvivalObjective = AddPrimaryObjective(Allies1, "keep-einstein-alive-at-all-costs")
Trigger.OnKilled(Einstein, function()
allies1.MarkFailedObjective(objEinsteinSurvival)
Allies1.MarkFailedObjective(EinsteinSurvivalObjective)
end)
Trigger.RemoveProximityTrigger(trigger)
SovietTownAttack()
@@ -277,11 +277,11 @@ SetupTriggers = function()
end)
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
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.CallFunc(YakAttack)
end)
@@ -292,9 +292,9 @@ SetupTriggers = function()
end
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()
Media.DisplayMessage(UserInterface.Translate("tanya-rules-of-engagement"), UserInterface.Translate("tanya"))
end)
@@ -311,46 +311,46 @@ ReassignActors = function(actors, from, to)
end
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 = Player.GetPlayer("Allies")
Allies = Player.GetPlayer("Allies")
-- 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 = 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
InitObjectives(player)
end
end)
if not allies2 or allies2.IsLocalPlayer then
if not Allies2 or Allies2.IsLocalPlayer then
Camera.Position = Allies2BasePoint.CenterPosition
else
Camera.Position = ChinookHusk.CenterPosition
end
if not allies2 then
allies2 = allies1
if not Allies2 then
Allies2 = Allies1
end
ReassignActors(Map.ActorsInWorld, allies, allies2)
ReassignActors(Map.ActorsInWorld, Allies, Allies2)
SpawnTanya()
objTanyaMustSurvive = AddPrimaryObjective(allies1, "tanya-survive")
objFindEinstein = AddPrimaryObjective(allies1, "find-einstein-crashed-helicopter")
objDestroySamSites = AddPrimaryObjective(allies1, "destroy-sam-sites")
TanyaMustSurviveObjective = AddPrimaryObjective(Allies1, "tanya-survive")
FindEinsteinObjective = AddPrimaryObjective(Allies1, "find-einstein-crashed-helicopter")
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] })
objLimitLosses = AddSecondaryObjective(allies2, dontLoseMoreThan)
objCutSovietPower = AddSecondaryObjective(allies2, "take-out-the-soviet-power-grid")
LimitLossesObjective = AddSecondaryObjective(Allies2, dontLoseMoreThan)
CutSovietPowerObjective = AddSecondaryObjective(Allies2, "take-out-the-soviet-power-grid")
SetupTriggers()
SetupSoviets()

View File

@@ -108,13 +108,13 @@ SovietUnits2 =
CurrentReinforcement1 = 0
CurrentReinforcement2 = 0
SpawnAlliedUnit = function(units)
Reinforcements.Reinforce(allies1, units, { Allies1EntryPoint.Location, Allies1MovePoint.Location })
Reinforcements.Reinforce(Allies1, units, { Allies1EntryPoint.Location, Allies1MovePoint.Location })
if allies2 then
Reinforcements.Reinforce(allies2, units, { Allies2EntryPoint.Location, Allies2MovePoint.Location })
if Allies2 then
Reinforcements.Reinforce(Allies2, units, { Allies2EntryPoint.Location, Allies2MovePoint.Location })
end
Utils.Do(humans, function(player)
Utils.Do(Humans, function(player)
Trigger.AfterDelay(DateTime.Seconds(2), function()
Media.PlaySpeechNotification(player, "AlliedReinforcementsNorth")
end)
@@ -148,11 +148,11 @@ SpawnSovietUnits = function()
local unitType = Utils.Random(units)
local spawnPoint = Utils.Random(SovietEntryPoints)
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)
IdleHunt(actor)
local delay = math.max(attackAtFrame - 5, minAttackAtFrame)
local delay = math.max(AttackAtFrame[Difficulty] - 5, MinAttackAtFrame[Difficulty])
Trigger.AfterDelay(delay, SpawnSovietUnits)
end
@@ -166,7 +166,7 @@ SendSovietParadrop = function()
SovietParadrop = SovietParadrop + 1
Utils.Do(humans, function(player)
Utils.Do(Humans, function(player)
Media.PlaySpeechNotification(player, "SovietForcesApproaching")
end)
@@ -176,16 +176,16 @@ SendSovietParadrop = function()
local randomParadropCell = CPos.New(x, y)
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.Destroy()
Trigger.AfterDelay(sovietParadropTicks, SendSovietParadrop)
Trigger.AfterDelay(SovietParadropTicks[Difficulty], SendSovietParadrop)
end
AircraftTargets = function(yak)
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)
-- Prefer mobile units
@@ -215,14 +215,14 @@ YakAttack = function(yak, target)
end
ManageSovietAircraft = function()
if allies1.IsObjectiveCompleted(destroyAirbases) then
if Allies1.IsObjectiveCompleted(DestroyAirbases) then
return
end
local maxSovietYaks = MaxSovietYaks[Difficulty]
local sovietYaks = soviets.GetActorsByType('yak')
local sovietYaks = Soviets.GetActorsByType('yak')
if #sovietYaks < maxSovietYaks then
soviets.Build(Yak, function(units)
Soviets.Build(Yak, function(units)
local yak = units[1]
YakAttack(yak)
end)
@@ -230,21 +230,21 @@ ManageSovietAircraft = function()
end
SetEvacuateMissionText = function()
local attributes = { ["evacuated"] = UnitsEvacuated, ["threshold"] = unitsEvacuatedThreshold }
local attributes = { ["evacuated"] = UnitsEvacuated, ["threshold"] = UnitsEvacuatedThreshold[Difficulty] }
local unitsEvacuated = UserInterface.Translate("units-evacuated", attributes)
UserInterface.SetMissionText(unitsEvacuated, TextColor)
end
UnitsEvacuated = 0
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.Owner = allies
unit.Owner = Allies
if unit.Type == 'mgg' then
Utils.Do(humans, function(player)
Utils.Do(Humans, function(player)
if player then
player.MarkCompletedObjective(evacuateMgg)
player.MarkCompletedObjective(EvacuateMgg)
end
end)
end
@@ -266,10 +266,10 @@ EvacuateAlliedUnit = function(unit)
SetEvacuateMissionText()
if UnitsEvacuated >= unitsEvacuatedThreshold then
Utils.Do(humans, function(player)
if UnitsEvacuated >= UnitsEvacuatedThreshold[Difficulty] then
Utils.Do(Humans, function(player)
if player then
player.MarkCompletedObjective(evacuateUnits)
player.MarkCompletedObjective(EvacuateUnits)
end
end)
end
@@ -280,9 +280,9 @@ Tick = function()
if DateTime.GameTime % 100 == 0 then
ManageSovietAircraft()
Utils.Do(humans, function(player)
Utils.Do(Humans, function(player)
if player and player.HasNoRequiredUnits() then
soviets.MarkCompletedObjective(sovietObjective)
Soviets.MarkCompletedObjective(SovietObjective)
end
end)
end
@@ -290,61 +290,56 @@ end
WorldLoaded = function()
-- NPC
neutral = Player.GetPlayer("Neutral")
allies = Player.GetPlayer("Allies")
soviets = Player.GetPlayer("Soviets")
Neutral = Player.GetPlayer("Neutral")
Allies = Player.GetPlayer("Allies")
Soviets = Player.GetPlayer("Soviets")
-- Player controlled
allies1 = Player.GetPlayer("Allies1")
allies2 = Player.GetPlayer("Allies2")
Allies1 = Player.GetPlayer("Allies1")
Allies2 = Player.GetPlayer("Allies2")
humans = { allies1, allies2 }
Utils.Do(humans, function(player)
Humans = { Allies1, Allies2 }
Utils.Do(Humans, function(player)
if player and player.IsLocalPlayer then
InitObjectives(player)
TextColor = player.Color
end
end)
unitsEvacuatedThreshold = UnitsEvacuatedThreshold[Difficulty]
SetEvacuateMissionText()
Utils.Do(humans, function(player)
Utils.Do(Humans, function(player)
if player then
evacuateUnits = AddPrimaryObjective(player, UserInterface.Translate("evacuate-units", { ["threshold"] = unitsEvacuatedThreshold }))
destroyAirbases = AddSecondaryObjective(player, "destroy-nearby-soviet-airbases")
evacuateMgg = AddSecondaryObjective(player, "evacuate-at-least-one-gap-generator")
EvacuateUnits = AddPrimaryObjective(player, UserInterface.Translate("evacuate-units", { ["threshold"] = UnitsEvacuatedThreshold[Difficulty] }))
DestroyAirbases = AddSecondaryObjective(player, "destroy-nearby-soviet-airbases")
EvacuateMgg = AddSecondaryObjective(player, "evacuate-at-least-one-gap-generator")
end
end)
Trigger.OnAllKilledOrCaptured(SovietAirfields, function()
Utils.Do(humans, function(player)
Utils.Do(Humans, function(player)
if player then
player.MarkCompletedObjective(destroyAirbases)
player.MarkCompletedObjective(DestroyAirbases)
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
else
Camera.Position = Allies2EntryPoint.CenterPosition
end
if not allies2 then
allies1.Cash = 10000
if not Allies2 then
Allies1.Cash = 10000
Media.DisplayMessage(UserInterface.Translate("transferring-funds"), UserInterface.Translate("co-commander-missing"))
end
SpawnAlliedUnit(MobileConstructionVehicle)
minAttackAtFrame = MinAttackAtFrame[Difficulty]
attackAtFrame = AttackAtFrame[Difficulty]
Trigger.AfterDelay(attackAtFrame, SpawnSovietUnits)
sovietParadropTicks = SovietParadropTicks[Difficulty]
Trigger.AfterDelay(sovietParadropTicks, SendSovietParadrop)
Trigger.AfterDelay(AttackAtFrame[Difficulty], SpawnSovietUnits)
Trigger.AfterDelay(SovietParadropTicks[Difficulty], SendSovietParadrop)
Trigger.OnEnteredFootprint(MountainEntry, 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"
ExtractionPath = { ChinookEntry.Location, ExtractionPoint.Location }
lstReinforcements =
LstReinforcements =
{
first =
{
@@ -241,7 +241,7 @@ FootprintTriggers = function()
Trigger.RemoveFootprintTrigger(id)
foot6Triggered = true
local reinforcement = lstReinforcements.first
local reinforcement = LstReinforcements.first
Media.PlaySpeechNotification(Allies, "ReinforcementsArrived")
Reinforcements.ReinforceWithTransport(Allies, "lst.reinforcement", reinforcement.actors, reinforcement.entryPath, reinforcement.exitPath)
end
@@ -349,7 +349,7 @@ FootprintTriggers = function()
trig11camera.Destroy()
end)
local reinforcement = lstReinforcements.second
local reinforcement = LstReinforcements.second
Media.PlaySpeechNotification(Allies, "ReinforcementsArrived")
Reinforcements.ReinforceWithTransport(Allies, "lst.reinforcement", reinforcement.actors, reinforcement.entryPath, reinforcement.exitPath)
end

View File

@@ -47,7 +47,7 @@ end
InitialInfantryProduction = function(id, units)
local productionComplete = AIPlayers[id].Build(units, function(actors)
InfantryProduction(id)
ProduceInfantry(id)
end)
Trigger.OnProduction(AIBarracks[id], function(producer, produced)
@@ -55,13 +55,13 @@ InitialInfantryProduction = function(id, units)
end)
end
InfantryProduction = function(id)
ProduceInfantry = function(id)
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)
if not productionComplete then
Trigger.AfterDelay(0, function() InfantryProduction(id) end)
Trigger.AfterDelay(0, function() ProduceInfantry(id) end)
end
end

View File

@@ -100,7 +100,7 @@ IdleHunt = function(actor)
end
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
Trigger.OnIdle(a, function(a)
a.Move(targetCell)
@@ -140,7 +140,7 @@ SendWave = function()
end)
end
Utils.Do(players, function(player)
Utils.Do(Players, function(player)
Media.PlaySpeechNotification(player, "EnemyUnitsApproaching")
end)
@@ -174,7 +174,7 @@ end
SovietsRetreating = function()
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()
end
end)
@@ -201,7 +201,7 @@ Tick = function()
end
SetupWallOwners = function()
Utils.Do(players, function(player)
Utils.Do(Players, function(player)
Utils.Do(Walls[player.Spawn], function(wall)
wall.Owner = player
end)
@@ -209,14 +209,14 @@ SetupWallOwners = function()
end
WorldLoaded = function()
soviets = Player.GetPlayer("Soviets")
players = { }
Soviets = Player.GetPlayer("Soviets")
Players = { }
for i = 0, 4 do
local player = Player.GetPlayer("Multi" ..i)
players[i] = player
Players[i] = player
if players[i] and players[i].IsBot then
ActivateAI(players[i], i)
if Players[i] and Players[i].IsBot then
ActivateAI(Players[i], i)
end
end
@@ -224,6 +224,6 @@ WorldLoaded = function()
SetupWallOwners()
ParaProxy = Actor.Create("powerproxy.paratroopers", false, { Owner = soviets })
ParaProxy = Actor.Create("powerproxy.paratroopers", false, { Owner = Soviets })
SendWave()
end

View File

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

View File

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

View File

@@ -62,7 +62,7 @@ GroundPatrolUnits =
}
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))
Utils.Do(aircraft, function(a)
Trigger.OnPassengerExited(a, function(t, p)
@@ -81,7 +81,7 @@ AirRaid = function(planeTypes, ingress, target)
for i = 1, #planeTypes do
Trigger.AfterDelay((i - 1) * DateTime.Seconds(1), function()
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)
plane.Attack(target)
@@ -91,7 +91,7 @@ end
BaseRaid = function()
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)
if #targets == 0 then
@@ -163,7 +163,7 @@ BaseRearAttack = function(team)
end
Build = function(units, action)
if not soviets.Build(units, action) then
if not Soviets.Build(units, action) then
Trigger.AfterDelay(DateTime.Seconds(15), function()
Build(units, action)
end)
@@ -185,9 +185,9 @@ SetupWorld = function()
end)
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)
if building.Owner == soviets then
if building.Owner == Soviets then
building.StartBuildingRepairs()
end
end)
@@ -227,12 +227,12 @@ end
Tick = function()
if DateTime.GameTime > 2 then
if soviets.Resources > soviets.ResourceCapacity * 0.75 then
soviets.Resources = soviets.Resources - ((soviets.ResourceCapacity * 0.01) / 25)
if Soviets.Resources > Soviets.ResourceCapacity * 0.75 then
Soviets.Resources = Soviets.Resources - ((Soviets.ResourceCapacity * 0.01) / 25)
end
if player.HasNoRequiredUnits() then
player.MarkFailedObjective(villageObjective)
if Allies.HasNoRequiredUnits() then
Allies.MarkFailedObjective(VillageObjective)
end
if CachedVillagePercentage ~= VillagePercentage then
@@ -244,43 +244,43 @@ Tick = function()
end
WorldLoaded = function()
player = Player.GetPlayer("Allies")
soviets = Player.GetPlayer("Soviets")
Allies = Player.GetPlayer("Allies")
Soviets = Player.GetPlayer("Soviets")
InitObjectives(player)
InitObjectives(Allies)
sovietObjective = AddPrimaryObjective(soviets, "")
villageObjective = AddPrimaryObjective(player, "save-village")
beachheadObjective = AddPrimaryObjective(player, "mcv-main-island")
SovietObjective = AddPrimaryObjective(Soviets, "")
VillageObjective = AddPrimaryObjective(Allies, "save-village")
BeachheadObjective = AddPrimaryObjective(Allies, "mcv-main-island")
beachheadTrigger = false
BeachheadTriggered = false
Trigger.OnExitedFootprint(BeachheadTrigger, function(a, id)
if not beachheadTrigger and a.Owner == player and a.Type == "mcv" then
beachheadTrigger = true
if not BeachheadTriggered and a.Owner == Allies and a.Type == "mcv" then
BeachheadTriggered = true
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
player.MarkFailedObjective(captureObjective)
Allies.MarkFailedObjective(CaptureObjective)
return
end
if AirForceHQ.Owner == player then
player.MarkCompletedObjective(captureObjective)
player.MarkCompletedObjective(villageObjective)
if AirForceHQ.Owner == Allies then
Allies.MarkCompletedObjective(CaptureObjective)
Allies.MarkCompletedObjective(VillageObjective)
return
end
Trigger.OnCapture(AirForceHQ, function()
Trigger.AfterDelay(DateTime.Seconds(3), function()
player.MarkCompletedObjective(captureObjective)
player.MarkCompletedObjective(villageObjective)
Allies.MarkCompletedObjective(CaptureObjective)
Allies.MarkCompletedObjective(VillageObjective)
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()
Build(BaseFrontAttackUnits, BaseFrontAttack)
@@ -301,7 +301,7 @@ WorldLoaded = function()
end
end)
Trigger.OnAllKilled(Village, function() player.MarkFailedObjective(villageObjective) end)
Trigger.OnAllKilled(Village, function() Allies.MarkFailedObjective(VillageObjective) end)
SetupWorld()
SetupMissionText()
@@ -311,7 +311,7 @@ WorldLoaded = function()
Trigger.AfterDelay(1, function() Build(UBoatPatrolUnits, SendUboatPatrol) 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()
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) }
EvacuateCivilians = function()
local evacuees = Reinforcements.Reinforce(neutral, CivilianEvacuees, { HospitalCivilianSpawnPoint.Location }, 0)
local evacuees = Reinforcements.Reinforce(Neutral, CivilianEvacuees, { HospitalCivilianSpawnPoint.Location }, 0)
Trigger.OnAnyKilled(evacuees, function()
player.MarkFailedObjective(RescueCivilians)
Greece.MarkFailedObjective(RescueCivilians)
end)
Trigger.OnAllRemovedFromWorld(evacuees, function()
player.MarkCompletedObjective(RescueCivilians)
Greece.MarkCompletedObjective(RescueCivilians)
end)
Utils.Do(evacuees, function(civ)
@@ -51,33 +51,33 @@ EvacuateCivilians = function()
end
SpawnAndMoveAlliedBaseUnits = function()
Media.PlaySpeechNotification(player, "ReinforcementsArrived")
Reinforcements.Reinforce(player, ReinforceBaseUnits, { AlliedBaseEntryPoint.Location, AlliedBaseMovePoint.Location }, 18)
Media.PlaySpeechNotification(Greece, "ReinforcementsArrived")
Reinforcements.Reinforce(Greece, ReinforceBaseUnits, { AlliedBaseEntryPoint.Location, AlliedBaseMovePoint.Location }, 18)
end
SetupAlliedBase = function()
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)
building.Owner = player
building.Owner = Greece
end)
AlliedBaseHarv.Owner = player
AlliedBaseHarv.Owner = Greece
AlliedBaseHarv.FindResources()
FindDemitri = AddPrimaryObjective(player, "find-demitri")
InfiltrateRadarDome = AddPrimaryObjective(player, "reprogram-super-tanks")
DefendOutpost = AddSecondaryObjective(player, "defend-outpost")
player.MarkCompletedObjective(FindOutpost)
FindDemitri = AddPrimaryObjective(Greece, "find-demitri")
InfiltrateRadarDome = AddPrimaryObjective(Greece, "reprogram-super-tanks")
DefendOutpost = AddSecondaryObjective(Greece, "defend-outpost")
Greece.MarkCompletedObjective(FindOutpost)
-- Don't fail the Objective instantly
Trigger.AfterDelay(DateTime.Seconds(1), function()
-- The actor might have been destroyed/crushed in this one second delay
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)
Trigger.AfterDelay(DateTime.Minutes(1) + DateTime.Seconds(40), function()
@@ -111,10 +111,10 @@ SendAlliedUnits = function()
Camera.Position = StartEntryPoint.CenterPosition
Media.PlaySpeechNotification(player, "ReinforcementsArrived")
Media.PlaySpeechNotification(Greece, "ReinforcementsArrived")
Utils.Do(AlliedUnits, function(table)
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)
if unit.Type == "e6" then
@@ -122,7 +122,7 @@ SendAlliedUnits = function()
Trigger.OnKilled(unit, LandingPossible)
elseif unit.Type == "thf" then
Trigger.OnKilled(unit, function()
player.MarkFailedObjective(StealMoney)
Greece.MarkFailedObjective(StealMoney)
end)
end
end)
@@ -133,15 +133,15 @@ SendAlliedUnits = function()
end
LandingPossible = function()
if not beachReached and (USSRSpen.IsDead or Engineer.IsDead) and LstProduced < 1 then
player.MarkFailedObjective(CrossRiver)
if not BeachReached and (USSRSpen.IsDead or Engineer.IsDead) and LstProduced < 1 then
Greece.MarkFailedObjective(CrossRiver)
end
end
SuperTankDomeInfiltrated = function()
SuperTankAttack = true
Utils.Do(SuperTanks, function(tnk)
tnk.Owner = friendlyMadTanks
tnk.Owner = FriendlyMadTanks
if not tnk.IsDead then
tnk.GrantCondition("friendly")
Trigger.ClearAll(tnk)
@@ -169,29 +169,29 @@ SuperTankDomeInfiltrated = function()
end
end)
player.MarkCompletedObjective(InfiltrateRadarDome)
Greece.MarkCompletedObjective(InfiltrateRadarDome)
Trigger.AfterDelay(DateTime.Minutes(3), SuperTanksDestruction)
ticked = DateTime.Minutes(3)
Ticked = DateTime.Minutes(3)
Trigger.AfterDelay(DateTime.Seconds(2), function()
Media.PlaySpeechNotification(player, "ControlCenterDeactivated")
Media.PlaySpeechNotification(Greece, "ControlCenterDeactivated")
Trigger.AfterDelay(DateTime.Seconds(4), function()
Media.DisplayMessage(UserInterface.Translate("super-tank-self-destruct-t-minus-3"))
Media.PlaySpeechNotification(player, "WarningThreeMinutesRemaining")
Media.PlaySpeechNotification(Greece, "WarningThreeMinutesRemaining")
end)
end)
end
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)
unit.Kill()
end)
Utils.Do(SuperTanks, function(tnk)
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.ClearAll(tnk)
@@ -199,31 +199,31 @@ SuperTanksDestruction = function()
end
end)
player.MarkCompletedObjective(DefendOutpost)
Greece.MarkCompletedObjective(DefendOutpost)
end
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)
Media.PlaySpeechNotification(player, "TargetFreed")
EvacuateDemitri = AddPrimaryObjective(player, "evacuate-demitri")
player.MarkCompletedObjective(FindDemitri)
Media.PlaySpeechNotification(Greece, "TargetFreed")
EvacuateDemitri = AddPrimaryObjective(Greece, "evacuate-demitri")
Greece.MarkCompletedObjective(FindDemitri)
local flarepos = CPos.New(DemitriLZ.Location.X, DemitriLZ.Location.Y - 1)
local demitriLZFlare = Actor.Create("flare", true, { Owner = player, Location = flarepos })
Trigger.AfterDelay(DateTime.Seconds(3), function() Media.PlaySpeechNotification(player, "SignalFlareNorth") end)
local demitriLZFlare = Actor.Create("flare", true, { Owner = Greece, Location = flarepos })
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()
player.MarkFailedObjective(EvacuateDemitri)
Greece.MarkFailedObjective(EvacuateDemitri)
end)
Trigger.OnRemovedFromWorld(demitriChinook, function()
if not demitriChinook.IsDead then
Media.PlaySpeechNotification(player, "TargetRescued")
Trigger.AfterDelay(DateTime.Seconds(1), function() player.MarkCompletedObjective(EvacuateDemitri) end)
Media.PlaySpeechNotification(Greece, "TargetRescued")
Trigger.AfterDelay(DateTime.Seconds(1), function() Greece.MarkCompletedObjective(EvacuateDemitri) end)
Trigger.AfterDelay(DateTime.Seconds(3), SpawnAndMoveAlliedBaseUnits)
end
end)
@@ -236,27 +236,27 @@ CreateDemitri = function()
end)
end
ticked = -1
Ticked = -1
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 not DemitriFound or not SuperTankDomeIsInfiltrated then
if player.HasNoRequiredUnits() then
player.MarkFailedObjective(EliminateSuperTanks)
if Greece.HasNoRequiredUnits() then
Greece.MarkFailedObjective(EliminateSuperTanks)
end
end
end
if ticked > 0 then
if (ticked % DateTime.Seconds(1)) == 0 then
Timer = UserInterface.Translate("super-tank-self-destruct-in", { ["time"] = Utils.FormatTime(ticked) })
if Ticked > 0 then
if (Ticked % DateTime.Seconds(1)) == 0 then
Timer = UserInterface.Translate("super-tank-self-destruct-in", { ["time"] = Utils.FormatTime(Ticked) })
UserInterface.SetMissionText(Timer, TimerColor)
end
ticked = ticked - 1
elseif ticked == 0 then
Ticked = Ticked - 1
elseif Ticked == 0 then
FinishTimer()
ticked = ticked - 1
Ticked = Ticked - 1
end
end
@@ -273,67 +273,67 @@ FinishTimer = function()
end
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
TimerColor = player.Color
TimerColor = Greece.Color
Trigger.AfterDelay(DateTime.Seconds(12), function()
Media.PlaySpeechNotification(player, "StartGame")
Media.PlaySpeechNotification(Greece, "StartGame")
Trigger.AfterDelay(DateTime.Seconds(2), SendAlliedUnits)
end)
end
InitPlayers = function()
player = Player.GetPlayer("Greece")
neutral = Player.GetPlayer("Neutral")
outpost = Player.GetPlayer("Outpost")
badguy = Player.GetPlayer("BadGuy")
ussr = Player.GetPlayer("USSR")
ukraine = Player.GetPlayer("Ukraine")
turkey = Player.GetPlayer("Turkey")
friendlyMadTanks = Player.GetPlayer("FriendlyMadTanks")
Greece = Player.GetPlayer("Greece")
Neutral = Player.GetPlayer("Neutral")
Outpost = Player.GetPlayer("Outpost")
BadGuy = Player.GetPlayer("BadGuy")
USSR = Player.GetPlayer("USSR")
Ukraine = Player.GetPlayer("Ukraine")
Turkey = Player.GetPlayer("Turkey")
FriendlyMadTanks = Player.GetPlayer("FriendlyMadTanks")
ussr.Cash = 2000
Trigger.AfterDelay(0, function() badguy.Resources = badguy.ResourceCapacity * 0.75 end)
USSR.Cash = 2000
Trigger.AfterDelay(0, function() BadGuy.Resources = BadGuy.ResourceCapacity * 0.75 end)
end
AddObjectives = function()
InitObjectives(player)
InitObjectives(Greece)
EliminateSuperTanks = AddPrimaryObjective(player, "eliminate-super-tanks")
StealMoney = AddPrimaryObjective(player, "steal-money-outpost")
CrossRiver = AddPrimaryObjective(player, "cross-river")
FindOutpost = AddPrimaryObjective(player, "find-outpost")
RescueCivilians = AddSecondaryObjective(player, "evacuate-civilian-hospital")
BadGuyObj = AddPrimaryObjective(badguy, "")
USSRObj = AddPrimaryObjective(ussr, "")
UkraineObj = AddPrimaryObjective(ukraine, "")
TurkeyObj = AddPrimaryObjective(turkey, "")
EliminateSuperTanks = AddPrimaryObjective(Greece, "eliminate-super-tanks")
StealMoney = AddPrimaryObjective(Greece, "steal-money-outpost")
CrossRiver = AddPrimaryObjective(Greece, "cross-river")
FindOutpost = AddPrimaryObjective(Greece, "find-outpost")
RescueCivilians = AddSecondaryObjective(Greece, "evacuate-civilian-hospital")
BadGuyObj = AddPrimaryObjective(BadGuy, "")
USSRObj = AddPrimaryObjective(USSR, "")
UkraineObj = AddPrimaryObjective(Ukraine, "")
TurkeyObj = AddPrimaryObjective(Turkey, "")
Trigger.OnPlayerLost(player, function()
ussr.MarkCompletedObjective(USSRObj)
badguy.MarkCompletedObjective(BadGuyObj)
ukraine.MarkCompletedObjective(UkraineObj)
turkey.MarkCompletedObjective(TurkeyObj)
Trigger.OnPlayerLost(Greece, function()
USSR.MarkCompletedObjective(USSRObj)
BadGuy.MarkCompletedObjective(BadGuyObj)
Ukraine.MarkCompletedObjective(UkraineObj)
Turkey.MarkCompletedObjective(TurkeyObj)
end)
Trigger.OnPlayerWon(player, function()
Trigger.OnPlayerWon(Greece, function()
Media.DisplayMessage(UserInterface.Translate("demitri-extracted-super-tanks-destroyed"))
ussr.MarkFailedObjective(USSRObj)
badguy.MarkFailedObjective(BadGuyObj)
ukraine.MarkFailedObjective(UkraineObj)
turkey.MarkFailedObjective(TurkeyObj)
USSR.MarkFailedObjective(USSRObj)
BadGuy.MarkFailedObjective(BadGuyObj)
Ukraine.MarkFailedObjective(UkraineObj)
Turkey.MarkFailedObjective(TurkeyObj)
end)
end
InitTriggers = 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)
Trigger.OnKilled(SuperTankDome, function()
if not SuperTankDomeIsInfiltrated then
player.MarkFailedObjective(InfiltrateRadarDome)
Greece.MarkFailedObjective(InfiltrateRadarDome)
end
end)
Trigger.OnInfiltrated(SuperTankDome, function()
@@ -361,46 +361,46 @@ InitTriggers = function()
Trigger.OnKilled(DemitriChurch, function()
if not DemitriFound then
player.MarkFailedObjective(FindDemitri)
Greece.MarkFailedObjective(FindDemitri)
end
end)
Trigger.OnKilled(Hospital, function()
if not HospitalEvacuated then
HospitalEvacuated = true
player.MarkFailedObjective(RescueCivilians)
Greece.MarkFailedObjective(RescueCivilians)
end
end)
Trigger.OnInfiltrated(USSROutpostSilo, function()
MoneyStolen = true
player.MarkCompletedObjective(StealMoney)
Greece.MarkCompletedObjective(StealMoney)
end)
Trigger.OnKilledOrCaptured(USSROutpostSilo, function()
if not MoneyStolen then
player.MarkFailedObjective(StealMoney)
Greece.MarkFailedObjective(StealMoney)
end
end)
beachReached = false
BeachReached = false
Trigger.OnEnteredFootprint(BeachTrigger, function(a, id)
if not beachReached and a.Owner == player then
beachReached = true
if not BeachReached and a.Owner == Greece then
BeachReached = true
Trigger.RemoveFootprintTrigger(id)
player.MarkCompletedObjective(CrossRiver)
Greece.MarkCompletedObjective(CrossRiver)
end
end)
Trigger.OnPlayerDiscovered(outpost, function(_, discoverer)
if not outpostReached and discoverer == player then
outpostReached = true
Trigger.OnPlayerDiscovered(Outpost, function(_, discoverer)
if not OutpostReached and discoverer == Greece then
OutpostReached = true
SetupAlliedBase()
end
end)
Trigger.OnEnteredFootprint(DemitriAreaTrigger, function(a, id)
if not DemitriFound and a.Owner == player then
if not DemitriFound and a.Owner == Greece then
DemitriFound = true
Trigger.RemoveFootprintTrigger(id)
CreateDemitri()
@@ -408,7 +408,7 @@ InitTriggers = function()
end)
Trigger.OnEnteredFootprint(HospitalAreaTrigger, function(a, id)
if not HospitalEvacuated and a.Owner == player then
if not HospitalEvacuated and a.Owner == Greece then
HospitalEvacuated = true
Trigger.RemoveFootprintTrigger(id)
EvacuateCivilians()

View File

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

View File

@@ -48,11 +48,11 @@ SendBGAttackGroup = function()
end
ProduceBadGuyInfantry = function()
if BadGuyRax.IsDead or BadGuyRax.Owner ~= badguy then
if BadGuyRax.IsDead or BadGuyRax.Owner ~= BadGuy then
return
end
badguy.Build({ Utils.Random(SovietInfantry) }, function(units)
BadGuy.Build({ Utils.Random(SovietInfantry) }, function(units)
table.insert(BGAttackGroup, units[1])
SendBGAttackGroup()
Trigger.AfterDelay(ProductionInterval[Difficulty], ProduceBadGuyInfantry)
@@ -74,11 +74,11 @@ SendAttackGroup = function()
end
ProduceUSSRInfantry = function()
if USSRRax.IsDead or USSRRax.Owner ~= ussr then
if USSRRax.IsDead or USSRRax.Owner ~= USSR then
return
end
ussr.Build({ Utils.Random(SovietInfantry) }, function(units)
USSR.Build({ Utils.Random(SovietInfantry) }, function(units)
table.insert(AttackGroup, units[1])
SendAttackGroup()
Trigger.AfterDelay(ProductionInterval[Difficulty], ProduceUSSRInfantry)
@@ -86,11 +86,11 @@ ProduceUSSRInfantry = function()
end
ProduceVehicles = function()
if USSRWarFactory.IsDead or USSRWarFactory.Owner ~= ussr then
if USSRWarFactory.IsDead or USSRWarFactory.Owner ~= USSR then
return
end
ussr.Build({ Utils.Random(SovietVehicles) }, function(units)
USSR.Build({ Utils.Random(SovietVehicles) }, function(units)
table.insert(AttackGroup, units[1])
SendAttackGroup()
Trigger.AfterDelay(ProductionInterval[Difficulty], ProduceVehicles)
@@ -98,7 +98,7 @@ ProduceVehicles = function()
end
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()
end)

View File

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

View File

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

View File

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

View File

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

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