Jump to content
Search In
  • More options...
Find results that contain...
Find results in...
  • 0
Valgilton

Trouble getting weapon to fire faster

Question

If so, can you please tell me how to implement it, I'm having a hard time figuring it out.

 

What I mean is, can you set the fire rate of a gun faster than 1 tic per frame? I'm trying to get a rapid-fire system in place.

 

Code:

  Fire:
    SPIN A 1 A_Firebullets(random(1, 5), random(1, 5), 2, 5)
    SPIN BCD 1 A_Refire

 

Is this the absolute fastest that I can make the weapon fire and animate at? or is there a workaround to allow higher speeds?

Share this post


Link to post

6 answers to this question

Recommended Posts

  • 0

I haven't heard of an engine that allows for faster than 1 tic between action executions, You can put 0 instead of 1 but those will fire at the same time as the one that precedes them, so yeah that's the fastest setup possible (unless you remove a frame or two...)

Share this post


Link to post
  • 0

One tic is the smallest time unit. You can at best reduce the number of frames, as lesser total duration of the animation leads to faster rate if the animation loops.

Share this post


Link to post
  • 0

You can have 0 length frames that let the weapon fire twice (or more) in the same tic. At 35fps it's actually very hard to tell each frame is doubled up, it just gives the sense you're firing faster.

 

It also looks like you have four frames of animation (SPIN A, B, C and D). So at most you'll only be firing once every 4 tics. Try reducing that to just two frames (perhaps SPIN A and C) and you'll double your current fire speed. 

 

Or add A_Firebullets to more than just the first frame. If you add it to all your frames, you'll fire at four times your current speed.

 

Share this post


Link to post
  • 0

Try this:

 

Fire:
    SPIN A 1 A_Firebullets(random(1, 5), random(1, 5), 2, 5)
    SPIN B 1 A_Firebullets(random(1, 5), random(1, 5), 2, 5)
    SPIN C 1 A_Firebullets(random(1, 5), random(1, 5), 2, 5)
    SPIN D
    {
    1 A_Firebullets(random(1, 5), random(1, 5), 2, 5);
  A_Refire;
  }
  SPIN

This will fire your gun every tic (instead of every 4th tic as you had).

 

Edit: Oops, sorry for double post. I meant to edit my reply above.

 

Edit 2: Double oops: there's a rogue SPIN at the end you'll need to removed. I can't as I'm on mobile.

 

Share this post


Link to post
  • 0

Thanks! Originally, i was considering cutting frames out of the process to "simulate" faster firing, but this looks better.

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×