View unanswered posts | View active topics It is currently Fri Mar 29, 2024 1:46 pm



Reply to topic  [ 6 posts ] 
 Alternate Fire 
Author Message
User avatar

Joined: Mon Jun 08, 2009 5:31 am
Posts: 12
Reply with quote
Post Alternate Fire
I woke up this morning and realized how to make alternate fire. It currently works wonderfully in Single shot weapons, but for auto-fire I can't see how it would work. I'm not going to post the script itself, this way you guys are forced to do it yourself.

For the sake of this 'tutorial' We are going to assume it is a shotgun, with an under-slung impact grenade launcher.

In order for this to work we need to create 1 extra object that isn't either fire method.

AddRound = Round -- The shotgun shell, make this your shotgun shell
Add*anything that gibs* -- The grenade

AddRound = round -- Must be an MOPixel or MOParticle (IE for lua) For the sake of this tutorial, this will be called "Decider"

The Magazine refers to "Decider" as it's ammo, and has no tracer.

Now for the Lua. I do not know all of the lua, so what I do not know is enclosed in *'s. to make this work, replace that, with the lua that does what it says. then it will work. Also this means you can't simply copy/paste it. it forces you to do it yourself.

function.create(self)
if *alternate fire key/button is held*
Then *replace self with the alternate fire w/ inherits velocity*
Else *replace self with normal fire w/ inherits velocity*
end

The result is for as long as you hold a key, your bullets will turn into your alternate fire otherwise it will be normal fire. the flaw at the moment, is that you can not add an alternate fire round-count. if it was included in the "decider" then every "decider" would have it's own round count, and you'd STILL have unlimited alternate fire.

If you created a global variable, than you'd have the same alternate round count, for every single copy of that gun on the map. if one gun runs out, there all out. so the result is that we do have alternate fire, we are just restricted to unlimited alternate fire. also the alternate fire will obviously use up a normal round.

I suggest you don't use an Autofire = 1 weapon for this because if you did, you'd end up spamming your alternate fire. there are on the other hand weapons that can use autofire with alternate fire, they will just be buggy as hell and they are any combination of machine gun / Digger / chainsaw / flame thrower / laser / sprayer / repeller
Nothing says awesome like a chainsaw, where the alternate fire is fire or laser.


Sun Jun 21, 2009 4:38 pm
Profile

Joined: Sat Jan 13, 2007 11:04 pm
Posts: 2932
Reply with quote
Post Re: Alternate Fire
Already done. See Lua Tech by mail2345.

EDIT: [/dreamcrusher]


Sun Jun 21, 2009 4:51 pm
Profile
User avatar

Joined: Mon Jun 08, 2009 5:31 am
Posts: 12
Reply with quote
Post Re: Alternate Fire
numgun wrote:
Already done. See Lua Tech by mail2345.

EDIT: [/dreamcrusher]


Aww, I totally missed that. I feel stupid now... but at a minimum, chainsaw flamethrowers have now been invented.


Sun Jun 21, 2009 5:02 pm
Profile

Joined: Sat Jan 13, 2007 11:04 pm
Posts: 2932
Reply with quote
Post Re: Alternate Fire
Yeah, but you pointed out a good fact how modes could be combined.


Sun Jun 21, 2009 5:06 pm
Profile
User avatar

Joined: Mon Jun 08, 2009 5:31 am
Posts: 12
Reply with quote
Post Re: Alternate Fire
numgun wrote:
Yeah, but you pointed out a good fact how modes could be combined.


I'm not sure what you mean. the fact that you could have a fire method for every key on the keyboard? or any combination of 2? (if A and if B else else else)

but if that's not what you mean, than what is?


Mon Jun 22, 2009 5:38 am
Profile

Joined: Sat Jan 13, 2007 11:04 pm
Posts: 2932
Reply with quote
Post Re: Alternate Fire
Nah I just ment simply if you have a rapid fire weapon, have a rapid fire alternative for it. And same for the opposite. Like chainsaw/laser as you pointed out.


Mon Jun 22, 2009 8:08 am
Profile
Display posts from previous:  Sort by  
Reply to topic   [ 6 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:  
cron
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group.
Designed by STSoftware for PTF.
[ Time : 0.047s | 15 Queries | GZIP : Off ]