Jump to content
Search In
  • More options...
Find results that contain...
Find results in...

DeHackEd Tutorial Video: Modify weapons/monsters & use custom sprites in Vanilla Doom!

Recommended Posts

Posted (edited)


Very informative!

Here's a deh a friend made some time back, it uses the plasma gun and makes the projectiles ricochet off the walls etc.


easy test in map30: gzdoom.exe -deh plasma.deh -warp 30

Share this post

Link to post
Posted (edited)

Though you can't have enemies shoot the super shotgun which is a wide spread of 20 pellets, compared to the regular shotgun that's a more accurate blast of seven pellets, you can stack multiple shotgun shooting frames.   You can set a frame's duration to 0 if it has a code pointer and is followed by a frame with code pointer.    Then only the frame that finally has a duration of 1 or more is displayed and actions of the previous undisplayed zero duration frames are all carried out on it simulaneously.


Some old stuff of mine, someone else added to and uploaded: https://www.doomworld.com/idgames/utils/exe_edit/patches/quad2

I stack multiple shotgun blasts and on some variations, also a lost soul charge.    I haven't ever tried this zip of stuff or messed with my original version in years.   I don't know why this text file says authors may not use the level.   Whichever test level or stuff was mine people can do whatever they want with, though it may not be worthwhile.

Share this post

Link to post
4 hours ago, Gokuma said:

Though you can't have enemies shoot the super shotgun which is a wide spread of 20 pellets, compared to the regular shotgun that's a more accurate blast of seven pellets, you can stack multiple shotgun shooting frames.   You can set a frame's duration to 0 if it has a code pointer and is followed by a frame with code pointer.    Then only the frame that finally has a duration of 1 or more is displayed and actions of the previous undisplayed zero duration frames are all carried out on it simulaneously.

Holy crap, I never knew this -- thanks! I've been unnecessarily giving multiple frames in a row  (with codepointers) durations of 1 in every dehacked mod I've made..

Share this post

Link to post
Posted (edited)
On 2/24/2018 at 1:25 PM, bonnie said:

As far as I know, you can't adjust the damage value for hitscan (5, 10, or 15 damage), so making it deal more damage isn't an option in the conventional way. An alternative would be to simply have it shoot multiple times on the same tic, so that it deals ~double the damage. You can compensate by making it shoot a few tics slower. I'll show you how to do exactly that to help you get started, then you can adjust and play around from there.


