function Create(self) self.HTimer = Timer() self.OTimer = Timer() -- The variables: self.IsInControl = 0; self.ControlledActor = nil; end function Update(self) ----------------------------------------- Bad tabbing, sorry. :P curdist = 50 if self.IsInControl == 0 and UInputMan:KeyPressed(26) then for actor in MovableMan.Actors do if actor.ID ~= self.ID then local avgx = actor.Pos.X - self.Pos.X; local avgy = actor.Pos.Y - self.Pos.Y; local dist = math.sqrt(avgx ^ 2 + avgy ^ 2); if dist < curdist then if self:IsPlayerControlled() == true and actor.ClassName ~= "ADoor" then self.ControlledActor = actor; curdist = dist self.IsInControl = 1; --print (("Actor Found:") .. (self.ControlledActor.PresetName)) ; self:SetWhichMOToNotHit(actor,-1) actor:SetWhichMOToNotHit(self,-1) end end end end end if self.IsInControl == 1 and self.ControlledActor ~= nil and MovableMan:IsActor(self.ControlledActor) then self.Pos = self.ControlledActor.Pos; --self.Vel = Vector(0,0) --self.AngularVel = 0 self.Vel = self.ControlledActor.Vel self.RotAngle = self.ControlledActor.RotAngle self.AngularVel = self.ControlledActor.AngularVel if self.ControlledActor.ClassName ~= "ACDropShip" and self.ControlledActor.ClassName ~= "ACRocket" and self.ControlledActor.PinStrength == 0 then self.ControlledActor.HFlipped = self.HFlipped end if self.ControlledActor:GetController().InputMode ~= 1 then self.ControlledActor:GetController().InputMode = 3 end self.ControlledActor:GetController():SetState(13,false) i = 1 while i < 43 do if self:GetController():IsState(i) then self.ControlledActor:GetController():SetState(i,true) end i = i + 1 end self.ControlledActor:SetAimAngle(ActivityMan:GetActivity():GetControlledActor(0):GetAimAngle(false)) ------------------------------------------------------------------------------------ Huge controller defining part: if self:IsPlayerControlled() then if UInputMan:KeyPressed(24) then if self.ControlledActor:GetController().InputMode == 3 then self.ControlledActor:GetController().InputMode = 2 end self.IsInControl = 0; self.ControlledActor = nil; self.Vel = self.ControlledActor.Vel end end else self.IsInControl = 0; self.ControlledActor = nil; end end