The Weapon:
Spoiler:
Class ZSBattleRifle : ZMonstrousWeapon { Default { Obituary "$OB_BATTLERIFLE"; Tag "$TAG_BATTLERIFLE"; Weapon.SelectionOrder 650; Weapon.SlotNumber 4; Weapon.AmmoUse1 1; Weapon.AmmoGive1 1; Weapon.AmmoType1 "MWBRMag"; Weapon.AmmoType2 "Clip"; } States { Select: UACR A 1 A_Raise; TNT1 A 0 A_Raise; Loop; Deselect: UACR A 1 A_Lower; TNT1 A 0 A_Lower; Loop; Ready: UACR A 1 A_WeaponReady(WRF_ALLOWRELOAD); Loop; Fire: TNT1 A 0 A_FireProjectile(); //SLADE complains about A_CheckReload(); TNT1 A 0 A_StartSound("weapons/battlerifleattack", CHAN_ITEM); TNT1 A 0 A_GunFlash(); UACR Y 1 A_FireBullets(5, 0, 1, 10, "BulletPuff") ; UACR A 1 A_Refire("Hold"); Hold: TNT1 A 0 A_GunFlash(); UACR Z 1 A_FireBullets(5, 0, 1, 10, "BulletPuff") ; UACR A 1 A_Refire("Fire"); Goto Ready; Reload: TNT1 A 0 A_FireProjectile(); UACR N 2; UACR O 2; UACR P 2; TNT1 A 0 A_StartSound("weapons/battlerifleunload", CHAN_ITEM); UACR Q 2; UACR R 8; UACR S 2; UACR T 2; UACR U 2; TNT1 A 0 A_StartSound("weapons/battlerifleload", CHAN_ITEM); UACR K 3; UACR L 5; UACR M 3; UACR A 6; TNT1 A 0 A_StartSound("weapons/battleriflecock", CHAN_ITEM); Goto Ready; Flash: TNT1 A 1 A_Light1; TNT1 A 1 A_Light2; Goto LightDone; Spawn: UACR X -1; Stop; } }
ZMonstrousWeapon:
Spoiler:The game just freezes, then ZMusic breaks (it plays the same notes over and over), then I have to hard reset the computer. I don't have any states with 0-duration frames only anywhere! Firing the gun and "reloading" the gun all trigger this bug.
Class ZMonstrousWeapon : Weapon //"reloading" by phantombeta { Default { Weapon.BobStyle "Inverse"; } States { /* Reload: TNT1 A 0 { if (CheckInventory (invoker.ammoType1, 0) || !CheckInventory (invoker.ammoType2, 1)) return ResolveState ("Ready"); int ammoAmount = min (FindInventory (invoker.ammoType1).maxAmount - CountInv (invoker.ammoType1), CountInv (invoker.ammoType2)); if (ammoAmount <= 0) return ResolveState ("Ready"); GiveInventory (invoker.ammoType1, ammoAmount); TakeInventory (invoker.ammoType2, ammoAmount); return ResolveState ("ReloadFinish"); }*/ } }
I commented out the "reloading" code in an effort to squash the bug, but it still happens.
SOLUTION: (replace Stop; with Goto Ready; in NoAmmo:)
ZSBattleRifle:
Spoiler:
Class ZSBattleRifle : ZMonstrousWeapon { Default { Obituary "$OB_BATTLERIFLE"; Tag "$TAG_BATTLERIFLE"; Weapon.SelectionOrder 650; Weapon.SlotNumber 4; Weapon.AmmoUse1 1; Weapon.AmmoGive1 1; Weapon.AmmoType1 "MWBRMag"; Weapon.AmmoType2 "Clip"; } States { NoAmmo: UACR A 1 A_CheckReload(); Goto Ready; Select: UACR A 1 A_Raise; TNT1 A 0 A_Raise; Loop; Deselect: UACR A 1 A_Lower; TNT1 A 0 A_Lower; Loop; Ready: TNT1 A 0 A_JumpIfNoAmmo("NoAmmo"); UACR A 1 A_WeaponReady(WRF_ALLOWRELOAD); Loop; Fire: TNT1 A 0 A_JumpIfNoAmmo("NoAmmo"); TNT1 A 0 A_StartSound("weapons/battlerifleattack", CHAN_ITEM); TNT1 A 0 A_GunFlash(); UACR Y 1 A_FireBullets(5, 0, 1, 10, "BulletPuff") ; UACR A 1 A_Refire("Hold"); Hold: TNT1 A 0 A_GunFlash(); UACR Z 1 A_FireBullets(5, 0, 1, 10, "BulletPuff") ; UACR A 1 A_Refire("Fire"); Goto Ready; ReloadFinish: TNT1 A 0 A_JumpIfNoAmmo("Ready"); UACR N 2; UACR O 2; UACR P 2; TNT1 A 0 A_StartSound("weapons/battlerifleunload", CHAN_ITEM); UACR Q 2; UACR R 8; UACR S 2; UACR T 2; UACR U 2; TNT1 A 0 A_StartSound("weapons/battlerifleload", CHAN_ITEM); UACR K 3; UACR L 5; UACR M 3; UACR A 6; TNT1 A 0 A_StartSound("weapons/battleriflecock", CHAN_ITEM); Goto Ready; Flash: TNT1 A 1 A_Light1; TNT1 A 1 A_Light2; Goto LightDone; Spawn: UACR X -1; Stop; } }
ZMonstrousWeapon is the same.
---
The problem happened AGAIN! It freezes in the ready state, locking up my PC.
ZSBattleRifle:
Spoiler:My guess is that the game goes to Ready, then it goes to NoAmmo and so on, but I HAVE AMMO when it freezes! What's going on!?
Class ZSBattleRifle : ZMonstrousWeapon { Default { Obituary "$OB_BATTLERIFLE"; Tag "$TAG_BATTLERIFLE"; Weapon.SelectionOrder 650; Weapon.SlotNumber 4; Weapon.AmmoUse1 1; Weapon.AmmoGive1 1; Weapon.AmmoType1 "BRAmmo"; Weapon.AmmoType2 "Clip"; } States { NoAmmo: UACR A 1 A_CheckReload(); Goto Ready; Select: UACR A 1 A_Raise; TNT1 A 0 A_Raise; Loop; Deselect: UACR A 1 A_Lower; TNT1 A 0 A_Lower; Loop; Ready: UACR A 1 A_WeaponReady(WRF_ALLOWRELOAD); UACR A 1 A_JumpIfNoAmmo("NoAmmo"); Loop; Fire: TNT1 A 0 A_JumpIfNoAmmo("NoAmmo"); TNT1 A 0 A_StartSound("weapons/battlerifleattack", CHAN_ITEM); TNT1 A 0 A_GunFlash(); UACR Y 1 A_FireBullets(5, 0, 1, 10, "BulletPuff") ; UACR A 1 A_Refire("Hold"); Goto Ready; //this is probably the only line that's different. Hold: TNT1 A 0 A_GunFlash(); UACR Z 1 A_FireBullets(5, 0, 1, 10, "BulletPuff") ; UACR A 1 A_Refire("Fire"); Goto Ready; ReloadFinish: TNT1 A 0 A_JumpIfNoAmmo("Ready"); UACR N 2; UACR O 2; UACR P 2; TNT1 A 0 A_StartSound("weapons/battlerifleunload", CHAN_ITEM); UACR Q 2; UACR R 8; UACR S 2; UACR T 2; UACR U 2; TNT1 A 0 A_StartSound("weapons/battlerifleload", CHAN_ITEM); UACR K 3; UACR L 5; UACR M 3; UACR A 6; TNT1 A 0 A_StartSound("weapons/battleriflecock", CHAN_ITEM); Goto Ready; Flash: TNT1 A 1 A_Light1; TNT1 A 1 A_Light2; Goto LightDone; Spawn: UACR X -1; Stop; } }