-
Notifications
You must be signed in to change notification settings - Fork 13
Tutorial 1: Creating a Weapon
This is a weapon making tutorial by Fanatic that describes how he made an Uzi with DDF. Slightly modified by Ziggy Gnarly to include instructions on creating a weapon icon and pickup message.
There's a lot involved in implementing one item, if you are doing a completely new weapon. I'll assume you know how to make sounds, pretty weapon pictures and how to use Wintex and make a WAD file.
Here's what it took to implement the Uzi for DOOM Anomaly.
1) Create the new sounds for it:
-weapon up sound called UZI1
-weapon firing sound called UZI2
2) Import and name them to a new WAD using Wintex called:
-DSUZI1
-DSUZI2
All digital sounds MUST be called DS[name]. You can have 6 character names total. Like DSSPINDN for example.
3) We need to define the sounds, so open EDGE-Classic's existing DDFSFX lump, PAGE DOWN to the bottom to add new stuff:
Anything following // is a comment, ex: // THIS IS A COMMENT
. DDF
doesn't pay attention to upper or lower case, but I use upper cause it
looks better.
Add the following:
[UZI1] // UZI SELECT SOUND
LUMP_NAME="DSUZI1"; // THIS IS THE LUMP NAME OF THE SOUND
PRIORITY=90; // LOW PRIORITY, GETS CUT OFF BY HIGHER PRIORITY SOUNDS
[UZI2] // UZI FIRING SOUND
LUMP_NAME="DSUZI2"; // THIS IS THE LUMP NAME OF THE SOUND
PRIORITY=90; // LOW PRIORITY, GETS CUT OFF BY HIGHER PRIORITY SOUNDS
SINGULAR=1; // ONLY PLAY UZI2 ONE AT A TIME<br>
The singular bit is useful for fast playing sounds. If you leave this out, it will play each occurrance of that sound without stopping. It can suck up all the sound channels without it, and generally make it sound bad. Because the Uzi fires fast, we want one firing sound to play at a time.
4) We now need to define the attack for the weapon, so open EDGE-Classic's existing DDFATK, PAGE DOWN to the bottom to add new stuff.
Add the following:
[PLAYER_UZI] // NAME OF THE ATTACK -SHOULD BE UNIQUE
ATTACKTYPE=SHOT; // TYPE OF ATTACK
SHOTCOUNT=1; // NUMBER OF ITEMS SHOT
DAMAGE.VAL=3; // DAMAGE AMOUNT
DAMAGE.MAX=15; // DAMAGE AMOUNT
ATTACK_HEIGHT=32; // 32 IS ABOUT CHEST HIGH
ACCURACY_ANGLE=3.0; // LOW BULLET SPREAD
ACCURACY_SLOPE=1.5;
ATTACKRANGE=1024; // PLAYER PROJECTILE ATTACKS SHOULD ALWAYS BE 1024, CHAINSAW IS 63.9, FOR EXAMPLE
ENGAGED_SOUND=UZI2; // SOUND TO PLAY WHEN THIS ATTACK IS ACTIVE <br>
If you set the ACCURACY_ANGLE to 45, it will spread all over the place, set it to 0 (zero), it will shoot right on the middle of the crosshair every shot.
5) We now need to create our weapon sprites, and a null one, plus the weapon icon:
-the gun idle called UZIG
-the gun firing called UZIF
-the blank one called NULL (this is a pic that is ONE pixel of cyan)
-the gun icon called UZIC
All sprites HAVE to be 4 letters as the description, and the last two characters are the frame letter, A, B, C, etc., to define the sequence, and 1 thru 8 for the direction. See the Wintex documentation for more info on this.
Weapon sprites will always be 0 (zero) for "all views" (like a dead monster, or an item you pick up, same from all directions and spins to face you when you walk around it).
6) We now need to import them into our WAD file that we already have our sounds in, name them as such:
-UZIGA0
-UZIFA0
-NULLA0
-UZICA0
7) We now need to code the weapon, this is the good part, open EDGE-Classic's existing DDFWEAP, PAGE DOWN to the bottom to add new stuff.
Add the following (no word wrap either):
[UZI] // WEAPON NAME
AMMOTYPE=BULLETS; // TYPE OF AMMO
AMMOPERSHOT=1; // AMMO PER SHOT, SHOTGUN USES A LOT MORE, ROCKET LAUNCHER USES 1, ETC.
AUTOMATIC=TRUE; // LOOPS AUTOMATICALLY
BINDKEY=8; // KEY TO SELECT THIS WEAPON
PRIORITY=-1; // WHEN YOU RUN OUT OF AMMO, IT SELECTS WHATEVER IS NEXT IN PRIORITY LIST
ATTACK=PLAYER_UZI; // ATTACK TYPE DEFINED IN ATTACKS.DDF
START_SOUND=UZI1; // THIS IS THE SOUND PLAYED WHEN THE WEAPON IS SELECTED, DOOM ONLY USES THIS FOR THE CHAINSAW, BUT WE CAN USE IT HERE
STATES(UP)=UZIG:A:1:NORMAL:RAISE; // WEAPON SELECTED FRAME
STATES(DOWN)=UZIG:A:1:NORMAL:LOWER; // WEAPON DESELECT FRAME
STATES(READY)=UZIG:A:1:NORMAL:READY; // BOBBING OR IDLE FRAME
STATES(ATTACK)=UZIF:A:1:BRIGHT:SHOOT, // FIRING FRAME
UZIG:A:1:NORMAL:NOTHING, // RECOIL FRAME
UZIG:A:0:NORMAL:REFIRE; // LOOP BACK TO FIRING FRAME IF FIRE BUTTON IS HELD
STATES(FLASH)=NULL:A:1:BRIGHT:LIGHT1, // LOW LIGHT FLASH
NULL:A:1:BRIGHT:LIGHT2, // BRIGHT LIGHT FLASH
NULL:A:0:NORMAL:LIGHT0,#REMOVE; // RESET WEAPON LIGHT FLASH
// I USED THE NULL IN FLASHSTATE CAUSE I ALREADY SET THE FIRING FRAMES
// IN THE ATTACKSTATE SET, IT LOOKS BETTER, GIVES IT THAT ROCKING LOOK
// AND I DON'T LOSE THE LIGHTING EFFECT WHILE FIRING.
Now, the frames work as such:
[state]=[4 letter sprite name]:[frame letter]:[duration of the frame]:[light level -NORMAL or BRIGHT]:[action];
Remember to close the lines with a semi-colon ";". Commas indicate to continue the loop.
The #REMOVE statement tells the frame to disappear. Otherwise the sprite will remain on the screen. Use this for one-time sprites, e.g an explosion's last frame.
This is enough to get the gun up and running - but to put the gun into a TC or mod, you'll need to make:
a) an icon for the new weapon
b) a pickup message for the weapon
8) We are now going to add a weapon icon. So open THINGS.DDF, and PAGE DOWN to the bottom to add new stuff.
Add the following (no word wrap either):
[UZI:200] // IDENTIFIES THE WEAPON ICON + NUMBER USED BY MAP EDITORS
BENEFIT_TYPE=BULLETS(40), // AMOUNT OF BULLETS THE GUN COMES WITH
BULLETS.LIMIT(400); // LIMIT THAT THE GUN CAN HOLD
RADIUS=20;
HEIGHT=16;
PICKUP_MESSAGE=GotUzi; // CALLS A STRING STORED IN LANGUAGE.LDF
PICKUP_SOUND=WPNUP; // STANDARD DOOM SFX FOR WHEN YOU GET THE UZI
SPECIAL=SPECIAL;
RESPAWN_EFFECT=ITEM_RESPAWN;
STATES(IDLE)=UZIC:A:-1:NORMAL:NOTHING; // ONE ROTATION
We now need to create a text string to play when you pick up the weapon. If we don't do this, we'll run into problems.
9) We'll add our pickup message to the weapon. Open DDFLANG, and begin a text search.
You should search (or scroll down) until you find the text "GotShotgun". This marks the end of the normal doom weapon pickup messages. You'll need to insert a new entry called GotUzi (see above)
GotUzi="You got the Uzi 9mm";
At this point, you've done almost everything necessary to get your gun
working. You can access it by using the IDFA cheat code, or by placing
the Uzi into a map (most good map editors have a specific method of
adding new or custom items - so read the documentation that came with
the map editor for more info). You could also make enemies drop the Uuzi
when killed by assigning DROPITEM=UZI;
to a creature in DDFTHING.
But before you charge off to use your new weapon, you'll have to use Wintex or DeuSF to append all sprites to your WAD file with the sounds and sprites, then run EDGE as such:
edge-classic.exe -file [wadname].wad
That's it!
I keep my DDF file I'm editing in another directory for Anomaly, and refer to the originals in my DOOM2 directory when editing.
If you do this, you'll need to run it as such:
edge-classic.exe -ddf [directory where you store your DDF files] -file [wadname].wad
The original DDF docs were written by Andy Baker and Ziggy Gnarly, with updates by Andrew Apted, Andy Brewood and Luke Brennan. © EDGE Team, et al. 1998 - 2021.