Add bridge break, fixes to Soviet-06b

This commit is contained in:
JovialFeline
2023-12-17 00:40:08 -05:00
committed by Smittytron
parent 63247d2d11
commit ac610c54eb
5 changed files with 407 additions and 191 deletions

View File

@@ -140,7 +140,7 @@ WorldLoaded = function()
AlliedObjective = AddPrimaryObjective(Greece, "") AlliedObjective = AddPrimaryObjective(Greece, "")
SovietObjective = AddPrimaryObjective(USSR, "escort-convoy") SovietObjective = AddPrimaryObjective(USSR, "escort-convoy")
SovietObjective2 = AddSecondaryObjective(USSR, "destroy-capture-radar-dome-reinforcements") SovietObjective2 = AddSecondaryObjective(USSR, "destroy-capture-radar-dome-reinforcements")
SaveAllTrucks = AddSecondaryObjective(USSR, "Keep all trucks alive.") SaveAllTrucks = AddSecondaryObjective(USSR, "keep-trucks-alive")
end end
Tick = function() Tick = function()

View File

@@ -288,94 +288,98 @@ Actors:
Location: 57,46 Location: 57,46
Owner: Greece Owner: Greece
Facing: 640 Facing: 640
TurretFacing: 768
Actor93: gun Actor93: gun
Location: 61,48 Location: 61,48
Owner: Greece Owner: Greece
Facing: 640 Facing: 640
TurretFacing: 768
Actor103: 2tnk Actor103: 2tnk
Location: 76,30 Location: 76,30
Owner: Greece Owner: Greece
Facing: 640 Facing: 384
Actor104: 2tnk Actor104: 2tnk
Location: 76,29 Location: 76,29
Owner: Greece Owner: Greece
Facing: 640 Facing: 384
Actor106: arty Actor106: arty
Location: 63,47 Location: 64,46
Owner: Greece Owner: Greece
Facing: 640 Facing: 384
Stance: Defend
Actor107: arty Actor107: arty
Location: 58,44 Location: 58,44
Owner: Greece Owner: Greece
Facing: 640 Facing: 384
Stance: Defend
Actor110: 3tnk Actor110: 3tnk
Location: 43,63 Location: 43,63
Owner: USSR Owner: USSR
Facing: 128 Facing: 896
Actor111: 3tnk Actor111: 3tnk
Location: 44,62 Location: 44,62
Owner: USSR Owner: USSR
Facing: 128 Facing: 896
Actor112: v2rl Actor112: v2rl
Location: 41,64 Location: 41,64
Owner: USSR Owner: USSR
Facing: 128 Facing: 896
Actor113: v2rl Actor113: v2rl
Location: 43,64 Location: 43,64
Owner: USSR Owner: USSR
Facing: 128 Facing: 896
Actor115: 2tnk Actor115: 2tnk
Location: 75,30 Location: 75,30
Owner: Greece Owner: Greece
Facing: 640 Facing: 384
Actor116: 2tnk Actor116: 2tnk
Location: 75,31 Location: 75,31
Owner: Greece Owner: Greece
Facing: 640 Facing: 384
Actor117: 2tnk Actor117: 2tnk
Location: 83,20 Location: 83,19
Owner: Greece Owner: Greece
Facing: 640 Facing: 384
Actor118: 2tnk Actor118: 2tnk
Location: 88,21 Location: 88,21
Owner: Greece Owner: Greece
Facing: 640 Facing: 384
Actor119: 2tnk Actor119: 2tnk
Location: 62,44 Location: 62,44
Owner: Greece Owner: Greece
Facing: 640 Facing: 384
Actor120: 1tnk Actor120: 1tnk
Location: 59,44 Location: 59,44
Owner: Greece Owner: Greece
Facing: 640 Facing: 384
Actor121: 1tnk Actor121: 1tnk
Location: 63,46 Location: 63,46
Owner: Greece Owner: Greece
Facing: 640 Facing: 384
Actor123: ca BridgeBreaker: ca
Location: 87,29 Location: 87,29
Owner: Greece Owner: Greece
Facing: 896 Facing: 128
Actor124: ca BridgeBreaker2: ca
Location: 87,31 Location: 87,31
Owner: Greece Owner: Greece
Facing: 640 Facing: 384
Actor125: ca ResponseCruiser: ca
Location: 75,25 Location: 75,25
Owner: Greece Owner: Greece
Facing: 896 Facing: 128
Actor126: pt Actor126: pt
Location: 71,16 Location: 71,16
Owner: Greece Owner: Greece
Facing: 896 Facing: 128
Actor127: pt Actor127: pt
Location: 65,20 Location: 65,20
Owner: Greece Owner: Greece
Facing: 896 Facing: 128
Actor128: dd Actor128: dd
Location: 70,20 Location: 70,20
Owner: Greece Owner: Greece
Facing: 896 Facing: 128
Actor129: waypoint Actor129: waypoint
Location: 46,60 Location: 46,60
Owner: Neutral Owner: Neutral
@@ -437,7 +441,7 @@ Actors:
AttackWaypoint2: waypoint AttackWaypoint2: waypoint
Owner: Neutral Owner: Neutral
Location: 41,55 Location: 41,55
Barr: tent Tent: tent
Location: 67,45 Location: 67,45
Owner: Greece Owner: Greece
CameraStart: camera CameraStart: camera
@@ -470,20 +474,20 @@ Actors:
IntroEnemy1: 1tnk IntroEnemy1: 1tnk
Location: 55,49 Location: 55,49
Owner: Greece Owner: Greece
Facing: 640 Facing: 384
IntroEnemy2: 2tnk IntroEnemy2: 2tnk
Location: 56,50 Location: 56,50
Owner: Greece Owner: Greece
Facing: 640 Facing: 384
IntroEnemy3: 1tnk IntroEnemy3: 1tnk
Location: 58,50 Location: 58,50
Owner: Greece Owner: Greece
Facing: 640 Facing: 384
Mcv: mcv Mcv: mcv
Location: 51,55 Location: 51,55
Owner: USSR Owner: USSR
Health: 82 Health: 82
Facing: 640 Facing: 384
McvWaypoint: waypoint McvWaypoint: waypoint
Location: 39,67 Location: 39,67
Owner: Neutral Owner: Neutral
@@ -494,11 +498,11 @@ Actors:
Truck1: truk Truck1: truk
Location: 42,66 Location: 42,66
Owner: USSR Owner: USSR
Facing: 128 Facing: 896
Truck2: truk Truck2: truk
Location: 39,65 Location: 39,65
Owner: USSR Owner: USSR
Facing: 128 Facing: 896
Weap: weap Weap: weap
Location: 67,41 Location: 67,41
Owner: Greece Owner: Greece

