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



Reply to topic  [ 10 posts ] 
 Questions on HDFirearms/Magazines 
Author Message
User avatar

Joined: Tue Jun 12, 2007 11:52 pm
Posts: 13144
Location: Here
Reply with quote
Post Questions on HDFirearms/Magazines
How do you use Lua to find a magazine on a gun?
Can you force a gun to not reload when it's empty?
Can you change the RoundCount of a magazine?


Sat Nov 21, 2009 10:18 pm
Profile
DRL Developer
DRL Developer
User avatar

Joined: Wed Dec 13, 2006 5:27 am
Posts: 3138
Location: A little south and a lot west of Moscow
Reply with quote
Post Re: Questions on HDFirearms/Magazines
1. If it has GetsHitByMOs on, you can find it with the standard MO-finding technique. Otherwise, ther eis no way.
2. As far as I know, no. You can give it a massive reload time, maybe.
3. Nope.


Sun Nov 22, 2009 12:08 am
Profile WWW
User avatar

Joined: Tue Jun 12, 2007 11:52 pm
Posts: 13144
Location: Here
Reply with quote
Post Re: Questions on HDFirearms/Magazines
For some reason the magazine isn't being detected when it's GetsHitByMOs = 1.

Code:
   for i = 1,MovableMan:GetMOIDCount()-1 do
      mag = MovableMan:GetMOFromID(i);
   if mag.ClassName == "Magazine" and mag.RootID == self.parent.ID then
   mag.ToDelete = true;
   mag.LifeTime = 0;
   print("mag delete");
   end
end


Sun Nov 22, 2009 12:31 am
Profile
DRL Developer
DRL Developer
User avatar

Joined: Wed Dec 13, 2006 5:27 am
Posts: 3138
Location: A little south and a lot west of Moscow
Reply with quote
Post Re: Questions on HDFirearms/Magazines
Is self.parent an actor or a weapon?


Sun Nov 22, 2009 12:43 am
Profile WWW
Loose Canon
User avatar

Joined: Sun Mar 29, 2009 11:07 pm
Posts: 2992
Location: --------------->
Reply with quote
Post Re: Questions on HDFirearms/Magazines
TheLastBanana wrote:
2. As far as I know, no. You can give it a massive reload time, maybe.

Or make the magazine gib into something that instantly kills the nearest gun. So that when the gun tries to reload, it just breaks. Yeah, that's stupid.


Sun Nov 22, 2009 1:09 am
Profile WWW
User avatar

Joined: Tue Jun 12, 2007 11:52 pm
Posts: 13144
Location: Here
Reply with quote
Post Re: Questions on HDFirearms/Magazines
self.parent is an actor.


Sun Nov 22, 2009 1:57 am
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: Questions on HDFirearms/Magazines
CaveCricket48 wrote:
For some reason the magazine isn't being detected when it's GetsHitByMOs = 1.

Code:
   for i = 1,MovableMan:GetMOIDCount()-1 do
      mag = MovableMan:GetMOFromID(i);
   if mag.ClassName == "Magazine" and mag.RootID == self.parent.ID then
   mag.ToDelete = true;
   mag.LifeTime = 0;
   print("mag delete");
   end
end

I think you got this from Ballistic Weapons' Railgun. ( The magazine gibs in three seconds, so you literally only have three seconds to fire )
But the thing used .ini trickery ( lifetime = 3000 ) I think you are trying to get a realistic ammo system, so you will need lua so it can go from can't reload to reload.


Sun Nov 22, 2009 5:01 am
Profile
User avatar

Joined: Tue Jun 12, 2007 11:52 pm
Posts: 13144
Location: Here
Reply with quote
Post Re: Questions on HDFirearms/Magazines
Foa wrote:
CaveCricket48 wrote:
For some reason the magazine isn't being detected when it's GetsHitByMOs = 1.

Code:
 for i = 1,MovableMan:GetMOIDCount()-1 do
mag = MovableMan:GetMOFromID(i);
if mag.ClassName == "Magazine" and mag.RootID == self.parent.ID then
mag.ToDelete = true;
mag.LifeTime = 0;
print("mag delete");
end
end

I think you got this from Ballistic Weapons' Railgun. ( The magazine gibs in three seconds, so you literally only have three seconds to fire )
But the thing used .ini trickery ( lifetime = 3000 ) I think you are trying to get a realistic ammo system, so you will need lua so it can go from can't reload to reload.


I think I got that from my head. And I want the mag to dissapear under a specific circumstance, not after a set time limit when you draw your weapon.


Sun Nov 22, 2009 5:41 am
Profile
DRL Developer
DRL Developer

Joined: Fri May 15, 2009 10:29 am
Posts: 4107
Location: Russia
Reply with quote
Post Re: Questions on HDFirearms/Magazines
Have it put a thingmajigg on the actor, that makes it check if there is a rocket/bullet/whatever being fired away from him, and have it check lifetime too. And have the script terminate if the weapon is dropped and one has no more of them in inventory.


Sun Nov 22, 2009 7:32 am
Profile
User avatar

Joined: Tue Jun 12, 2007 11:52 pm
Posts: 13144
Location: Here
Reply with quote
Post Re: Questions on HDFirearms/Magazines
That sounds good. Will try.

Edit: Success! Thanks Lizard and everyone else.


Sun Nov 22, 2009 6:04 pm
Profile
Display posts from previous:  Sort by  
Reply to topic   [ 10 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.049s | 13 Queries | GZIP : Off ]