--Find the transponder
Objective4 = ObjectiveCTF:New{teamATT = ATT, teamDEF = DEF, captureLimit = 1, text = "level.LPR.campaign.capture1", popupText = "level.LPR.campaign.popup4", AIGoalWeight = 0}
Objective4:AddFlag{name = "powercell", homeRegion = "", captureRegion = "cp2_capture",
capRegionMarker = "hud_objective_icon_circle", capRegionMarkerScale = 3.0,
mapIcon = "flag_icon", mapIconScale = 2.0}
Objective4.OnDrop = function(self, flag)
SetProperty(flag.name, "AllowAIPickUp", 0)
end
Objective4.OnStart = function(self)
MapAddEntityMarker("crashed_gunship", "hud_objective_icon_circle", 3.0, 1, "YELLOW", true)
SetUnitCount (6, 5)
SetupAmbushTrigger("gunshipambush1", "droidpath2", 5, 6)
SetupAmbushTrigger("gunshipambush2", "droidpath3", 5, 6)
SetupAmbushTrigger("gunshipambush3", "droidpath4", 5, 6)
SetupAmbushTrigger("gunshipambush4", "droidpath5", 5, 6)
powercell_capture_on = OnFlagPickUp(
function(flag, carrier)
if IsCharacterHuman(carrier) then
MapAddEntityMarker("cp2", "hud_objective_icon_circle", 4.0, ATT, "YELLOW", true)
end
end,
"powercell"
)
powercell_capture_off = OnFlagDrop(
function(flag, carrier)
if IsCharacterHuman(carrier) then
MapRemoveEntityMarker("cp2")
end
end,
"powercell"
)
att_obj4_dm = AddAIGoal(ATT, "Defend", 100, "cp2")
def_obj4_dm = AddAIGoal(DEF, "Deathmatch", 100)
dtm_obj4_dm = AddAIGoal(6, "Deathmatch", 100)
end
Objective4.OnComplete = function(self)
MapRemoveEntityMarker("crashed_gunship")
ShowMessageText("game.objectives.complete", ATT)
MapRemoveEntityMarker("cp2")
ReleaseFlagPickUp(powercell_capture_on)
powercell_capture_on = nil
ReleaseFlagDrop(powercell_capture_off)
powercell_capture_off = nil
DeleteAIGoal(dtm_obj4_dm)
DeleteAIGoal(att_obj4_dm)
DeleteAIGoal(def_obj4_dm)
ATTReinforcementCount = GetReinforcementCount(ATT)
SetReinforcementCount(ATT, ATTReinforcementCount + 30)
end
end