View File

@@ -6,29 +6,117 @@
the License, or (at your option) any later version. For more the License, or (at your option) any later version. For more
information, see COPYING. information, see COPYING.
]] ]]
IdlingUnits = function() InfAttack = { }
local lazyUnits = Greece.GetGroundAttackers() ArmorAttack = { }
AttackPaths = { { AttackWaypoint1.Location }, { AttackWaypoint2.Location } }
Utils.Do(lazyUnits, function(unit) AlliedInfantryTypes = { "e1", "e1", "e3" }
Trigger.OnDamaged(unit, function() AlliedArmorTypes = { "jeep", "jeep", "1tnk", "1tnk", "2tnk", "2tnk", "arty" }
Trigger.ClearAll(unit)
Trigger.AfterDelay(0, function() IdleHunt(unit) end) ProduceInfantry = function(barracks)
end) if barracks.IsDead or barracks.Owner ~= Greece then
return
elseif GreeceMoney() <= 299 and IsHarvesterMissing() then
return
end
local delay = Utils.RandomInteger(DateTime.Seconds(3), DateTime.Seconds(9))
local toBuild = { Utils.Random(AlliedInfantryTypes) }
local path = Utils.Random(AttackPaths)
Greece.Build(toBuild, function(unit)
InfAttack[#InfAttack + 1] = unit[1]
if #InfAttack >= 10 then
SendUnits(InfAttack, path)
InfAttack = { }
Trigger.AfterDelay(DateTime.Minutes(2), function()
ProduceInfantry(barracks)
end)
else
Trigger.AfterDelay(delay, function()
ProduceInfantry(barracks)
end)
end
end) end)
end end
BaseApwr = { type = "apwr", pos = CVec.New(5, -9), cost = 500, exists = true } ProduceArmor = function(factory)
BaseTent = { type = "tent", pos = CVec.New(-4, -4), cost = 400, exists = true } if factory.IsDead or factory.Owner ~= Greece then
BaseProc = { type = "proc", pos = CVec.New(0, -8), cost = 1400, exists = true } return
BaseWeap = { type = "weap", pos = CVec.New(-4, -8), cost = 2000, exists = true } elseif IsHarvesterMissing() then
BaseApwr2 = { type = "apwr", pos = CVec.New(6, -5), cost = 500, exists = true } ProduceHarvester(factory)
return
end
BaseBuildings = { BaseApwr, BaseTent, BaseProc, BaseWeap, BaseApwr2 } local delay = Utils.RandomInteger(DateTime.Seconds(12), DateTime.Seconds(17))
local toBuild = { Utils.Random(AlliedArmorTypes) }
local path = Utils.Random(AttackPaths)
Greece.Build(toBuild, function(unit)
ArmorAttack[#ArmorAttack + 1] = unit[1]
if #ArmorAttack >= 6 then
SendUnits(ArmorAttack, path)
ArmorAttack = { }
Trigger.AfterDelay(DateTime.Minutes(3), function()
ProduceArmor(factory)
end)
else
Trigger.AfterDelay(delay, function()
ProduceArmor(factory)
end)
end
end)
end
ProduceHarvester = function(factory)
if GreeceMoney() < Actor.Cost("harv") then
return
end
local toBuild = { "harv" }
Greece.Build(toBuild, function(unit)
unit.FindResources()
ProduceArmor(factory)
end)
end
SendUnits = function(units, path)
Utils.Do(units, function(unit)
if unit.IsDead then
return
end
unit.Patrol(path, false)
IdleHunt(unit)
end)
end
IsHarvesterMissing = function()
return #Greece.GetActorsByType("harv") == 0
end
GreeceMoney = function()
return Greece.Cash + Greece.Resources
end
BaseBlueprints =
{
{ type = "apwr", actor = Apwr, cost = 500, shape = { 3, 3 }, location = CPos.New(76, 41) },
{ type = "tent", actor = Tent, cost = 400, shape = { 2, 3 }, location = CPos.New(67, 45), onBuilt = ProduceInfantry },
{ type = "proc", actor = Proc, cost = 1400, shape = { 3, 4 }, location = CPos.New(71, 41) },
{ type = "weap", actor = Weap, cost = 2000, shape = { 3, 3 }, location = CPos.New(67, 41), onBuilt = ProduceArmor },
{ type = "apwr", actor = Apwr2, cost = 500, shape = { 3, 3 }, location = CPos.New(77, 45) }
}
--[[
Similar to the original CnC/RA [BASE] and [STRUCTURES] .INI sections.
Check a list every so often and (re)build structures missing from
that list, in order, if circumstances allow for it.
]]
BuildBase = function() BuildBase = function()
for i,v in ipairs(BaseBuildings) do for _, blueprint in pairs(BaseBlueprints) do
if not v.exists then if not blueprint.actor then
BuildBuilding(v) BuildBlueprint(blueprint)
return return
end end
end end
@@ -36,82 +124,103 @@ BuildBase = function()
Trigger.AfterDelay(DateTime.Seconds(10), BuildBase) Trigger.AfterDelay(DateTime.Seconds(10), BuildBase)
end end
BuildBuilding = function(building) BuildBlueprint = function(blueprint)
Trigger.AfterDelay(Actor.BuildTime(building.type), function() Trigger.AfterDelay(Actor.BuildTime(blueprint.type), function()
if CYard.IsDead or CYard.Owner ~= Greece then if CYard.IsDead or CYard.Owner ~= Greece then
return return
elseif Harvester.IsDead and Greece.Resources <= 299 then elseif GreeceMoney() <= 299 and IsHarvesterMissing() then
return return
end end
local actor = Actor.Create(building.type, true, { Owner = Greece, Location = CYardLocation.Location + building.pos }) if IsBuildAreaBlocked(Greece, blueprint) then
Greece.Cash = Greece.Cash - building.cost Trigger.AfterDelay(DateTime.Seconds(5), function()
BuildBlueprint(blueprint)
end)
return
end
building.exists = true local actor = Actor.Create(blueprint.type, true, { Owner = Greece, Location = blueprint.location })
Trigger.OnKilled(actor, function() building.exists = false end) OnBlueprintBuilt(actor, blueprint)
Trigger.OnDamaged(actor, function(building)
if building.Owner == Greece and building.Health < building.MaxHealth * 3/4 then
building.StartBuildingRepairs()
end
end)
Trigger.AfterDelay(DateTime.Seconds(10), BuildBase) Trigger.AfterDelay(DateTime.Seconds(10), BuildBase)
end) end)
end end
ProduceInfantry = function() OnBlueprintBuilt = function(actor, blueprint)
if not BaseTent.exists then Greece.Cash = Greece.Cash - blueprint.cost
return blueprint.actor = actor
elseif Harvester.IsDead and Greece.Resources <= 299 then MaintainBuilding(actor, blueprint, 0.75)
return
if blueprint.onBuilt then
-- Build() will not work properly on producers if immediately called.
Trigger.AfterDelay(1, function()
blueprint.onBuilt(actor)
end)
end
end
IsBuildAreaBlocked = function(player, blueprint)
local nw, se = blueprint.northwestEdge, blueprint.southeastEdge
local blockers = Map.ActorsInBox(nw, se, function(actor)
-- Neutral check is for ignoring trees near the refinery.
return actor.Owner ~= Neutral and actor.CenterPosition.Z == 0 and actor.HasProperty("Health")
end)
if #blockers == 0 then
return false
end end
local delay = Utils.RandomInteger(DateTime.Seconds(3), DateTime.Seconds(9)) ScatterBlockers(player, blockers)
local toBuild = { Utils.Random(AlliedInfantryTypes) } return true
local Path = Utils.Random(AttackPaths) end
Greece.Build(toBuild, function(unit)
InfAttack[#InfAttack + 1] = unit[1]
if #InfAttack >= 10 then ScatterBlockers = function(player, actors)
SendUnits(InfAttack, Path) Utils.Do(actors, function(actor)
InfAttack = { } if actor.IsIdle and actor.Owner == player and actor.HasProperty("Scatter") then
Trigger.AfterDelay(DateTime.Minutes(2), ProduceInfantry) actor.Scatter()
else
Trigger.AfterDelay(delay, ProduceInfantry)
end end
end) end)
end end
ProduceArmor = function() BeginBaseMaintenance = function()
if not BaseWeap.exists then Utils.Do(BaseBlueprints, function(blueprint)
return MaintainBuilding(blueprint.actor, blueprint)
elseif Harvester.IsDead and Greece.Resources <= 599 then end)
return
Utils.Do(Greece.GetActors(), function(actor)
if actor.HasProperty("StartBuildingRepairs") then
MaintainBuilding(actor, nil, 0.75)
end
end)
end
MaintainBuilding = function(actor, blueprint, repairThreshold)
if blueprint then
Trigger.OnKilled(actor, function() blueprint.actor = nil end)
Trigger.OnSold(actor, function() blueprint.actor = nil end)
if not blueprint.northwestEdge then
PrepareBlueprintEdges(blueprint)
end
end end
local delay = Utils.RandomInteger(DateTime.Seconds(12), DateTime.Seconds(17)) if repairThreshold then
local toBuild = { Utils.Random(AlliedArmorTypes) } local original = actor.Owner
local Path = Utils.Random(AttackPaths)
Greece.Build(toBuild, function(unit)
ArmorAttack[#ArmorAttack + 1] = unit[1]
if #ArmorAttack >= 6 then Trigger.OnDamaged(actor, function()
SendUnits(ArmorAttack, Path) if actor.Owner ~= original or actor.Health > actor.MaxHealth * repairThreshold then
ArmorAttack = { } return
Trigger.AfterDelay(DateTime.Minutes(3), ProduceArmor) end
else
Trigger.AfterDelay(delay, ProduceArmor) actor.StartBuildingRepairs()
end end)
end) end
end end
SendUnits = function(units, waypoints) PrepareBlueprintEdges = function(blueprint)
Utils.Do(units, function(unit) local shapeX, shapeY = blueprint.shape[1], blueprint.shape[2]
if not unit.IsDead then local northwestEdge = Map.CenterOfCell(blueprint.location) + WVec.New(-512, -512, 0)
Utils.Do(waypoints, function(waypoint) local southeastEdge = northwestEdge + WVec.New(shapeX * 1024, shapeY * 1024, 0)
unit.AttackMove(waypoint.Location)
end) blueprint.northwestEdge = northwestEdge
IdleHunt(unit) blueprint.southeastEdge = southeastEdge
end
end)
end end

View File

@@ -44,8 +44,11 @@ EnemyPaths =
} }
Wave = 0 Wave = 0
SendEnemies = function() SendReinforcements = function()
Trigger.AfterDelay(EnemyAttackDelay[Difficulty], function() Trigger.AfterDelay(EnemyAttackDelay[Difficulty], function()
if Dome.IsDead or Dome.Owner ~= Greece then
return
end
Wave = Wave + 1 Wave = Wave + 1
if Wave > 3 then if Wave > 3 then
@@ -60,8 +63,6 @@ SendEnemies = function()
Utils.Do(units, IdleHunt) Utils.Do(units, IdleHunt)
end end
if not Dome.IsDead then SendReinforcements()
SendEnemies()
end
end) end)
end end

View File

@@ -6,110 +6,211 @@
the License, or (at your option) any later version. For more the License, or (at your option) any later version. For more
information, see COPYING. information, see COPYING.
]] ]]
IntroAttackers = { IntroEnemy1, IntroEnemy2, IntroEnemy3 }
Trucks = { Truck1, Truck2 }
InfAttack = { }
ArmorAttack = { }
AttackPaths = { { AttackWaypoint1 }, { AttackWaypoint2 } }
AlliedInfantryTypes = { "e1", "e1", "e3" } Trigger.OnRemovedFromWorld(Mcv, function()
AlliedArmorTypes = { "jeep", "jeep", "1tnk", "1tnk", "2tnk", "2tnk", "arty" } if McvDeployed or Mcv.IsDead then
return
SovietReinforcements1 = { "e6", "e6", "e6", "e6", "e6" }
SovietReinforcements2 = { "e4", "e4", "e2", "e2", "e2" }
SovietReinforcements1Waypoints = { McvWaypoint.Location, APCWaypoint1.Location }
SovietReinforcements2Waypoints = { McvWaypoint.Location, APCWaypoint2.Location }
TruckGoalTrigger = { CPos.New(85, 10), CPos.New(85, 11), CPos.New(85, 12), CPos.New(86, 13), CPos.New(87, 13), CPos.New(88, 13), CPos.New(88, 14), CPos.New(89, 14), CPos.New(90, 14), CPos.New(90, 15), CPos.New(91, 15), CPos.New(91, 16), CPos.New(91, 17), CPos.New(92, 17), CPos.New(93, 17), CPos.New(94, 17), CPos.New(94, 18), CPos.New(95, 18), CPos.New(96, 18), CPos.New(96, 19), CPos.New(97, 19), CPos.New(98, 19)}
Trigger.OnEnteredFootprint(TruckGoalTrigger, function(a, id)
if not TruckGoalTriggered and a.Owner == USSR and a.Type == "truk" then
TruckGoalTriggered = true
USSR.MarkCompletedObjective(SovietObjective)
USSR.MarkCompletedObjective(SaveAllTrucks)
end end
end)
Trigger.OnAllKilled(Trucks, function() McvDeployed = true
Greece.MarkCompletedObjective(AlliedObjective) BuildBase()
end) SendReinforcements()
Trigger.OnAnyKilled(Trucks, function() Trigger.AfterDelay(DateTime.Minutes(1), function()
USSR.MarkFailedObjective(SaveAllTrucks) ProduceInfantry(Tent)
end) end)
Trigger.OnKilled(Apwr, function() Trigger.AfterDelay(DateTime.Minutes(2), function()
BaseApwr.exists = false ProduceArmor(Weap)
end)
Trigger.OnKilled(Barr, function()
BaseTent.exists = false
end)
Trigger.OnKilled(Proc, function()
BaseProc.exists = false
end)
Trigger.OnKilled(Weap, function()
BaseWeap.exists = false
end)
Trigger.OnKilled(Apwr2, function()
BaseApwr2.exists = false
end)
Trigger.OnKilledOrCaptured(Dome, function()
Trigger.AfterDelay(DateTime.Seconds(2), function()
USSR.MarkCompletedObjective(SovietObjective2)
Media.PlaySpeechNotification(USSR, "ObjectiveMet")
end) end)
end) end)
Trigger.OnRemovedFromWorld(Mcv, function() PrepareResponseCruiser = function()
if not McvDeployed then local responseBuildings = { Apwr, Tent, Weap }
McvDeployed = true local responseOrdered = false
BuildBase()
SendEnemies() Utils.Do(responseBuildings, function(building)
Trigger.AfterDelay(DateTime.Minutes(1), ProduceInfantry) Trigger.OnDamaged(building, function()
Trigger.AfterDelay(DateTime.Minutes(2), ProduceArmor) if responseOrdered or USSR.IsObjectiveCompleted(DisruptDome) then
return
end
responseOrdered = true
OrderResponseCruiser()
end)
end)
end
OrderResponseCruiser = function()
if ResponseCruiser.IsDead then
return
end end
end)
ResponseCruiser.AttackMove(waypoint94.Location, 2)
ResponseCruiser.Wait(DateTime.Seconds(90))
Trigger.OnIdle(ResponseCruiser, function()
ResponseCruiser.AttackMove(waypoint69.Location, 2)
end)
Trigger.OnDamaged(ResponseCruiser, function(_, attacker)
if attacker.IsDead or not ResponseCruiser.CanTarget(attacker) then
return
end
ResponseCruiser.Attack(attacker)
ResponseCruiser.Scatter()
end)
end
PrepareBridgeBreakers = function()
local target = Map.ActorsInCircle(waypoint78.CenterPosition, WDist.New(1536), function(actor)
return actor.Type == "br3"
end)[1]
if not target then
Media.Debug("No bridge segment found.")
return
end
local orderSent = false
Trigger.AfterDelay(DateTime.Seconds(30), function()
orderSent = true
OrderBridgeBreakers(target)
end)
local bridgeEntryCells = { CPos.New(75, 30), CPos.New(76, 30), CPos.New(77, 30) }
Trigger.OnEnteredFootprint(bridgeEntryCells, function(a, id)
if a.Owner ~= USSR then
return
end
Trigger.RemoveFootprintTrigger(id)
if not orderSent then
OrderBridgeBreakers(target, "with bridge reveal")
end
end)
end
OrderBridgeBreakers = function(target, reveal)
if target.IsDead then
return
end
local breakers = { BridgeBreaker, BridgeBreaker2 }
Utils.Do(breakers, function(breaker)
if breaker.IsDead then
return
end
breaker.Stop()
breaker.Attack(target, true, true)
end)
if not reveal then
return
end
local camera = Actor.Create("camera", true, { Owner = USSR, Location = target.Location })
Trigger.OnKilled(target, function()
Trigger.AfterDelay(DateTime.Seconds(2), camera.Destroy)
end)
end
PrepareObjectives = function()
InitObjectives(USSR)
KillTrucks = AddPrimaryObjective(Greece, "")
EscortConvoy = AddPrimaryObjective(USSR, "escort-convoy")
DisruptDome = AddSecondaryObjective(USSR, "destroy-capture-radar-dome-reinforcements")
SaveAllTrucks = AddSecondaryObjective(USSR, "keep-trucks-alive")
Trigger.OnKilledOrCaptured(Dome, function()
-- Let the capture notification play first.
Trigger.AfterDelay(DateTime.Seconds(2), function()
USSR.MarkCompletedObjective(DisruptDome)
Media.PlaySpeechNotification(USSR, "ObjectiveMet")
end)
end)
end
PrepareTrucks = function()
local trucks = { Truck1, Truck2 }
local goalCells = { CPos.New(85, 10), CPos.New(85, 11), CPos.New(85, 12), CPos.New(86, 13), CPos.New(87, 13), CPos.New(88, 13), CPos.New(88, 14), CPos.New(89, 14), CPos.New(90, 14), CPos.New(90, 15), CPos.New(91, 15), CPos.New(91, 16), CPos.New(91, 17), CPos.New(92, 17), CPos.New(93, 17), CPos.New(94, 17), CPos.New(94, 18), CPos.New(95, 18), CPos.New(96, 18), CPos.New(96, 19), CPos.New(97, 19), CPos.New(98, 19)}
local goalTriggered = false
Trigger.OnEnteredFootprint(goalCells, function(a)
if not goalTriggered and a.Owner == USSR and a.Type == "truk" then
goalTriggered = true
USSR.MarkCompletedObjective(EscortConvoy)
USSR.MarkCompletedObjective(SaveAllTrucks)
end
end)
Trigger.OnAllKilled(trucks, function()
Greece.MarkCompletedObjective(KillTrucks)
end)
Trigger.OnAnyKilled(trucks, function()
USSR.MarkFailedObjective(SaveAllTrucks)
end)
end
BeginIntro = function()
local introAttackers = { IntroEnemy1, IntroEnemy2, IntroEnemy3 }
local sovietReinforcements1 = { "e6", "e6", "e6", "e6", "e6" }
local sovietReinforcements2 = { "e4", "e4", "e2", "e2", "e2" }
local sovietReinforcements1Path = { McvWaypoint.Location, APCWaypoint1.Location }
local sovietReinforcements2Path = { McvWaypoint.Location, APCWaypoint2.Location }
Mcv.Move(McvWaypoint.Location)
Utils.Do(introAttackers, IdleHunt)
Reinforcements.ReinforceWithTransport(USSR, "apc", sovietReinforcements1, sovietReinforcements1Path)
Reinforcements.ReinforceWithTransport(USSR, "apc", sovietReinforcements2, sovietReinforcements2Path)
end
PrepareIdleGuards = function()
local lazyUnits = Utils.Where(Greece.GetGroundAttackers(), function(unit)
return unit.Type ~= "ca" and unit.Type ~= "arty"
end)
Utils.Do(lazyUnits, function(unit)
local triggered = false
Trigger.OnDamaged(unit, function()
if triggered then
return
end
triggered = true
IdleHunt(unit)
end)
end)
end
WorldLoaded = function() WorldLoaded = function()
USSR = Player.GetPlayer("USSR") USSR = Player.GetPlayer("USSR")
Greece = Player.GetPlayer("Greece") Greece = Player.GetPlayer("Greece")
Neutral = Player.GetPlayer("Neutral")
PrepareObjectives()
Camera.Position = CameraStart.CenterPosition Camera.Position = CameraStart.CenterPosition
Mcv.Move(McvWaypoint.Location)
Harvester.FindResources() Harvester.FindResources()
Utils.Do(IntroAttackers, function(actor) BeginBaseMaintenance()
IdleHunt(actor)
end)
Reinforcements.ReinforceWithTransport(USSR, "apc", SovietReinforcements1, SovietReinforcements1Waypoints) if Difficulty ~= "easy" then
Reinforcements.ReinforceWithTransport(USSR, "apc", SovietReinforcements2, SovietReinforcements2Waypoints) PrepareResponseCruiser()
Trigger.AfterDelay(1, PrepareBridgeBreakers)
end
Utils.Do(Map.NamedActors, function(actor) PrepareTrucks()
if actor.Owner == Greece and actor.HasProperty("StartBuildingRepairs") then BeginIntro()
Trigger.OnDamaged(actor, function(building) PrepareIdleGuards()
if building.Owner == Greece and building.Health < 3/4 * building.MaxHealth then
building.StartBuildingRepairs()
end
end)
end
end)
InitObjectives(USSR)
AlliedObjective = AddPrimaryObjective(Greece, "")
SovietObjective = AddPrimaryObjective(USSR, "escort-convoy")
SovietObjective2 = AddSecondaryObjective(USSR, "destroy-capture-radar-dome-reinforcements")
SaveAllTrucks = AddSecondaryObjective(USSR, "Keep all trucks alive.")
end end
Tick = function() Tick = function()
if USSR.HasNoRequiredUnits() then if USSR.HasNoRequiredUnits() then
Greece.MarkCompletedObjective(AlliedObjective) Greece.MarkCompletedObjective(KillTrucks)
end end
if Greece.Resources >= Greece.ResourceCapacity * 0.75 then if Greece.Resources >= Greece.ResourceCapacity * 0.75 then
@@ -117,3 +218,4 @@ Tick = function()
Greece.Resources = Greece.ResourceCapacity * 0.25 Greece.Resources = Greece.ResourceCapacity * 0.25
end end
end end