Author |
Message |
Lizardheim
DRL Developer
Joined: Fri May 15, 2009 10:29 am Posts: 4107 Location: Russia
|
Multiplie weapon modes
I was thinking for my mod that i wanted the weapons to have different modes, like full auto and semi auto. Iwas also thinking of grenade launchers attached to the bottom of the machinegun, i know keybinding is possible in lua and that i could make different emitters with lua. Just one question, is this possible?
|
Wed May 20, 2009 2:30 pm |
|
|
Grif
REAL AMERICAN HERO
Joined: Sat Jan 27, 2007 10:25 pm Posts: 5655
|
Re: Multiplie weapon modes
Kinda?
Look at my zombie barf mod for one example of a key binding (though in this case it's actually a jetpack binding) can be used to switch weapon modes.
If you don't mind a custom actor, you can bind it to just about any function, including crouching and sharpaiming.
|
Wed May 20, 2009 2:44 pm |
|
|
Lizardheim
DRL Developer
Joined: Fri May 15, 2009 10:29 am Posts: 4107 Location: Russia
|
Re: Multiplie weapon modes
Just using this as my own personal dumping ground. My god someone should go back in time and hand me a dictionairy...
Last edited by Lizardheim on Fri Dec 03, 2010 12:47 am, edited 1 time in total.
|
Wed May 20, 2009 2:48 pm |
|
|
Darlos9D
Joined: Mon Jul 16, 2007 9:50 am Posts: 1512 Location: Tallahassee, FL
|
Re: Multiplie weapon modes
I'm actually way ahead of you here. Or not, considering that you can't do this sort of thing yet.
The problem is that you can't run scripts on things attached to actors. That means everything on the actor besides their torso, including any held weapons. So no, you can't just do "press button, change 'fire mode' variable in weapon" like I'm sure you're thinking about, or else I would have done it already.
Now, you could potentially base the code on the actor rather than the gun, but for that to work reliably you'd basically have to have it so the actor itself shoots stuff out (by spawning projectiles with lua) and any gun would be just for show. This'd be interesting for some kind of large machine with multiple weapons that doesn't ever switch weapons, but it'd be pretty useless for a regular actor.
|
Wed May 20, 2009 2:53 pm |
|
|
Lizardheim
DRL Developer
Joined: Fri May 15, 2009 10:29 am Posts: 4107 Location: Russia
|
Re: Multiplie weapon modes
Could i have the actor to just be able to use that function when the weapon is out?
|
Wed May 20, 2009 3:08 pm |
|
|
Grif
REAL AMERICAN HERO
Joined: Sat Jan 27, 2007 10:25 pm Posts: 5655
|
Re: Multiplie weapon modes
No, because guns, when held, are treated as attachables and completely away from our control.
Add a script to a gun that looks like this:
function Update(self) self:Activate(); end
While you're holding it, nothing happens. As soon as you drop it? It shoots all over the place.
|
Thu May 21, 2009 5:59 am |
|
|
CrazyMLC
Joined: Fri Dec 22, 2006 4:20 am Posts: 4772 Location: Good news everyone!
|
Re: Multiplie weapon modes
How about something like this. If (Self:IsAttached() == true) and (UInputMan:KeyHeld(_)) then Then somehow activate some emitter...
|
Thu May 21, 2009 6:15 am |
|
|
411570N3
Joined: Wed Jan 07, 2009 10:26 am Posts: 4074 Location: That quaint little British colony down south
|
Re: Multiplie weapon modes
The point they're trying to make is is that when anything's attached the Lua to go with it is completely ignored. In fact, any Lua even trying to mess with said attached parts won't work either.
|
Thu May 21, 2009 8:33 am |
|
|
Geti
Joined: Sun Jul 13, 2008 9:57 am Posts: 4886 Location: some compy
|
Re: Multiplie weapon modes
you can actually find the gun with a MOID search, store it in a variable and call gun:Update() if you so choose. This does require a global HDFirearm updater but whatever.
|
Mon Dec 06, 2010 2:35 am |
|
|
411570N3
Joined: Wed Jan 07, 2009 10:26 am Posts: 4074 Location: That quaint little British colony down south
|
Re: Multiplie weapon modes
Yeah, but be careful with it. Update being run twice causes a crash.
|
Mon Dec 06, 2010 2:44 am |
|
|
Coops
Joined: Wed Feb 17, 2010 12:07 am Posts: 1545 Location: That small peaceful place called Hell.
|
Re: Multiplie weapon modes
I am literally working on a Mod just like this.
It is quite hard and there are plenty of limits to it but yes it is feasible. Certain things like scopes are not as much though as the damn Sharplength is Read-Only..
|
Mon Dec 06, 2010 3:55 am |
|
|
|