View unanswered posts | View active topics It is currently Fri Dec 27, 2024 7:54 am



Reply to topic  [ 7 posts ] 
 Controlling guns remotely 
Author Message
User avatar

Joined: Mon Jul 16, 2007 9:50 am
Posts: 1512
Location: Tallahassee, FL
Reply with quote
Post 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.


Thu Nov 19, 2009 4:11 pm
Profile YIM
REAL AMERICAN HERO
User avatar

Joined: Sat Jan 27, 2007 10:25 pm
Posts: 5655
Reply with quote
Post 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.


Thu Nov 19, 2009 4:14 pm
Profile
Data Realms Elite
Data Realms Elite
User avatar

Joined: Wed Sep 05, 2007 4:14 am
Posts: 3966
Location: Canadida
Reply with quote
Post Re: Controlling guns remotely
ITT 0 ammo + Activate = reload.

And that is all I can say.


Thu Nov 19, 2009 4:17 pm
Profile
User avatar

Joined: Tue Jun 12, 2007 11:52 pm
Posts: 13144
Location: Here
Reply with quote
Post 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


Fri Nov 20, 2009 2:06 am
Profile
REAL AMERICAN HERO
User avatar

Joined: Sat Jan 27, 2007 10:25 pm
Posts: 5655
Reply with quote
Post Re: Controlling guns remotely
try self.gun = ToHDFirearm(item);


Fri Nov 20, 2009 5:08 am
Profile
User avatar

Joined: Fri Dec 28, 2007 4:19 am
Posts: 1119
Reply with quote
Post Re: Controlling guns remotely
I think this is the said mod:
viewtopic.php?f=61&t=15917


Fri Nov 20, 2009 9:52 pm
Profile
User avatar

Joined: Tue Jun 12, 2007 11:52 pm
Posts: 13144
Location: Here
Reply with quote
Post Re: Controlling guns remotely
It works Grif, thanks.


Fri Nov 20, 2009 11:35 pm
Profile
Display posts from previous:  Sort by  
Reply to topic   [ 7 posts ] 

Who is online

Users browsing this forum: No registered users


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group.
Designed by STSoftware for PTF.
[ Time : 0.064s | 13 Queries | GZIP : Off ]