----- STEP BY STEP -----

  1. Open up whacked4.
  2. Choose your engine and set your iwad + any pwads.
    • Boom has a major advantage over regular Doom 1.9 in the ability to change the action of any state, which is huge if you're actually editing them (like you are now). You can also edit par times in Boom. If that didn't make sense to you, choose Boom. Otherwise, stick with Doom 1.9.
      • You can change the engine by saving and using "File -> Open as" and reopening your file. Of course, engine-specific changes will probably be lost, if it even lets you change it by that point.
    • The pwads will allow you to see your custom sprites and stuff in whacked4 itself, which is a massive help when doing heavy state editing, especially when you add additional frames to existing spritesheets.
  3. Since you're only touching the pistol, you can just jump right into "States" on the left-hand side of the window.
  4. Click "filter" at the top and scroll all the way to the bottom and click on "Pistol".
  5. Here's your pistol! You'll notice that each little row has a bunch of information, but you can ignore most of it. The most important columns are "Dur" (duration of a state in tics) and "Action" (the specific action for a state).
    • Another bit that may be of use is "Lit", which refers to the sprite having the always fullbright flag turned on, as denoted by an X.
      • You'll notice that state 17, "PISFA" (more on that name later), is lit. Clicking it on reveals that it's actually the muzzle flash for the pistol.
  6. After checking out the different states that the pistol uses, you should notice some important information on the left:
    1. Sprite - The determines the specific spritesheet used for this state. The pistol uses PISG. Clicking on the little dots to the right will pop up a window showing the various spritesheets you can select.
    2. Frame - This denotes the actual frame from your selected spritesheet that will be used for this state. This one has little arrows you can use, so you can actually scroll through each frame of the spritesheet to pick the one you want.
      • You can also see the selected frame for each state under "Frm".
        • The exact name for each is listed under "Name".
      • Next to this is a radio button for the fullbright flag.
    3. Next state - Very important! This denotes what state is going to be called after this one is finished! Set this to 0 if you want the state to stop updating when it reaches it. You'll be using this one soon!
    4. Duration - How long the state lasts, in tics. For reference, 30 35 doom tics = 1 second (I think). For further reference, the delay after you stop firing a plasma rifle is 20 tics.
    5. Action - Also quite important! This tells the state what to actually do when it's called!
    6. Restore - This will reset a state to its defaults, in case you wanna go crazy messing around with each state, which I strongly advise you to do, in order to get a feel for everything! We'll talk more about some of the actions later.
      • The unused sections above don't seem to do anything, as you might guess.
  7. Once you're done messing around with the different pistol states and frames and actions and whatnot, its time to get to business. To make it shoot multiple times on the same tic, you'll have to give another state a FirePistol action. You have two options:
    1. Give it to an existing pistol state and adjust the rest of the states to make it blend in. I don't recommend doing this immediately if you're inexperienced because it's a little more work.
    2. Take a pre-existing state and add it to the pistol's collection. This is what we'll do.
  8. Thankfully, Doom comes fresh out of the box with 5 totally unused states. Little gimmes to get started without worrying about the consequences!
    • To find these states, click "Filter" at the top, and scroll all the way up. It's the very first option, "Unused".
      • These are states that never get called by an initialized state, so they have no ties or connections to anything else in the game, making them super safe and easy to use! Always check back here if you lose track of your states or cut some off of another thing.
        • An "initialized state" is a term I just made up. Each thing and weapon in the game has certain states that it defaults to when it spawns, it initializes them if you will. You'll notice that 45 actually calls upon 46, but is still unused, because it isn't tied back to an initialized state or a hardcoded state, such as state 266, which is hardcoded to be used by the archvile when resurrecting stuff.
          • Examples of initialized states for monsters would be what state to call it spawns, flinches, dies, or when it's gibbed, resurrected, etc. Examples for weapons would be what state to call when you pull out the weapon, put it away, when the player presses fire, etc.
  9. Here, we have 5 choices. To make things simpler on ourselves, we'll just pick the very first one, state 45, sprite name "SHT2B". Remember that number!
  10. Now go BACK to the pistol filter. Since we're gonna make it shoot multiple times at once, lets just add onto the current firing state, state 14, sprite name "PISGB".
  11. Lets go through what you're gonna do for these states, step-by-step:
    1. Select state 14, and take note of the "Next state" number! Now change it to 45, the number of our unused state.
    2. Change "Duration" to 0. This will make it perform an action and instantly update. This will allow us to perform multiple FirePistol actions on the same tic.
    3. We're done with state 14. Up at the top of the States window, next to "Filter", press the red refresh button. This will refresh the pistol filter.
    4. You'll notice a slight change. It appears another state has been added to our filter.
      • However, the change is a bit more complicated. What happened is that 14 now calls 45 instead of 15, which is then supposed to call 16. So now 15 and 16 have become unused states! State 45 actually calls 46, which then calls 33. So you lost 2 states and gained 3.
        • But where did 33 come from? That wasn't an unused state, in fact... it's an initialized state! The reason this state appears and why 45 and 46 are still unused is because 33 is called by 46, which is called by 45... but nothing actually calls 45. 45 and 46 can never be reached, so they remained unused until now.
    5. Because we've lost our previous unused state, we'll have to bring it back. Select state 45 down at the bottom (it's sorted by number) and change "Next state" to 15, state 14's old next-state. Refresh.
    6. Time to fix up the rest of state 45! As you can see, it uses the SSG's spritesheet. Change the spritesheet next to "Sprite" to 3, the pistol spritesheet. Again, this can be seen by selecting the three dots next to "Sprite" and scrolling around.
    7. Well now it uses the right spritesheet, and coincidentally, it uses the correct frame number as well! You won't have to adjust it. You can verify by checking the sprite used by state 14 if needed.
    8. For the duration, it depends on how exactly you want the gun to be slowed. If you want the pistol to just fire slower altogether, try editing various states throughout the firing process, such as states 13, 14, or 15.
      • Careful though! The pistol uses a muzzle flash on state 17. Muzzle flashes are drawn on top of the actual weapon, so keep that in mind.
        • The pistol's muzzle flash is 7 tics long by default, while its firing state is only 6 tics long by default.
      • Alternatively, you can use the pistol's ReFire state (state 16). This is the state weapons use when you've let go of your fire button. Some weapons have short ReFire states that allow you tap fire effectively, while others such as the plasma rifle induce longer delays when you let go of fire. This won't have any impact on firing rates if you're just holding down fire though.
      • Be sure to not change state 14's duration! That needs to be 0. Only change the duration of your final firing state.
    9. It's time to talk about the action. You may notice that this state has no action. If you're using Boom, this doesn't matter. But if you're using Doom 1.9, you won't be able to do much with this state! Try to find another state that you can pull out that already has an action tied to it.
      • Some info on actions themselves:
        • Most actions are self-explanatory. If you're confused about one, check it out here: http://doom.wikia.com/wiki/Codepointer#Code_pointers
          • You'll find some pretty cool and interesting actions here, such as BrainExplode.
        • Player attack actions and enemy attack actions differ. Player attacks start with "Fire" while others don't. The only exception to this is BFGSpray, which I believe can be used by all things.
          • Cyberdemons use CyberAttack to fire their rockets, which are indeed identical to your own.
        • I don't know about zdoom, but normally, trying to mix and match player and demon attack actions will result in crashes. My guess is that it's because there's certain information tied to the attacks, such as the attack target for demons, which can't be provided by a player, which then confuses and crashes the game.
      • Anyways, take state 45 and in this case, set the action to "FirePistol".
    10. Repeat as needed using additional states if you wish to make the pistol shoot even more per tic.
  12. Hooray!!! You did it!!!!!! Save your patch and run it with all your wads. It should be able to actually work hand-in-hand with other dehacked patches, if they're small and only edit strings and such.
    • Obviously there are some issues with doing this, especially concerning the increased ammo consumption. Your recoil will also be a little wonky after the first shot, since, while on the first shot both bullets will be perfectly accurate, they'll have separate recoils, but that shouldn't be a problem. In fact, that can actually almost be like pseudo-balancing, making the pistol much more effective at short ranges. It will however introduce more variance on the damage output as well, making it range from (if you hit both bullets) 10-30 damage, which could be good or bad depending on your point of view.

    • If the ammo is truly a problem, you can adjust the ammo you receive from pickups in the "Ammo" section on the left. The number under "Pickup" represents the base pickup amount, i.e. a small ammo pickup one backpack, a dropped weapon (except for dropped clips which give half). Placed weapons will give you twice this amount, and big pickups like boxes of bullets/shells/rockets will give you five times this amount.

And that's it! I'm sorry this was so long, I tried to make it moderately detailed and wanted to include some extra tidbits that might help you if you decide to branch out into more advanced patches. This is actually super easy to do, despite what my guide might tell you. If you perhaps want a tl;dr that cuts out all the extra stuff and explanations and whatnot, I will most certainly provide. Also I don't know what the other guy was talking about with SLADE. He might have been talking about using DECORATE or something instead.


EDIT: Please note: Doom doesn't check your ammo before firing, so if you have only 1 bullet and attempt to shoot (which is impossible to avoid since zombiemen drop 1/2 your base ammo pickup amount, making an odd number of bullets inevitable), you'll go to -1 bullets. Literally. Doom even has a graphic for this. FireCGun, the action for shooting the chaingun, appears to be identical to FirePistol except that it also checks ammo before firing. Unfortunately however, it completely breaks the pistol when you try using it on it. So if you bring yourself to -1 bullets, your gun will act like it's out of ammo, but will literally say "-1" under ammo on the left, while on the right however, it will replace the number for your shells with the negative graphic. To remedy this, change your screen size (- and +). It goes away completely once you're back in the positives. (P.S. this doesn't affect you if you don't use the big ol' default status bar)


Anyways, If you have any questions, comments concerns, corrections, or want me to include screenshots for certain steps or something, let me know.

Love, bonnie.


On 3/2/2018 at 12:38 PM, bonnie said:


I FORGOT TO TELL YOU SOMETHING SUPER IMPORTANT: you wouldn't believe the frickin heart attack i just had over this because i completely forgot about something extremely crucial to this whole thing:

doom doesn't check your ammo count before shooting. since you're shooting the pistol twice in the same attack, that means if you shoot with 1 bullet, you go to... -1 bullets. this scenario is unavoidable since zombiemen drop clips at half the base ammo pickup amount, which means having an odd number of bullets is inevitable.


"but wait a minute bonnie, the chaingun fires two shots per attack, and that works, you frickin liar!!!"

this is true. the chaingun uses a special action, FireCGun, which appears to be identical to FirePistol except for the fact that it checks ammo before firing, but for whatever reason, it completely breaks the pistol if you try to use it on it.

the good news? this doesn't really matter (i think)!!! there's actually a graphic for negatives in doom, so in your ammo count on the left, it'll literally say "-1", but on the right, it will replace the number for your shells with the big ol' negative graphic. the way to fix this appears to simply be resizing your hud, so just hit - and + real quick to fix it. it'll go away completely once you pick up ammo to bring yourself back into the positives. c:


please note that this only even affects the default doom status bar, so if you use boom's advanced hud or some other fullscreen thingy, you won't even be impacted by this

but holy heck my wee little heart was so panicked because i thought everything was gonna be horribly broken forever ;~;


bonnie wrote up this excellent little guide that I just stumbled across and it's really good so I figured I'd quote it. In fact, I'd like to gather every semi-detailed DeHackEd tutorial/piece of information in one comprehensive place if possible, so I'm going to try and round up all I can in this post. From now on when someone comes around asking anything about DeHackEd, I'd like to have one simple spot that can answer literally any question they may have, and a variety of different guides from different people. I'll just continue editing this post as I find more. Right now all I've got are Enjay's tutorial and bonnie's, but I'm sure there are more out there for me to find.

Share this post

Link to post
Posted (edited)

There's the 3D Alchemy book one as mentioned on another thread.   It has a few oversights where things could have been done better but it's still cool.  It might have given me some ideas back in the day.   Probably would have been more inspiration if I hadn't already seen Werner's Spahl's Theme Patch first ,which is about the most prolific dehacked patch of old and I learned a lot from that.   In the Alchemy book, the Dehacked stuff goes from pg. 437 to 451.   I think it purposely doesn't mention the name Dehacked in that chapter, but then on pg. 589 to 594 it explains how to set up and use Dehacked.   Also page 635 is the beginning of useful Thing listings with all their map id#'s and four letter sprite groups for Doom through Heretic & Hexen plus Hexen spawn id#'s.  And width/height stats for most enemies.



All map id#'s are here in case you want to swap any around or give new unused ones to things in Dehacked: https://zdoom.org/wiki/Standard_editor_numbers

I did that using Sehacked on Strife and made a bunch more things able to be placed in levels.

Just relevant to Decorate and stuff, all spawn id#'s for scripting are here:  https://zdoom.org/wiki/Spawn_number

Except while some Skulltag stuff is listed in those, a bunch of map id#'s (ranging in 5000's, 5100's, and 5328) and spawn id#'s (within 155-222) are missing but I have in txt files., in case you want to use Skulltag actors with a ZDoom-based port.   Well spawn numbers are relevant to deciding which things you want to change in Dehacked even if it can't change the actual spawn numbers.


Currently I'm fixing up an old Dehacked patch and adding a bunch of stuff with Decorate, so I got quite some juggling to do.   Before I've totally remade a huge dehacked patch in decorate, but with this one I'm only phasing a few things out of the dehacked so far.


Besides maybe a few text and miscellaneous changes, I can think of something easy in Dehacked that I don't know if it can be done in Decorate -- a roulette item.  With regular Doom dehacking, what a gettable item gives you is determined by its four letter sprite name, so you could put a bunch of frames each of a different item in sequence. Then it's luck or timing whatever it is when you grab the item.


Maybe Zscript and other stuff can but I haven't even looked into anything else.   Well way back there was also DDF (Doom Definition Files) with the old port dosDoom which became EDGE soon afterwards.   That was a little of a forerunner to Decorate having a lot in common such as adding as much as you want, but multiplayer sync seemed to be broken in the versions I messed with and I had to update the code to work with EDGE which I never did.

Edited by Gokuma

Share this post

Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now