Re: Controlling guns remotely
For some reason, gun:Activate() isn't working for me.
The weapon catching part:
Code:
if not(MovableMan:IsDevice(self.gun)) then
for item in MovableMan.Items do
local itemavgx = item.Pos.X - self.Pos.X;
local itemavgy = item.Pos.Y - (self.Pos.Y-15);
local itemdist = math.sqrt(itemavgx ^ 2 + itemavgy ^ 2);
if itemdist < 20 and item.ClassName == "HDFirearm" then
self.gun = item;
self.gotgun = true;
if self.gun.GetsHitByMOs == true then
self.gungethit = true;
end
end
end
end
The firing part:
Code:
if MovableMan:IsActor(self.user) then
self.gun.RotAngle = self.user:GetAimAngle(false);
if self.user:GetController():IsState(Controller.WEAPON_FIRE) then
self.gun:Activate();
end
end