Data Realms Fan Forums
http://45.55.195.193/

Controlling guns remotely
http://45.55.195.193/viewtopic.php?f=73&t=17161
Page 1 of 1

Author:  Darlos9D [ Thu Nov 19, 2009 4:11 pm ]
Post subject:  Controlling guns remotely

I remember a while back there was some telekinesis mod that let you have guns floating around you, and they would fire when you fire. I never really looked at how it worked, and now I'm interested. Rather than digging it up though, I think my question can be answered pretty simply.

If I have script running on an actor, and in that script make a reference to a firearm object, can I make that firearm fire, reload, etc without it actually being held by an actor? If so, that'd make something I'm doing quite a bit easier.

Author:  Grif [ Thu Nov 19, 2009 4:14 pm ]
Post subject:  Re: Controlling guns remotely

Fire, yes; it's just pointer:Activate().

I can't recall if there's a reload function, exactly, but I know that once it runs out of ammo the gun will reload as usual, even when not held.

Author:  Foa [ Thu Nov 19, 2009 4:17 pm ]
Post subject:  Re: Controlling guns remotely

ITT 0 ammo + Activate = reload.

And that is all I can say.

Author:  CaveCricket48 [ Fri Nov 20, 2009 2:06 am ]
Post subject:  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

Author:  Grif [ Fri Nov 20, 2009 5:08 am ]
Post subject:  Re: Controlling guns remotely

try self.gun = ToHDFirearm(item);

Author:  DSMK2 [ Fri Nov 20, 2009 9:52 pm ]
Post subject:  Re: Controlling guns remotely

I think this is the said mod:
viewtopic.php?f=61&t=15917

Author:  CaveCricket48 [ Fri Nov 20, 2009 11:35 pm ]
Post subject:  Re: Controlling guns remotely

It works Grif, thanks.

Page 1 of 1 All times are UTC [ DST ]
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
http://www.phpbb.com/