primaryLost = false primaryLostTimer = 0 function tick(dt) local targets = FindBodies("target", true) local activeRobots = 0 for i=1, #targets do if HasTag(targets[i], "inactive") then elseif HasTag(targets[i], "disabled") then SetTag(targets[i], "target", "disabled") if not HasTag(targets[i], "optional") then primaryLost = true primaryLostTimer = 0 end else activeRobots = activeRobots + 1 end end if activeRobots == 0 then PlayMusic("factory-noheist.ogg") else PlayMusic("factory-hunted.ogg") end if primaryLost then primaryLostTimer = primaryLostTimer - dt if primaryLostTimer < 0 then SetString("hud.notification", GetTranslatedStringByKey("UI_HUD_NOTE_A_PRIMARY")) primaryLostTimer = 30 end end end