Difference between revisions of "Talk:Semi or Burst fire"

From Valve Developer Community
Jump to: navigation, search
(Firing minimum # bullets)
m
Line 24: Line 24:
 
== Firing minimum # bullets ==
 
== Firing minimum # bullets ==
  
Is there a way to have the player fire a minimum of say, 3 bullets?
+
Is there a way to have the player fire a minimum of say, 3 bullets? {{unsigned| eadly Contagin}}
 +
 
 +
:Well it all depends how you want it to work. Just having a seperate function shoot the bullet and then having primary attack manage the calls to that would be my approach... Have something determine which set to call, bool/int/char depends how many shooting modes you want. Throw that into a switch/case setup. Single shot calls it once and sets next primary attack float. Burst fires, waits, fires, waits, fires, and then sets next fire time. Automatic works the same as single but with a much smaller time between shots. Then anything fancy you wanna do like making one more accurate than the other you build into the actual shot function. --[[User:Angry Beaver|Angry Beaver]] 23:33, 18 Nov 2006 (PST)

Revision as of 23:33, 18 November 2006

Wouldn't bool be a more efficient data type here? --TomEdwards 13:51, 25 Jul 2006 (PDT)

Is this article finished? Doesn't seem like that... --dutchmega 13:57, 25 Jul 2006 (PDT)

Yeah, bool would be more efficient for semi fire only. The burst function needs the integer. Apart that, this is finished. It is not the most elegent way of doing it, but it works fine here. As I don't need to actually select the fire mode in my mod, I didn't work out that part. I just gave a hint. To make that work you would need to set up the bool m_bSemi and add that to the ItemPostFrame procedure

if ( pOwner->m_nButtons & IN_ATTACK2  )
{ if (m_bSemi){m_bSemi=false;} else {m_bSemi=true;}}

Could someone figure out how to get CHLSelectFireMachineGun working properly, with the 3-round burst switchable and whatnot? maybe as a follow-up to this article?

Selective fire

You can find one solution for that here: http://hl2coding.com/forums/viewtopic.php?p=6568#6568

- Pendra

TODO: Find out what it does.

I'm pretty sure that SendPropInt() registers the passed variable for networking. Anytime it is changed on the server, the new value is sent to the client(s). Its not exactly client prediction, but I suppose it can serve the same purpose. - TIDexter

Pretty sure? Is there any way that you could check the source code for its function and positively determine what it does? Considering that the one who wrote the basics for the article sounded a bit noob-ish, it might not be a mystery what it does - it was just that he didn't know or care to find out. --Andreasen 12:45, 3 Oct 2006 (PDT)

Firing minimum # bullets

Is there a way to have the player fire a minimum of say, 3 bullets? Unsigned comment added by eadly Contagin (talkcontribs). Please use four tildes (~~~~) to sign your username.

Well it all depends how you want it to work. Just having a seperate function shoot the bullet and then having primary attack manage the calls to that would be my approach... Have something determine which set to call, bool/int/char depends how many shooting modes you want. Throw that into a switch/case setup. Single shot calls it once and sets next primary attack float. Burst fires, waits, fires, waits, fires, and then sets next fire time. Automatic works the same as single but with a much smaller time between shots. Then anything fancy you wanna do like making one more accurate than the other you build into the actual shot function. --Angry Beaver 23:33, 18 Nov 2006 (PST)