Author |
Message |
CaveCricket48
Joined: Tue Jun 12, 2007 11:52 pm Posts: 13144 Location: Here
|
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 |
|
|
TheLastBanana
DRL Developer
Joined: Wed Dec 13, 2006 5:27 am Posts: 3138 Location: A little south and a lot west of Moscow
|
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 |
|
|
CaveCricket48
Joined: Tue Jun 12, 2007 11:52 pm Posts: 13144 Location: Here
|
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 |
|
|
TheLastBanana
DRL Developer
Joined: Wed Dec 13, 2006 5:27 am Posts: 3138 Location: A little south and a lot west of Moscow
|
Re: Questions on HDFirearms/Magazines
Is self.parent an actor or a weapon?
|
Sun Nov 22, 2009 12:43 am |
|
|
TorrentHKU
Loose Canon
Joined: Sun Mar 29, 2009 11:07 pm Posts: 2992 Location: --------------->
|
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 |
|
|
CaveCricket48
Joined: Tue Jun 12, 2007 11:52 pm Posts: 13144 Location: Here
|
Re: Questions on HDFirearms/Magazines
self.parent is an actor.
|
Sun Nov 22, 2009 1:57 am |
|
|
Foa
Data Realms Elite
Joined: Wed Sep 05, 2007 4:14 am Posts: 3966 Location: Canadida
|
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 |
|
|
CaveCricket48
Joined: Tue Jun 12, 2007 11:52 pm Posts: 13144 Location: Here
|
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 |
|
|
Lizardheim
DRL Developer
Joined: Fri May 15, 2009 10:29 am Posts: 4107 Location: Russia
|
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 |
|
|
CaveCricket48
Joined: Tue Jun 12, 2007 11:52 pm Posts: 13144 Location: Here
|
Re: Questions on HDFirearms/Magazines
That sounds good. Will try.
Edit: Success! Thanks Lizard and everyone else.
|
Sun Nov 22, 2009 6:04 pm |
|
|
|