[Won't change] Interrupting Guns with Winddown

Bugs that have been investigated and resolved somehow.

Moderator: Developers

Interrupting Guns with Winddown

Postby Ed the Bat » Mon Aug 20, 2012 7:25 am

This is a bit of an odd one, so forgive me if I can't explain it clearly. When using a gun that's specially animated to windup and winddown when being used, problems occur if it gets put away, or is about to. The next time it's fired, it ignores the windup.

Example:
Code: Select allExpand view
ACTOR WinddownGun : Chaingun replaces Chaingun
{
   Weapon.SlotNumber 4
   AttackSound "weapons/chngun"
   States
   {
   Fire:
      TNT1 A 0 A_PlaySound("weapons/minigunup",5)
      CHGG BABABA 2
      CHGG BABABABABABABABA 1
   Hold:
      TNT1 A 0 A_GunFlash
      CHGG AB 1 BRIGHT A_FireBullets(5.6,0,1,5)
      TNT1 A 0 A_JumpIfNoAmmo(2)
      TNT1 A 0 A_ReFire
      TNT1 A 0 A_PlaySound("weapons/minigundown",5)
      CHGG ABABABABABAB 1
      CHGG ABABABAB 2
      Goto Ready
   Flash:
      CHGF A 1 A_Light1
      CHGF B 1 A_Light2
      Goto LightDone
   }
}

As you see, the gun will go directly to its winddown if the shooter runs out of ammo, then it would put itself away as normal. However, if the player happens across more ammo before it finishes winding down, it won't put itself away. Then, the next time it's fired, it will jump past the windup and fire immediately. The same thing will happen if the player dies while shooting the gun and is brought back via the 'resurrect' console command.

This example WAD provides the means to test both scenarios. Grab the gun and fire it until it's empty, then pick up the bullet box before it finishes winding down. Alternatively, kill yourself in the slime pit or with the 'kill' console command while firing, then resurrect and keep firing.
Attachments
winddowntest.wad
(21.43 KiB) Downloaded 18 times
User avatar
Ed the Bat
 
Joined: 03 May 2012
Location: Maryland, US

Re: Interrupting Guns with Winddown

Postby Xtyfe » Mon Aug 20, 2012 7:50 am

I'm not sure how to explain your problem, but you may have better luck if you used A_JumpifNoAmmo before it fires anything.

Here is an example of a similar system, and I have never had such an issue.
Code: Select allExpand view
Actor XtGatlinggun : DoomWeapon replaces Chaingun
{
+WEAPON.NOAUTOAIM
+WEAPON.NOALERT
//Radius 38
//Height 12
Weapon.SelectionOrder 2
Weapon.AmmoGive 20
Weapon.AmmoType "XtClip"
//Weapon.AmmoType "XtAmmoBox"
Weapon.AmmoUse 1
Weapon.UpSound "weapons/switch"
Weapon.BobStyle Alpha
Inventory.PickupSound "misc/weapon"
Inventory.PickupMessage "$TXT_GATLINGGUN"
Tag "$TAG_GATLINGGUN"
States
   {
   Spawn:
      GTLG A -1
      Stop
   Ready:
      GATG A 1 A_WeaponReady
      Loop
   Deselect:
      TNT1 A 0 A_StopSound (7)
      TNT1 A 0 A_Lower
      GATG A 1 A_Lower
      Loop
   Select:
      TNT1 A 0 A_Raise
      GATG A 1 A_Raise
      Loop
   Fire:
      TNT1 A 0 A_PlaySound ("weapons/chainwindup", 6, 1, 0)
      GATG ABCD 3
      GATG ABCD 2
      Goto Hold
   Hold:
      TNT1 A 0 A_PlaySound ("weapons/chainwindloop", 7, 1, 1)
      TNT1 A 0 A_JumpIfNoAmmo ("WindDown")
      TNT1 A 0 A_GunFlash
      TNT1 A 0 A_AlertMonsters (2048)
      TNT1 A 0 A_PlaySound ("weapons/chaingun", CHAN_WEAPON, 1, 0)
      TNT1 A 0 A_FireCustomMissile ("XtGatlingTracer", FRandom(-3.0, 3.0), 1, 0, 0, 0, FRandom(-3.0, 3.0))
      GATG E 1 Bright A_SetPitch (Pitch-0.7)
      GATG B 1
      GATG C 1 A_SetPitch (Pitch+0.7)
      GATG D 1
      TNT1 A 0 A_JumpIfNoAmmo ("WindDown")
      TNT1 A 0 A_GunFlash
      TNT1 A 0 A_AlertMonsters (2048)
      TNT1 A 0 A_PlaySound ("weapons/chaingun", CHAN_WEAPON, 1, 0)
      TNT1 A 0 A_FireCustomMissile ("XtGatlingTracer", FRandom(-3.0, 3.0), 1, 0, 0, 0, FRandom(-3.0, 3.0))
      GATG F 1 Bright A_SetPitch (Pitch-0.7)
      GATG B 1
      GATG C 1 A_SetPitch (Pitch+0.7)
      GATG D 1
      TNT1 A 0 A_JumpIfNoAmmo ("WindDown")
      TNT1 A 0 A_GunFlash
      TNT1 A 0 A_AlertMonsters (2048)
      TNT1 A 0 A_PlaySound ("weapons/chaingun", CHAN_WEAPON, 1, 0)
      TNT1 A 0 A_FireCustomMissile ("XtGatlingTracer", FRandom(-3.0, 3.0), 1, 0, 0, 0, FRandom(-3.0, 3.0))
      GATG E 1 Bright A_SetPitch (Pitch-0.7)
      GATG B 1
      GATG C 1 A_SetPitch (Pitch+0.7)
      GATG D 1
      TNT1 A 0 A_JumpIfNoAmmo ("WindDown")
      TNT1 A 0 A_GunFlash
      TNT1 A 0 A_AlertMonsters (2048)
      TNT1 A 0 A_PlaySound ("weapons/chaingun", CHAN_WEAPON, 1, 0)
      TNT1 A 0 A_FireCustomMissile ("XtGatlingTracer", FRandom(-3.0, 3.0), 1, 0, 0, 0, FRandom(-3.0, 3.0))
      GATG F 1 Bright A_SetPitch (Pitch-0.7)
      GATG B 1
      GATG C 1 A_SetPitch (Pitch+0.7)
      GATG D 1
      TNT1 A 0 A_JumpIfNoAmmo ("WindDown")
      TNT1 A 0 A_GunFlash
      TNT1 A 0 A_AlertMonsters (2048)
      TNT1 A 0 A_PlaySound ("weapons/chaingun", CHAN_WEAPON, 1, 0)
      TNT1 A 0 A_FireCustomMissile ("XtGatlingTracer", FRandom(-3.0, 3.0), 1, 0, 0, 0, FRandom(-3.0, 3.0))
      GATG E 1 Bright A_SetPitch (Pitch-0.7)
      GATG B 1
      GATG C 1 A_SetPitch (Pitch+0.7)
      GATG D 1
      TNT1 A 0 A_JumpIfNoAmmo ("WindDown")
      TNT1 A 0 A_GunFlash
      TNT1 A 0 A_AlertMonsters (2048)
      TNT1 A 0 A_PlaySound ("weapons/chaingun", CHAN_WEAPON, 1, 0)
      TNT1 A 0 A_FireCustomMissile ("XtGatlingTracer", FRandom(-3.0, 3.0), 1, 0, 0, 0, FRandom(-3.0, 3.0))
      GATG F 1 Bright A_SetPitch (Pitch-0.7)
      GATG B 1
      GATG C 1 A_SetPitch (Pitch+0.7)
      GATG D 1
      TNT1 A 0 A_ReFire
      Goto WindDown
   WindDown:
      GATG ABCD 2
      TNT1 A 0 A_StopSound (7)
      TNT1 A 0 A_PlaySound ("weapons/chainwinddown", 6, 1, 0)
      GATG ABCD 3
      Goto Ready
   Flash:
      TNT1 A 1 A_Light (1)
      TNT1 A 2 A_Light (2)
      TNT1 A 1 A_Light (0)
      Goto LightDone
   }
}
Xtyfe
 
Joined: 14 Dec 2007
Location: Kitchener, Ontario

Re: Interrupting Guns with Winddown

Postby Ed the Bat » Mon Aug 20, 2012 7:57 am

This did nothing to fix it. The gun still goes directly to firing.
User avatar
Ed the Bat
 
Joined: 03 May 2012
Location: Maryland, US

Re: Interrupting Guns with Winddown

Postby Xtyfe » Mon Aug 20, 2012 8:05 am

Hmm, It seems I was wrong and do experience this issue as well. My first idea was to add A_WeaponReady (WRF_NOFIRE) to the winddown frames but that did nothing.

The issue seems to be that if you don't stop holding your finger on the fire button it will keep using the hold state if picking up more ammo after it ran out regardless of its past A_ReFire or jumped to another state after.

Edit: Scratch that, I found a fix for us both. A_ClearReFire

Code: Select allExpand view
ACTOR WinddownGun : Chaingun replaces Chaingun
{
   Weapon.SlotNumber 4
   AttackSound "weapons/chngun"
   States
   {
   Fire:
      TNT1 A 0 A_PlaySound("weapons/minigunup",5)
      CHGG BABABA 2
      CHGG BABABABABABABABA 1
   Hold:
      TNT1 A 0 A_GunFlash
      CHGG AB 1 BRIGHT A_FireBullets(5.6,0,1,5)
      TNT1 A 0 A_JumpIfNoAmmo(2)
      TNT1 A 0 A_ReFire
      TNT1 A 0 A_PlaySound("weapons/minigundown",5)
      CHGG ABABABABABAB 1
      CHGG ABABABAB 2
      TNT1 A 0 A_ClearReFire
      Goto Ready
   Flash:
      CHGF A 1 A_Light1
      CHGF B 1 A_Light2
      Goto LightDone
   }
}
Last edited by Xtyfe on Mon Aug 20, 2012 8:12 am, edited 2 times in total.
Xtyfe
 
Joined: 14 Dec 2007
Location: Kitchener, Ontario

Re: Interrupting Guns with Winddown

Postby Ed the Bat » Mon Aug 20, 2012 8:08 am

This will even happen if you let go of the trigger. The next time the gun is fired, it jumps directly to the Hold state.
User avatar
Ed the Bat
 
Joined: 03 May 2012
Location: Maryland, US

Re: Interrupting Guns with Winddown

Postby Xtyfe » Mon Aug 20, 2012 8:09 am

Reread my post, found a fix :D
Xtyfe
 
Joined: 14 Dec 2007
Location: Kitchener, Ontario

Re: Interrupting Guns with Winddown

Postby Ed the Bat » Mon Aug 20, 2012 8:13 am

Beautiful! This does the trick. The only question in my mind now is why it doesn't happen automatically when running out of ammo or getting killed. I mean, maybe there's a reason, I just don't know it.

But, if I can manually work around it, then I'm happy enough! Thanks for the help!

EDIT: Just noticed that this won't fix the issue with dying/resurrecting. But that's a very unusual circumstance anyway, and it can probably be spackled over by putting A_ClearRefire in the Deselect state. Just another thing to keep in mind, I s'pose. :)
User avatar
Ed the Bat
 
Joined: 03 May 2012
Location: Maryland, US

Re: Interrupting Guns with Winddown

Postby Xtyfe » Mon Aug 20, 2012 8:34 am

Indeed, I think that would fix that if done that way. I have put stuff in the Deselect state too to fix similar things before and it works.
Xtyfe
 
Joined: 14 Dec 2007
Location: Kitchener, Ontario

Re: Interrupting Guns with Winddown

Postby Gez » Mon Aug 20, 2012 8:35 am

Ed the Bat wrote:The only question in my mind now is why it doesn't happen automatically when running out of ammo or getting killed. I mean, maybe there's a reason, I just don't know it.

Usually, for this kind the question, the answer is "it would change original gun behavior and everybody who isn't a modder would complain".
Gez
 
Joined: 06 Jul 2007


Return to Closed Bugs

Who is online

Users browsing this forum: No registered users and 0 guests