1--[[ 2 Copyright 2007-2020 The OpenRA Developers (see AUTHORS) 3 This file is part of OpenRA, which is free software. It is made 4 available to you under the terms of the GNU General Public License 5 as published by the Free Software Foundation, either version 3 of 6 the License, or (at your option) any later version. For more 7 information, see COPYING. 8]] 9CameraTriggerArea = { CPos.New(42, 45), CPos.New(43, 45), CPos.New(44, 45), CPos.New(45, 45), CPos.New(46, 45), CPos.New(47, 45), CPos.New(48, 45), CPos.New(48, 56), CPos.New(48, 57), CPos.New(48, 58), CPos.New(48, 59), CPos.New(40, 63), CPos.New(41, 63), CPos.New(42, 63), CPos.New(43, 63), CPos.New(44, 63), CPos.New(45, 63), CPos.New(46, 63), CPos.New(47, 63) } 10PassingBridgeLocation = { CPos.New(59, 56), CPos.New(60, 56) } 11 12CmdAtk = { Attacker1, Attacker2, Attacker3, Attacker4 } 13FleeingUnits = { Fleeing1, Fleeing2 } 14HuntingUnits = { Hunter1, Hunter2, Hunter3, Hunter4 } 15 16WorldLoaded = function() 17 player = Player.GetPlayer("USSR") 18 greece = Player.GetPlayer("Greece") 19 20 Trigger.OnObjectiveAdded(player, function(p, id) 21 Media.DisplayMessage(p.GetObjectiveDescription(id), "New " .. string.lower(p.GetObjectiveType(id)) .. " objective") 22 end) 23 Trigger.OnObjectiveCompleted(player, function(p, id) 24 Media.DisplayMessage(p.GetObjectiveDescription(id), "Objective completed") 25 end) 26 Trigger.OnObjectiveFailed(player, function(p, id) 27 Media.DisplayMessage(p.GetObjectiveDescription(id), "Objective failed") 28 end) 29 30 CommandCenterIntact = player.AddPrimaryObjective("Protect the Command Center.") 31 DestroyAllAllied = player.AddPrimaryObjective("Destroy all Allied units and structures.") 32 33 Trigger.OnPlayerWon(player, function() 34 Media.PlaySpeechNotification(player, "MissionAccomplished") 35 end) 36 Trigger.OnPlayerLost(player, function() 37 Media.PlaySpeechNotification(player, "MissionFailed") 38 end) 39 40 Camera.Position = CameraWaypoint.CenterPosition 41 42 Trigger.OnKilled(CommandCenter, function() 43 player.MarkFailedObjective(CommandCenterIntact) 44 end) 45 46 Trigger.AfterDelay(0, function() 47 local buildings = Utils.Where(Map.ActorsInWorld, function(self) return self.Owner == greece and self.HasProperty("StartBuildingRepairs") end) 48 Utils.Do(buildings, function(actor) 49 Trigger.OnDamaged(actor, function(building, attacker) 50 if building.Owner == greece and building.Health < building.MaxHealth * 0.8 then 51 building.StartBuildingRepairs() 52 if attacker.Type ~= "yak" and not AlreadyHunting then 53 AlreadyHunting = true 54 Utils.Do(greece.GetGroundAttackers(), function(unit) 55 Trigger.OnIdle(unit, unit.Hunt) 56 end) 57 end 58 end 59 end) 60 end) 61 62 -- Find the bridge actors 63 bridgepart1 = Map.ActorsInBox(Box1.CenterPosition, Box2.CenterPosition, function(self) return self.Type == "br1" end)[1] 64 bridgepart2 = Map.ActorsInBox(Box1.CenterPosition, Box2.CenterPosition, function(self) return self.Type == "br2" end)[1] 65 end) 66 67 -- Discover the area around the bridge exposing the two german soldiers 68 -- When the two infantry near the bridge are discovered move them across the bridge to waypoint4 69 -- in the meanwhile one USSR soldier hunts them down 70 Trigger.AfterDelay(DateTime.Seconds(1), function() 71 Actor.Create("camera", true, { Owner = player, Location = Box1.Location }) 72 73 Utils.Do(FleeingUnits, function(unit) 74 unit.Move(RifleRetreat.Location) 75 end) 76 Follower.AttackMove(RifleRetreat.Location) 77 end) 78 79 -- To make it look more smooth we will blow up the bridge when the barrel closest to it blows up 80 Trigger.OnAnyKilled({ BridgeBarrel1, BridgeBarrel2 }, function() 81 -- Destroy the bridge 82 if not bridgepart1.IsDead then 83 bridgepart1.Kill() 84 end 85 if not bridgepart2.IsDead then 86 bridgepart2.Kill() 87 end 88 end) 89 90 -- If player passes over the bridge, blow up the barrel and destroy the bridge 91 Trigger.OnEnteredFootprint(PassingBridgeLocation, function(unit, id) 92 if unit.Owner == player then 93 Trigger.RemoveFootprintTrigger(id) 94 95 -- Also don't if the bridge is already dead 96 if bridgepart1.IsDead and bridgepart2.IsDead then 97 return 98 end 99 100 -- Don't "shoot" at the barrels if there is no-one to shoot 101 if not FleeingUnits[1].IsDead then 102 FleeingUnits[1].Attack(Barrel, true, true) 103 elseif not FleeingUnits[2].IsDead then 104 FleeingUnits[2].Attack(Barrel, true, true) 105 end 106 end 107 end) 108 109 -- Four infantry from the small island move towards the USSR command center and attack it after 24 Seconds 110 Trigger.AfterDelay(DateTime.Seconds(24), function() 111 Utils.Do(CmdAtk, function(unit) 112 unit.AttackMove(AttackWaypoint1.Location) 113 Trigger.OnIdle(unit, unit.Hunt) 114 end) 115 end) 116 117 -- Start hunting 118 Hunter4.AttackMove(AttackWaypoint2.Location) -- Move the unit in the correct direction first 119 Utils.Do(HuntingUnits, function(unit) 120 Trigger.OnIdle(unit, unit.Hunt) 121 end) 122 123 -- When destroying the allied radar dome or the refinery drop 2 badgers with 5 grenadiers each 124 Trigger.OnAnyKilled({ AlliedDome, AlliedProc }, function() 125 local powerproxy = Actor.Create("powerproxy.paratroopers", true, { Owner = player }) 126 powerproxy.ActivateParatroopers(ParadropLZ.CenterPosition, Facing.South) 127 powerproxy.ActivateParatroopers(ParadropLZ.CenterPosition, Facing.SouthEast) 128 powerproxy.Destroy() 129 end) 130end 131 132Tick = function() 133 if greece.HasNoRequiredUnits() then 134 player.MarkCompletedObjective(CommandCenterIntact) 135 player.MarkCompletedObjective(DestroyAllAllied) 136 end 137 138 if player.HasNoRequiredUnits() then 139 player.MarkFailedObjective(DestroyAllAllied) 140 end 141 142 if greece.Resources > greece.ResourceCapacity / 2 then 143 greece.Resources = greece.ResourceCapacity / 2 144 end 145end 146