Glitch:Weapon Pickup Sprite Showing Up While Firing

Ask about ACS, DECORATE, ZScript, or any other scripting questions here!

Moderator: GZDoom Developers

Forum rules
Before asking on how to use a ZDoom feature, read the ZDoom wiki first. If you still don't understand how to use a feature, then ask here.

Please bear in mind that the people helping you do not automatically know how much you know. You may be asked to upload your project file to look at. Don't be afraid to ask questions about what things mean, but also please be patient with the people trying to help you. (And helpers, please be patient with the person you're trying to help!)
Xx_aogp_xX

Glitch:Weapon Pickup Sprite Showing Up While Firing

Post by Xx_aogp_xX »

Well, I'm Making A Mod Named "Shells The Way Id Did" That Just Adds Casings To Doom.
And There Is A Glitch With The Chaingun That Makes The Pickup Sprite Appear On The Corner Of The Screen When You Shoot.

Here Is The Code So Someone Can Fix It.

ACTOR ShelledChaingun : DoomWeapon Replaces Chaingun
{
Weapon.SelectionOrder 700
Weapon.AmmoUse 1
Weapon.AmmoGive 20
Weapon.AmmoType "Clip"
Inventory.PickupMessage "$GOTCHAINGUN" // "You got the chaingun"
Obituary "$OB_MPCHAINGUN" // "%o was mowed down by %k's chaingun."
Tag "$TAG_CHAINGUN"
States
{
Ready:
CHGG A 1 A_WeaponReady
Loop
Deselect:
CHGG A 1 A_Lower
Loop
Select:
CHGG A 1 A_Raise
Loop
Fire:
FIRC B 0 A_SpawnItemEx("Casings",28, 0, 30, 0,5,5,0,"",0,"")
FIRC B 4 A_FireCGun
FIRC C 0 A_SpawnItemEx("Casings",28, 0, 30, 0,5,5,0,"",0,"")
FIRC C 4 A_FireCGun
FIRC C 0 A_ReFire
Goto Ready
Flash:
FIRC A 0 Bright A_Light1
Spawn:
MGUN A -1
Stop
}
}

Can Someone Please Fix This.
User avatar
Player701
 
 
Posts: 1693
Joined: Wed May 13, 2009 3:15 am
Graphics Processor: nVidia with Vulkan support

Re: Glitch:Weapon Pickup Sprite Showing Up While Firing

Post by Player701 »

Xx_aogp_xX wrote: Fri Dec 06, 2024 9:01 am Flash:
FIRC A 0 Bright A_Light1
Spawn:
MGUN A -1
Stop
You need at least to add another Stop just before Spawn:, i.e.:

Code: Select all

Flash:
FIRC A 0 Bright A_Light1
Stop // <-- Here
Spawn:
MGUN A -1
Stop
But, also note that your flash state sequence is clearly incorrectly made. You are calling A_Light1 to raise the level of illumination, but there is nothing in your code that resets it afterwards. To fix this error, you have to add a call to A_Light0 to the end of the sequence, while also increasing the duration of the state where A_Light1 is called so that its effect lasts a non-zero amount of time. For example:

Code: Select all

Flash:
FIRC A 4 A_Light1
FIRC A 0 A_Light0
Stop
I don't know if your FIRCA sprite is supposed to be visible, or whether it is just a placeholder and the actual flash is drawn in the main attack state. In the latter case, simply replace it with TNT1.

Return to “Scripting”