Code:
ERROR: HeadCrab.rte/Control.lua:3: 'then' expected near '='
I'm not completely sure what this means, and my attampts at fixing aren't successful. My script is below.
Code:
function Update(self)
self.targetcontrol = false;
if self.target:GetController():IsState(Controller.WEAPON_FIRE) and self.targetcontrol = false then
local curdist = 50;
for actor in MovableMan.Actors do
local dist = SceneMan:ShortestDistance(self.Pos,actor.Pos,true);
if dist.Magnitude < curdist and actor.ID ~= self.ID then
self.target = actor;
self.targetcontrol = true;
end
end
end
if self.target:IsDead() then
self.GetsHitByMOs = 1;
self.HitsMOs = 1;
self.targetcontrol = false;
end
if self.targetcontrol = true then
self.GetsHitByMOs = 0;
self.HitsMOs = 0;
self.Pos = self.target.Pos;
end
if self.target:GetController():IsState(Controller.HOLD_LEFT) and self.targetcontrol = true then
self.target:GetController():IsState(Controller.HOLD_LEFT)
end
if self.target:GetController():IsState(Controller.HOLD_RIGHT) and self.targetcontrol = true then
self.target:GetController():IsState(Controller.HOLD_RIGHT)
end
end
This script is supposed to take control of the left and right movement of the closest actor within 50 pixels when fire is pressed. And this is attached to an actor.