NaturalTvventy Posted July 25, 2010 I'm trying to alter the DOOM weapons so that they don't fire while the player is underwater. It's worked fine for all the weapons, except the chaingun. I've added the same code to it as I did with the rest of the weapons, but now when I fire the chaingun above water the 'flash' is messed up. it only displays one frame instead of two or howmany ever it's supposed to. here's the DECORATE I am using. actor Chaingun : DoomWeapon 2002 { Game Doom SpawnID 28 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." States { Ready: CHGG A 1 A_WeaponReady Loop Deselect: CHGG A 1 A_Lower Loop Select: CHGG A 1 A_Raise Loop Fire: NULL A 0 A_JumpIf(waterlevel == 3, "DeepWater") CHGG AB 4 A_FireCGun CHGG B 0 A_ReFire Goto Ready Deepwater: CHGG A 24 A_PlaySound("Weapons/Waterfire") goto ready Flash: CHGF A 5 Bright A_Light1 Goto LightDone CHGF B 5 Bright A_Light1 Goto LightDone Spawn: MGUN A -1 Stop } } I know according to the ZDoom wiki it's bad to copy/paste the whole code into your WAD, but I haven't been able to figure out how to do it otherwise. is this causing the problem, or is it something else? Thx, NT 0 Share this post Link to post
AkiraZXE Posted August 2, 2010 (Does this count as a bump? It's only about a week old and nobody replied...) The problem is here: A_JumpIf(waterlevel == 3, "DeepWater") This is the definition for A_JumpIf from the ZDoom wiki: A_JumpIf (expression, str "state") So, you are jumping to a state called "DeepWater" when you want to be jumping back to "Ready". Or, alternatively, you could create a state called DeepWater, in which you play some sound, or have some animation to show that the gun isn't going to fire underwater. 0 Share this post Link to post
TheDarkArchon Posted August 2, 2010 Akira_98 said:(Does this count as a bump? It's only about a week old and nobody replied...) The problem is here: A_JumpIf(waterlevel == 3, "DeepWater") This is the definition for A_JumpIf from the ZDoom wiki: A_JumpIf (expression, str "state") So, you are jumping to a state called "DeepWater" when you want to be jumping back to "Ready". Or, alternatively, you could create a state called DeepWater, in which you play some sound, or have some animation to show that the gun isn't going to fire underwater. Wrong, wrong, wrong. Look at the code again and you'll see that there is a DeepWater state. 0 Share this post Link to post
AkiraZXE Posted August 3, 2010 ...Very wrong. I guess that's one more <!> to my ego. =/ I should really start re-reading things. Well, I thought of a work-around for it (Untested as it is.) You could try removing the "Flash" frames from the code completely. Then, make new firing animations by overlaying the flash onto the gun itself, and use them as a firing animation. Or, if your brave, you could try it in TEXTURES. I'm also pretty sure you'll have to add 0 duration frames for A_LIGHT1, and add in somewhere A_LIGHT0, but that's something I should let you figure out. ;) Not exactly an answer to "whats wrong with the code," but it would look and work the same. Also, This will tell you how to avoid copying/pasting actors that have already been defined. 0 Share this post Link to post