-- 02: CRATE DIGGERS — timed raid, no base building. TIME_LIMIT = DateTime.Minutes(6) Deadline = nil WorldLoaded = function() Mrp = Player.GetPlayer("Player") Stream = Player.GetPlayer("Enemy") InitObjectives(Mrp) KillTranscoder = Mrp.AddPrimaryObjective("destroy-the-transcoder") KeepSelector = Mrp.AddPrimaryObjective("keep-the-selector-alive") WipeOutpost = Mrp.AddSecondaryObjective("wipe-the-outpost") Deadline = DateTime.GameTime + TIME_LIMIT Trigger.OnKilled(Transcoder, function() if not Mrp.IsObjectiveCompleted(KillTranscoder) then Mrp.MarkCompletedObjective(KillTranscoder) Mrp.MarkCompletedObjective(KeepSelector) UserInterface.SetMissionText("") end end) Trigger.OnKilled(TheSelector, function() Mrp.MarkFailedObjective(KeepSelector) end) local outpost = { Transcoder, outpost1, outpost2, turret1, turret2 } Trigger.OnAllKilled(outpost, function() Mrp.MarkCompletedObjective(WipeOutpost) end) -- the deadline: the master gets cut and the raid was for nothing Trigger.AfterDelay(TIME_LIMIT, function() if not Mrp.IsObjectiveCompleted(KillTranscoder) then if not MasterLacquer.IsDead then MasterLacquer.Kill() end Media.PlaySpeechNotification(Mrp, "Lose") Mrp.MarkFailedObjective(KillTranscoder) end end) end Tick = function() if Deadline ~= nil and not Mrp.IsObjectiveCompleted(KillTranscoder) and not Mrp.IsObjectiveFailed(KillTranscoder) then local left = Deadline - DateTime.GameTime if left < 0 then left = 0 end if left % 25 == 0 then UserInterface.SetMissionText("Master cut in " .. Utils.FormatTime(left)) end end end