Jump to content
Search In
  • More options...
Find results that contain...
Find results in...
Sign in to follow this  
NaturalTvventy

Giving a warmup to a weapon

Recommended Posts

Hey y'alls. I'm trying to create a warmup pause for a weapon in zdoom before it starts blasting away, but I have no idea how. Here's the code for it's firing.

Fire:
MNGG A 0 A_GunFlash
MNGG A 2 A_FireBullets(5, 1, 1, 5)
MNGG B 2 A_FireBullets(5, 1, 1, 5)
MNGG B 0 A_ReFire
MNGG B 2
MNGG A 5
MNGG B 8
MNGG A 11
MNGG B 14
MNGG A 17
goto Ready

as anyone in the know can see it has a cooldown already, but i want a warmup too. little help?

Thx,

NT

Share this post


Link to post

Fire:
MNGG B 17
MNGG A 14
MNGG B 11
MNGG A 8
MNGG B 5
MNGG A 2
Hold:
MNGG A 0 A_GunFlash
MNGG A 2 A_FireBullets(5, 1, 1, 5)
MNGG B 2 A_FireBullets(5, 1, 1, 5)
MNGG B 0 A_ReFire
MNGG B 2
MNGG A 5
MNGG B 8
MNGG A 11
MNGG B 14
MNGG A 17
goto Ready

Share this post


Link to post

Well, almost perfect. The only problem with this is even if you just tap the button you have to go through the whole warm up and first couple shots. any way to make it so that when you take your finger off the trigger the sequence stops, AND only have the cooldown if some rounds have gone off?

Share this post


Link to post

try this:

  Fire:
    MNGG B 0 A_JumpIf(args[0] == 1,"Warm1") //depending on how far the 
    MNGG B 0 A_JumpIf(args[0] == 2,"Warm2") //the warmup sequence is,
    MNGG B 0 A_JumpIf(args[0] == 3,"Warm3") //jump to one of these
    MNGG B 0 A_JumpIf(args[0] == 4,"Warm4") //labels.
    MNGG B 0 A_JumpIf(args[0] == 5,"Warm5")
    MNGG B 0 A_JumpIf(args[0] == 6,"WarmedUp")
    MNGG B 17 A_SetArg (0,args[0]+1) //args[0] <- this is the warmup variable
    MNGG B 0 A_ReFire //jump back to "Fire:" if key is held.
    MNGG B 0 A_SetArg (0,0) //else: reset warmup value
    Goto Ready
  Warm1:
    MNGG A 14 A_SetArg (0,args[0]+1)
    MNGG A 0 A_ReFire
    MNGG B 0 A_SetArg (0,0)
    Goto Ready
  Warm2:
    MNGG B 11 A_SetArg (0,args[0]+1)
    MNGG B 0 A_ReFire
    MNGG B 0 A_SetArg (0,0)
    Goto Ready
  Warm3:
    MNGG A 8 A_SetArg (0,args[0]+1)
    MNGG A 0 A_ReFire
    MNGG B 0 A_SetArg (0,0)
    Goto Ready
  Warm4:
    MNGG B 5 A_SetArg (0,args[0]+1)
    MNGG B 0 A_ReFire
    MNGG B 0 A_SetArg (0,0)
    Goto Ready
  Warm5:
    MNGG A 2 A_SetArg (0,args[0]+1)
    MNGG A 0 A_ReFire
    MNGG B 0 A_SetArg (0,0)
    Goto Ready
  WarmedUp:
    MNGG A 0 //A_GunFlash
    MNGG A 2 A_FireBullets(5, 1, 1, 5)
    MNGG B 2 A_FireBullets(5, 1, 1, 5)
    MNGG B 0 A_ReFire
    MNGG B 0 A_SetArg (0,0) //Reset warmup variable if fire key is no longer held
    MNGG B 2
    MNGG A 5
    MNGG B 8
    MNGG A 11
    MNGG B 14
    MNGG A 17
    goto Ready

Share this post


Link to post
Worst said:

try this:
*code*


That's using a ton of particularly potent explosives to unlock a door. The only reason you'd use something like that is to enable refire when the barrels are spinning down.

Share this post


Link to post

Well yeah, but would you rather mix ACS to the weapon decorate to figure out if the fire key is held? This is less likely to clash with other mods which might use ACS.. (admitted its not that often that they clash :p)

I know that also using user_variables would be better off than args[] but that'd also mean changing the playerclass aswell.
..I would do that myself, but I figured a simple example would be more easier to understand, than having one with a DECORATE, KEYCONF, ACS and LOADACS lump.

Share this post


Link to post

that code works pretty darn good, so thanks for it. every so now and then though the gun just jumps straight into firing, skipping the warmup completely. any idea why?

Thx,

NT

Share this post


Link to post

I do believe i figured out how to make it skip the warm-up. when you run out of ammo and then automatically switch to another weapon, if you then pick up some ammo and pull up the gun again while holding the trigger it skips the warmup sequence.

Share this post


Link to post

Its probably that when you run out of ammo, but still hold the fire key, it will still jump from the A_ReFire, and at the same time miss the A_SetArg (0,0) which resets the warmup. (those cant be swapped either, otherwise you'd be doing the warmup each and everytime)

however, maybe this works better:

Fire:
    MNGG B 0 A_SetArg (0,0)
    Goto Hold
  Hold:
    MNGG B 0 A_JumpIf(args[0] == 1,"Warm1") //depending on how far the 
    MNGG B 0 A_JumpIf(args[0] == 2,"Warm2") //the warmup sequence is,
    MNGG B 0 A_JumpIf(args[0] == 3,"Warm3") //jump to one of these
    MNGG B 0 A_JumpIf(args[0] == 4,"Warm4") //labels.
    MNGG B 0 A_JumpIf(args[0] == 5,"Warm5")
    MNGG B 0 A_JumpIf(args[0] == 6,"WarmedUp")
    MNGG B 17 A_SetArg (0,args[0]+1) //args[0] <- this is the warmup variable
    MNGG B 0 A_ReFire //jump back to "Hold:" if key is held.
    Goto Ready
  Warm1:
    MNGG A 14 A_SetArg (0,args[0]+1)
    MNGG A 0 A_ReFire
    Goto Ready
  Warm2:
    MNGG B 11 A_SetArg (0,args[0]+1)
    MNGG B 0 A_ReFire
    Goto Ready
  Warm3:
    MNGG A 8 A_SetArg (0,args[0]+1)
    MNGG A 0 A_ReFire
    Goto Ready
  Warm4:
    MNGG B 5 A_SetArg (0,args[0]+1)
    MNGG B 0 A_ReFire
    Goto Ready
  Warm5:
    MNGG A 2 A_SetArg (0,args[0]+1)
    MNGG A 0 A_ReFire
    Goto Ready
  WarmedUp:
    MNGG A 0 //A_GunFlash
    MNGG A 2 A_FireBullets(5, 1, 1, 5)
    MNGG B 2 A_FireBullets(5, 1, 1, 5)
    MNGG B 0 A_ReFire
    MNGG B 2
    MNGG A 5
    MNGG B 8
    MNGG A 11
    MNGG B 14
    MNGG A 17
    goto Ready

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
Sign in to follow this  
×