(Help) Chaingun's frame change problem

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!)
Post Reply
User avatar
Shotgun guy
Posts: 73
Joined: Sat Mar 24, 2018 5:35 am
Location: Hungary
Contact:

(Help) Chaingun's frame change problem

Post by Shotgun guy »

I changed the Chaingun's frame,but it doesn't work as in Doom. I used this:https://zdoom.org/wiki/Classes:Chaingun and https://zdoom.org/wiki/A_FireCGun

Code: Select all

//Weapons: Ultra Chaingun

ACTOR UltraChaingun : DoomWeapon replaces Chaingun
{
   Weapon.SelectionOrder 700
   //Weapon.AmmoUse 1
   //Weapon.AmmoGive 20
   //Weapon.AmmoType "Clip"
   Inventory.PickupMessage "$GOTCHAINGUN!"
   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:
     CHGG AB 4 A_FireCGun
     CHGG B 0 A_ReFire
     Goto Ready
   Flash:
     CHGF A 5 Bright A_Light1
     Goto LightDone
     CHGF B 5 Bright A_Light2
     Goto LightDone 
   Spawn:
     MGUN A -1
     Stop
   }
}

ACTOR FireCGun
{
  Fire:
	 CHGG A 0 A_PlaySound("weapons/uchain", CHAN_WEAPON)
     CHGG A 0 A_GunFlash
	 CHGG A 4 A_FireBullets(8.5, 0, 1, 5, "BulletPuff")
     CHGG A 0 A_PlaySound("weapons/uchain", CHAN_WEAPON)
     CHGG B 0 A_GunFlash("Flash2")
     CHGG B 4 A_FireBullets(8.5, 0, 1, 5, "BulletPuff")
     CHGG B 0 A_ReFire
     Goto Ready
  Flash:
     CHGF A 4 Bright A_Light1
     Goto LightDone
  Flash2:
     CHGF B 4 Bright A_Light2
     Goto LightDone	 
   }
} 
User avatar
NeoTerraNova
Posts: 153
Joined: Tue Mar 14, 2017 5:18 pm
Location: Western North Southlandia (East Side)

Re: (Help) Chaingun's frame change problem

Post by NeoTerraNova »

What, exactly, is it not doing that you want it to do?

I can see, first of all, that you have the lines for AmmoUse, AmmoGive, and AmmoType commented out, so they won't function, but what else is the matter?
User avatar
Shotgun guy
Posts: 73
Joined: Sat Mar 24, 2018 5:35 am
Location: Hungary
Contact:

Re: (Help) Chaingun's frame change problem

Post by Shotgun guy »

I did,that it use infinite ammo. I'd like to see all frame when I shoot with Chaingun. CHGGB0 frame I don't see when I finished the shooting.
User avatar
NeoTerraNova
Posts: 153
Joined: Tue Mar 14, 2017 5:18 pm
Location: Western North Southlandia (East Side)

Re: (Help) Chaingun's frame change problem

Post by NeoTerraNova »

The Chaingun only has four total images - two "Gun Flash" images, and two images of the barrels "spinning." When I tested the code, it worked fine. The image "CHGGB" is the second frame of the barrels spinning. The number 0 on the end indicates that this line/action has no frames actually assigned to play when activated. If you want to have that frame visible, change the 0 to a 1, like "CHGBB1" (or, CHGG B 1). This will, however, slow down the fire rate of the weapon.
User avatar
Shotgun guy
Posts: 73
Joined: Sat Mar 24, 2018 5:35 am
Location: Hungary
Contact:

Re: (Help) Chaingun's frame change problem

Post by Shotgun guy »

So I'd like to do,that it use original Doom's function. But it give other sound.
User avatar
NeoTerraNova
Posts: 153
Joined: Tue Mar 14, 2017 5:18 pm
Location: Western North Southlandia (East Side)

Re: (Help) Chaingun's frame change problem

Post by NeoTerraNova »

Change this:

CHGG A 0 A_PlaySound("weapons/uchain", CHAN_WEAPON)

to:

CHGG A 0 A_PlaySound("weapons/mchain", CHAN_WEAPON)

And create a sound file within your WAD called "mchain" that has the sound you want. Then, create a file within your WAD called "SNDINFO." Within this text file, put this:

weapons/mchain
User avatar
Shotgun guy
Posts: 73
Joined: Sat Mar 24, 2018 5:35 am
Location: Hungary
Contact:

Re: (Help) Chaingun's frame change problem

Post by Shotgun guy »

I could add the sound. But I tried to change to SW97 style. Isn't good.

Code: Select all

   Spawn:
     MGUN A -1
     Loop     
   Ready:
     CHGG A 1 A_WeaponReady
     Loop
   Deselect:
     CHGG A 1 A_Lower
     Loop
   Select:
     CHGG A 1 A_Raise
     Loop
   Fire:
	 CHGG B 0 A_GunFlash
     CHGG B 0 A_PlaySound("weapons/uchain", CHAN_WEAPON)
     CHGG B 3 A_FireBullets(8.5, 0, 1, 5, "BulletPuff")
     CHGG C 0 A_CheckReload
     CHGG C 0 A_PlaySound("weapons/uchain", CHAN_WEAPON)
     CHGG C 3 A_FireBullets(8.5, 0, 1, 5, "BulletPuff")
     CHGG A 0 A_ReFire
     Goto Ready
   Flash:
     CHGG B 3 Bright A_Light1
     CHGG B 3 Bright A_Light2
     CHGG C 0 Bright A_Light0 
	 Stop
User avatar
NeoTerraNova
Posts: 153
Joined: Tue Mar 14, 2017 5:18 pm
Location: Western North Southlandia (East Side)

Re: (Help) Chaingun's frame change problem

Post by NeoTerraNova »

Mm. I'm afraid I'm out of my depth, here. My apologies.
User avatar
Shotgun guy
Posts: 73
Joined: Sat Mar 24, 2018 5:35 am
Location: Hungary
Contact:

Re: (Help) Chaingun's frame change problem

Post by Shotgun guy »

So I could solve:

Code: Select all

//Weapons: Ultra Chaingun

ACTOR UltraChaingun : DoomWeapon replaces Chaingun
{
   Weapon.SelectionOrder 700
   //Weapon.AmmoUse 1
   //Weapon.AmmoGive 20
   //Weapon.AmmoType "Clip"
   Inventory.PickupMessage "$GOTCHAINGUN!"
   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:
	 CHGG A 0 A_GunFlash
     CHGG B 0 A_PlaySound("weapons/uchain", CHAN_WEAPON)
     CHGG C 2 A_FireBullets(8.5, 0, 1, 5, "BulletPuff")
     CHGG C 0 A_PlaySound("weapons/uchain", CHAN_WEAPON)
     CHGG B 2 A_FireBullets(8.5, 0, 1, 5, "BulletPuff")
     CHGG A 0 A_ReFire
     Goto Ready
   Spawn:
     MGUN A -1
     Stop   
   }
}
Post Reply

Return to “Scripting”