Hi everybody! I'm in a dilly of a pickle now, and gosh darned it if I ain't stuck like a bullfrog up a hickory stump! I'm working on a mod for GZDoom (currently version 4.10) and I want the player to be able to dual wield chain guns. Several strange things have been happening with the weapon when it runs out of ammo. Initially, instead of switching to another weapon when it ran out of ammo, it would continue firing (without shooting bullet puffs). This was strange looking to say the least so I tried to fix it. putting the -WEAPON.AMMO_OPTIONAL flag on it didn't help, so I tried to make a less ugly thing for the weapon to do that would let the player know instantly that they were out of ammo. What is happening is easy to notice but it's pretty ugly.
Giving it a A_Jumpifnoammo("Deselect") state before firing results in the weapon disappearing and becoming unusable. A_jumpifnoammo("nobullets") results in a weird flickering behavior that isn't much better than firing blanks. Working with Jekyllgrim's EDW weapon and ctlcdn's Mismatched pistols as templates I've rebuilt the weapon several times and always come down to this same behavior.
Ditto when I use
if (CountInv("Bullets") <= 0)
return ResolveState("Nobullets"); //if no ammo, jump to Reload sequence
return ResolveState(null); //otherwise, don't jump, move on to the next frame
Does anyone know anything that can be done about it?
This is the most recent attempt:
Class DChainGuns : Weapon
{
Default
{
Inventory.PickupMessage "You Got The Chainguns! (2)";
Weapon.SelectionOrder 750;
Weapon.Slotnumber 4;
Weapon.AmmoType1 "Bullets";
Weapon.AmmoGive1 25; //50
Weapon.Ammouse1 1;
Weapon.Bobstyle 'InverseSmooth';
Weapon.BobRangeX 0.7;
Weapon.BobRangeY 0.5;
Weapon.BobSpeed 1.85;
Inventory.PickupSound "CHGNPKUP";
Weapon.UpSound "CHGNPKUP";
}
States
{
Spawn:
DMGN A -1;
Loop;
Ready:
TNT1 A 1 A_WeaponReady(WRF_NOFIRE);
Loop;
Select:
TNT1 A 0 {
A_PlaySound("Weapon/WhooshSFX", 6, 1);
A_PlaySound("Weapon/AKPRaise", 5, 1);
A_ZoomFactor(1);
}
TNT1 A 1 A_Raise();
TNT1 AAAAAAAAAAAAAA 0 A_Raise();
Goto RaiseAnim;
RaiseAnim:
AKPL DCBA 1;
TNT1 A 0 {A_Overlay(3, "IdleR"); A_Overlay(-3, "IdleL");}
Goto Ready;
Deselect:
TNT1 A 0 {
A_ClearOverlays(3,-3);
A_PlaySound("Weapon/WhooshSFX", 6, 1);
A_ZoomFactor(1);
}
AKPL ABCD 1;
Goto LowerAnim;
LowerAnim:
TNT1 AAAAAAAAAAAA 0 A_Lower();
TNT1 A 1 A_Lower();
Loop;
Fire:
Goto Ready;
IdleL:
DBCG I 1 A_JumpIf(GetPlayerInput(INPUT_BUTTONS) & BT_ALTATTACK, "FireL");
TNT1 A 0 A_JumpIf(GetPlayerInput(INPUT_BUTTONS) & BT_ALTATTACK && (CountInv("Bullets") <= 0), "Left.NoBullets");
Loop;
IdleR:
DBCG A 1 A_JumpIf(GetPlayerInput(INPUT_BUTTONS) & BT_ATTACK, "FireR");
TNT1 A 0 A_JumpIf(GetPlayerInput(INPUT_BUTTONS) & BT_ATTACK && (CountInv("Bullets") <= 0), "Right.NoBullets");
Loop;
FireR:
TNT1 A 0 A_JumpIfNoAmmo("Right.NoBullets");
DBCG B 1
{
TakeInventory("Bullets",1);
A_OverlayOffset(OverlayID(),0,0,WOF_INTERPOLATE);
A_OverlayScale(OverlayID(),1,1,WOF_INTERPOLATE);
//Do the same with the muzzle flash so it's synced
A_StartSound("weapons/dblchngun", CHAN_WEAPON);
A_FireBullets(5.6, 0, 1, 5, "BulletPuff");
A_AlertMonsters();
}
DBCG CDEF 1;
Goto IdleR;
Right.NoBullets:
DBCG C 1
{
A_StartSound("CGCLIK", CHAN_WEAPON);
}
DGCG DE 1;
DGCG F 1 A_Refire("Right.NoBullets");
Goto IdleR;
Left.NoBullets:
DBCG K 1 {
A_StartSound("CGCLIK", CHAN_WEAPON);
}
DGCG LM 1;
DGCG N 1 A_Refire("Left.NoBullets");
Goto IdleL;
FireL:
TNT1 A 0 A_JumpIfNoAmmo("Left.NoBullets");
DBCG J 1
{
TakeInventory("Bullets",1);
A_OverlayOffset(OverlayID(),0,0,WOF_INTERPOLATE);
A_OverlayScale(OverlayID(),1,1,WOF_INTERPOLATE);
A_StartSound("weapons/dblchngun", CHAN_WEAPON);
A_FireBullets(5.6, 0, 1, 5, "BulletPuff");
A_AlertMonsters();
}
DBCG KLMN 1;
Goto IdleL;
}
}
Class Bullets : Ammo
{
Default
{
Scale 0.25;
Inventory.PickupMessage "Got some Bullets"; // "Picked up a clip."
Inventory.Amount 11;
Inventory.MaxAmount 300;
Ammo.BackpackAmount 11;
Ammo.BackpackMaxAmount 600;
Inventory.Icon "BHUDB0";
}
States
{
Spawn:
AMM1 A -1;
Stop;
}
}
Class BulletBox : Bullets
{
Default
{
Scale 1;
Inventory.PickupMessage "$GOTCLIPBOX"; // "Picked up a box of bullets."
Inventory.Amount 100;
Inventory.PickupSound "P_AMMOB";
}
States
{
Spawn:
AMMO A -1;
Stop;
}
}
Which results in this:
Woe is me, for I am the saddest man who ever wielded two chain-guns!
Hi everybody! I'm in a dilly of a pickle now, and gosh darned it if I ain't stuck like a bullfrog up a hickory stump! I'm working on a mod for GZDoom (currently version 4.10) and I want the player to be able to dual wield chain guns. Several strange things have been happening with the weapon when it runs out of ammo. Initially, instead of switching to another weapon when it ran out of ammo, it would continue firing (without shooting bullet puffs). This was strange looking to say the least so I tried to fix it. putting the -WEAPON.AMMO_OPTIONAL flag on it didn't help, so I tried to make a less ugly thing for the weapon to do that would let the player know instantly that they were out of ammo. What is happening is easy to notice but it's pretty ugly.
Giving it a A_Jumpifnoammo("Deselect") state before firing results in the weapon disappearing and becoming unusable. A_jumpifnoammo("nobullets") results in a weird flickering behavior that isn't much better than firing blanks. Working with Jekyllgrim's EDW weapon and ctlcdn's Mismatched pistols as templates I've rebuilt the weapon several times and always come down to this same behavior.
Ditto when I use
if (CountInv("Bullets") <= 0)
return ResolveState("Nobullets"); //if no ammo, jump to Reload sequence
return ResolveState(null); //otherwise, don't jump, move on to the next frame
Does anyone know anything that can be done about it?
This is the most recent attempt:
Class DChainGuns : Weapon { Default { Inventory.PickupMessage "You Got The Chainguns! (2)"; Weapon.SelectionOrder 750; Weapon.Slotnumber 4; Weapon.AmmoType1 "Bullets"; Weapon.AmmoGive1 25; //50 Weapon.Ammouse1 1; Weapon.Bobstyle 'InverseSmooth'; Weapon.BobRangeX 0.7; Weapon.BobRangeY 0.5; Weapon.BobSpeed 1.85; Inventory.PickupSound "CHGNPKUP"; Weapon.UpSound "CHGNPKUP"; } States { Spawn: DMGN A -1; Loop; Ready: TNT1 A 1 A_WeaponReady(WRF_NOFIRE); Loop; Select: TNT1 A 0 { A_PlaySound("Weapon/WhooshSFX", 6, 1); A_PlaySound("Weapon/AKPRaise", 5, 1); A_ZoomFactor(1); } TNT1 A 1 A_Raise(); TNT1 AAAAAAAAAAAAAA 0 A_Raise(); Goto RaiseAnim; RaiseAnim: AKPL DCBA 1; TNT1 A 0 {A_Overlay(3, "IdleR"); A_Overlay(-3, "IdleL");} Goto Ready; Deselect: TNT1 A 0 { A_ClearOverlays(3,-3); A_PlaySound("Weapon/WhooshSFX", 6, 1); A_ZoomFactor(1); } AKPL ABCD 1; Goto LowerAnim; LowerAnim: TNT1 AAAAAAAAAAAA 0 A_Lower(); TNT1 A 1 A_Lower(); Loop; Fire: Goto Ready; IdleL: DBCG I 1 A_JumpIf(GetPlayerInput(INPUT_BUTTONS) & BT_ALTATTACK, "FireL"); TNT1 A 0 A_JumpIf(GetPlayerInput(INPUT_BUTTONS) & BT_ALTATTACK && (CountInv("Bullets") <= 0), "Left.NoBullets"); Loop; IdleR: DBCG A 1 A_JumpIf(GetPlayerInput(INPUT_BUTTONS) & BT_ATTACK, "FireR"); TNT1 A 0 A_JumpIf(GetPlayerInput(INPUT_BUTTONS) & BT_ATTACK && (CountInv("Bullets") <= 0), "Right.NoBullets"); Loop; FireR: TNT1 A 0 A_JumpIfNoAmmo("Right.NoBullets"); DBCG B 1 { TakeInventory("Bullets",1); A_OverlayOffset(OverlayID(),0,0,WOF_INTERPOLATE); A_OverlayScale(OverlayID(),1,1,WOF_INTERPOLATE); //Do the same with the muzzle flash so it's synced A_StartSound("weapons/dblchngun", CHAN_WEAPON); A_FireBullets(5.6, 0, 1, 5, "BulletPuff"); A_AlertMonsters(); } DBCG CDEF 1; Goto IdleR; Right.NoBullets: DBCG C 1 { A_StartSound("CGCLIK", CHAN_WEAPON); } DGCG DE 1; DGCG F 1 A_Refire("Right.NoBullets"); Goto IdleR; Left.NoBullets: DBCG K 1 { A_StartSound("CGCLIK", CHAN_WEAPON); } DGCG LM 1; DGCG N 1 A_Refire("Left.NoBullets"); Goto IdleL; FireL: TNT1 A 0 A_JumpIfNoAmmo("Left.NoBullets"); DBCG J 1 { TakeInventory("Bullets",1); A_OverlayOffset(OverlayID(),0,0,WOF_INTERPOLATE); A_OverlayScale(OverlayID(),1,1,WOF_INTERPOLATE); A_StartSound("weapons/dblchngun", CHAN_WEAPON); A_FireBullets(5.6, 0, 1, 5, "BulletPuff"); A_AlertMonsters(); } DBCG KLMN 1; Goto IdleL; } } Class Bullets : Ammo { Default { Scale 0.25; Inventory.PickupMessage "Got some Bullets"; // "Picked up a clip." Inventory.Amount 11; Inventory.MaxAmount 300; Ammo.BackpackAmount 11; Ammo.BackpackMaxAmount 600; Inventory.Icon "BHUDB0"; } States { Spawn: AMM1 A -1; Stop; } } Class BulletBox : Bullets { Default { Scale 1; Inventory.PickupMessage "$GOTCLIPBOX"; // "Picked up a box of bullets." Inventory.Amount 100; Inventory.PickupSound "P_AMMOB"; } States { Spawn: AMMO A -1; Stop; } }
Which results in this:
Woe is me, for I am the saddest man who ever wielded two chain-guns!
Share this post
Link to post