package.loaded.Constants = nil; require("Constants"); ---------------------- --- Start Activity --- ---------------------- function FiringRangeMission:StartActivity() print("START! -- FiringRangeMission:StartActivity()!"); self.braindead = {}; self.AssignedBrains = {}; self.MOIDLimit = 175; self.Zone = SceneMan.Scene:GetArea("LZ"); self.RespawnTimer = Timer(); self.RespawnTimer2 = Timer(); self.PlayerGold = 1000000; self.CPUTeam = Activity.TEAM_2; self.PlayerTeam = Activity.TEAM_1; self.RogueTeam = -1; self.Disabled = 1 self.Patrol = 1 self.SpawnMultiplier = 1 self.InOutSpawn1 = 0 self.InOutSpawn2 = 0 self.InOutSpawn3 = 0 self.HasSetSentry = 0 for player = 0, self.PlayerCount - 1 do if not self:GetPlayerBrain(player) then self.braindead[player] = false; local brain = CreateAHuman("Brain Robot" , "base.rte"); brain.Pos = Vector(3200, 475); brain.AIMode = Actor.AIMODE_SENTRY; self.AssignedBrains[player] = brain; MovableMan:AddActor(brain); self:SetPlayerBrain(brain, player); SceneMan:SetScroll(self:GetPlayerBrain(player).Pos, player); self:SetObservationTarget(self:GetPlayerBrain(player).Pos, player); self:SwitchToActor(brain, player, self.PlayerTeam); end end self.FRZone = SceneMan.Scene:GetArea("FRZone"); self.ButtonZone = SceneMan.Scene:GetArea("Button"); self.ButtonZone2 = SceneMan.Scene:GetArea("Button2"); self.ButtonZone3 = SceneMan.Scene:GetArea("Button3"); self.OutSpawn1 = SceneMan.Scene:GetArea("OutSpawn1"); self.OutSpawn2 = SceneMan.Scene:GetArea("OutSpawn2"); self.OutSpawn3 = SceneMan.Scene:GetArea("OutSpawn3"); self:SetTeamFunds(self.PlayerGold , self.PlayerTeam); end function FiringRangeMission:PauseActivity(pause) print("PAUSE! -- FiringRangeMission:PauseActivity()!"); end function FiringRangeMission:EndActivity() print("END! -- FiringRangeMission:EndActivity()!"); end function FiringRangeMission:DoBrainSelection() if not (self.ActivityState == Activity.OVER) then for player = 0, self.PlayerCount - 1 do local team = self:GetTeamOfPlayer(player); local brain = self:GetPlayerBrain(player); if not brain or not MovableMan:IsActor(brain) or not brain:HasObjectInGroup("Brains") then self:SetPlayerBrain(nil, player); local newBrain = MovableMan:GetUnassignedBrain(team); if newBrain and self.braindead[player] == false then self:SetPlayerBrain(newBrain, player); self:SwitchToActor(newBrain, player, team); else FrameMan:SetScreenText("Commander died!", player, 100, -1, false); self.braindead[player] = true; self.WinnerTeam = self:OtherTeam(team); ActivityMan:EndActivity(); end else self:SetObservationTarget(brain.Pos, player) end -- end --for end --if end function FiringRangeMission:UpdateActivity() self:CheckActors(); self:CheckRespawn(); self:UpdateMarkers(); self:DoBrainSelection(); end function FiringRangeMission:CheckActors() self.Disabled = 1 self.Patrol = 1 self.SpawnMultiplier = 1 self.InOutSpawn1 = 0 self.InOutSpawn2 = 0 self.InOutSpawn3 = 0 for actor in MovableMan.Actors do if self.ButtonZone:IsInside(actor.Pos) then self.Disabled = 0 end if self.ButtonZone2:IsInside(actor.Pos) then self.Patrol = 0 end if self.ButtonZone3:IsInside(actor.Pos) then self.SpawnMultiplier = 2 end if self.OutSpawn1:IsInside(actor.Pos) then self.InOutSpawn1 = 1 end if self.OutSpawn2:IsInside(actor.Pos) then self.InOutSpawn2 = 1 end if self.OutSpawn3:IsInside(actor.Pos) then self.InOutSpawn3 = 1 end if actor.Team == self.CPUTeam and actor.AIMode == Actor.AIMODE_SENTRY then actor:GetController():SetState(Controller.MOVE_LEFT, false); actor:GetController():SetState(Controller.MOVE_RIGHT, false); actor:GetController():SetState(Controller.BODY_JUMP, false); actor:GetController():SetState(Controller.BODY_JUMPSTART, false); actor:GetController():SetState(Controller.BODY_CROUCH, false); actor:GetController():SetState(Controller.WEAPON_PICKUP, false); end end end function FiringRangeMission:CheckRespawn() if self.RespawnTimer:IsPastSimMS(5000 / self.SpawnMultiplier) and MovableMan:GetMOIDCount() <= self.MOIDLimit then if self.Disabled == 0 and self.Patrol == 0 then self.Respawn(0, 84, 744, 0) elseif self.Disabled == 0 then self.Respawn(0, 84, 744, 1) end if self.InOutSpawn1 == 0 then self.Respawn(0, 2028, 480, 0) end if self.InOutSpawn2 == 0 then self.Respawn(0, 2220, 480, 0) end if self.InOutSpawn3 == 0 then self.Respawn(0, 2412, 480, 0) end self.RespawnTimer:Reset(); end --if timer end --function function FiringRangeMission:Respawn(x, y, patrol) local actor = nil; if FiringRangeMission.Difficulty <= GameActivity.CAKEDIFFICULTY then actor = CreateAHuman("Culled Clone"); elseif FiringRangeMission.Difficulty <= GameActivity.EASYDIFFICULTY then actor = CreateAHuman("Dummy"); elseif FiringRangeMission.Difficulty <= GameActivity.MEDIUMDIFFICULTY then actor = CreateAHuman("Ronin Soldier"); elseif FiringRangeMission.Difficulty <= GameActivity.HARDDIFFICULTY then actor = CreateAHuman("Soldier Light"); elseif FiringRangeMission.Difficulty <= GameActivity.NUTSDIFFICULTY then actor = CreateAHuman("Combat Robot"); elseif FiringRangeMission.Difficulty <= GameActivity.MAXDIFFICULTY then actor = CreateAHuman("Browncoat Heavy"); end -- if, actor selection if patrol == 1 then actor.AIMode = Actor.AIMODE_GOTO; actor:ClearAIWaypoints(); actor:AddAISceneWaypoint(Vector(3516, 816)); else actor.AIMode = Actor.AIMODE_SENTRY; end actor.Pos = Vector(x, y); actor.Team = FiringRangeMission.CPUTeam; MovableMan:AddActor(actor); end --function function FiringRangeMission:UpdateMarkers() self:ClearObjectivePoints(); if self.Disabled == 0 then self:AddObjectivePoint("Spawner active", Vector(3552, 487), Activity.TEAM_1, GameActivity.ARROWDOWN); else self:AddObjectivePoint("Spawner disabled", Vector(3552, 487), Activity.TEAM_1, GameActivity.ARROWDOWN); end if self.Patrol == 0 then self:AddObjectivePoint("Clones stands still", Vector(3804, 487), Activity.TEAM_1, GameActivity.ARROWDOWN); else self:AddObjectivePoint("Clones jumps into the pit", Vector(3804, 487), Activity.TEAM_1, GameActivity.ARROWDOWN); end if self.SpawnMultiplier == 1 then self:AddObjectivePoint("Clone spawn delay = 5s", Vector(48, 487), Activity.TEAM_1, GameActivity.ARROWDOWN); else self:AddObjectivePoint("Clone spawn delay = 2,5s", Vector(48, 487), Activity.TEAM_1, GameActivity.ARROWDOWN); end end