Jump to content

Photo

MODDING: Adding a NEW weapon


This topic has been archived. This means that you cannot reply to this topic.
40 replies to this topic

#1
Moraelin

Moraelin

    Negotiator Gladiarius

  • Premium Member
  • 5,170 posts
Sorry about the cross-post, so to speak (this is a copy of my post on Bethesda's site,) and sorry if someone else figured it out before, but seeing that all weapon-reskin mods on the Nexus are simply replacements of existing textures for all guns of a type, I thought I'd share this. My purpose here is not to just, say, make all G3 assault rifles have a new skin, but to make one assault rifle which looks different from all others of the same class.

Since I'm no 3D modeller, let's say I just want to make one G3 which has the black Pimp My G3 texture from the Nexus, while all other G3 assault rifles in the game keep their old look. I.e., all my NIF editing will be simply changing the texture. If you're reading this, you're probably better at modelling than that, but the same basic principles should apply.

1. Make the new NIF and textures.

As I was saying, I'm no artist, I just like tinkering in hex. So here I'll just extract the existing G3 NIFs to "Data\Meshes\G3Rifle\2HandAutomatic\", using the FO3Archive tool. And I'll unpack the excellent black textures I found on Fallout3Nexus to "Data\Textures\G3Rifle\2HandAutomatic\". (Credit for the texture and NIF should, of course, go to their respective authors, not to me.)

Since, again, I'm no artist, I'll just hex exit the NIF files and replace all instances of "\weapons\" with "\G3Rifle\". I chose the name so it would be the same length.

If you're a proper artist, and assuming that the tools can do it by now, you could do your own 3D editing and texture painting here instead of this.

2. Create a new plugin in FOMM. Set the master (MAST top record) to "Fallout3.esm." This has been covered before, and I won't take any credit for it. Just as a reminder that you need to do it.

3. Create a TXST group, if you don't have one already, or copy the one from Fallout3.esm and delete the unwanted entries.

Copy the "1stPersonG3AssaultRifleClipTexture" and "1stPersonG3AssaultRifleTexture" entries from Fallout3.esm's TXST group to the TXST group of your own mod.

Each of them contains two string (text) entries, TX00 and TX01. Edit the strings to the new paths for your textures. E.g., in my case the TX00 for the clip would read "G3Rifle\2HandAutomatic\1stPersonG3AssaultRifleClip.dds" instead of "Weapons\2HandAutomatic\1stPersonG3AssaultRifleClip.dds"

Give each entry new FormIDs. We don't want to overwrite the old weapons, but register them as new textures. My own scheme is that every FormID that starts with "000" gets changed to "00F". So the clip would become "00fa1917" and the gun itself "00fa1916".

I also gave them new names, i.e., EDID records. I called the new weapon "The Widowmaker", so the entries became respectively "1stPersonWidowmakerClipTexture" and "1stPersonWidowmakerTexture".

4. Create a new STAT group in your mod, if you don't have one already, or copy the one from Fallout3.esm and remove the unwanted entries. (Be warned, it has thousands of entries, though.)

Copy the "1stPersonG3AssaultRifle" record from the Fallout3.esm's STAT record to your own STAT record.

Give it a new RecordID. (Again, we're not changing the existing weapon, we're creating a new one.) It used to be "000a1918", so I'll make mine "00fa1918".

I also gave it a new name, i.e., EDID. I called it "1stPersonWidowmaker".

The entry has a MODL entry, and of course I changed it to the name of my modified NIF: "G3Rifle\2HandAutomatic\G3AssaultRifle.NIF"

But the more interesting is the MODS record. It's binary, so switch to hex view before double clicking it. Let's look inside for the pointers to the old textures. The textures were "000a1916" and "000a1916", so what we're looking for is quadruples like "16 19 0A 00" and "17 19 0A 00". We'll change those to "16 19 FA 00" and "17 19 FA 00" respectively.

5. Create a WEAP group in your mod, if you don't have one already, or copy the one from Fallout3.esm and delete the unwanted entries.

Copy the "WeapUniqueWandaAssaultRifle" entry from Fallout3.esm's WEAP group to your own WEAP group. I'll start with Wanda because, well, I don't want my good-looking gun to have ordinary stats. I'll take those of Wanda.

I gave it a new EDID of "WeapUniqueWidowmakerAssaultRifle".

I also gave it a new FormID of "00f6b533". (Again, we're not replacing Wanda, we're creating a new gun.) A new FULL name of "Widowmaker" also helps distinguish it from the old Wanda.

The record has a MODL entry, and of course we'll set it to "G3Rifle\2HandAutomatic\G3AssaultRifle.NIF". But this one seems to only be used for the weapon on the ground. If you only change this one, as soon as you equip it, it gets the old Wanda looks again, which is a letdown.

More interesting is the WNAM entry. We'll change this one to the FormID of the STAT record we just created. I.e., since bytes are swapped again, to "18 19 FA 00". (Don't forget to switch to hex mode first, btw!)

If you also want to change damage, etc, that has already been covered before, so I won't repeat that. Fell free to. After all, it's your mod.

6. That's it.

Save the mod under whatever name you wish (e.g., "WidowmakerRifle.esp"), add it to the list of plugin files, give the new weapon to yourself in the game with "player.additem 00f6b533 1". And if using the cheat turns you off, hey, after all this work, you can imagine that you handcrafted it yourself on Moira's workbench ;) Enjoy your hard-earned beautiful-looking gun, and feel free to sneer at the NPCs who still have the plain-looking one ;)

#2
banjo_oz

banjo_oz

    Fan

  • Members
  • PipPipPip
  • 316 posts
Fantastic and very helpful post! Thanks!!!

Now we just need to be able to get these beauties into the game in a way other than the console cheat... :)

#3
Moraelin

Moraelin

    Negotiator Gladiarius

  • Premium Member
  • 5,170 posts
Hmm, well, that might be a bit harder without a CS.

Probably the easiest would be to change the existing named weapons. I.e., in step 5 you wouldn't actually clone Wanda, but simply replace Wanda's WNAM entry. Since Wanda is already in the game, you can find it in the old place with the new looks.

Possibly second best would be to give it to some wendor to sell, or add it to some locker or chest. Both are actually the same thing, since a lot of the vendors' inventory is in their lockers. (Unless you fancy editing placement on their shelves without a CS ;) ) You'd want the CONT section there, since that's the containers.

So now we'll look for some container that looks good as a placement for our new weapon. E.g., for a quick test, "VendorChestBuriedMoiraBrown". The CNTO entries look like what I want, so let's clone one. And give that new entry a value of "33 B5 F6 00 02 00 00 00". The id for the Widowmaker is "00F6B533" which reversed is the first four digit pairs there, and 2 is the number we want her to sell. (Ok, it makes no sense to sell two unique weapons, but it might make sense if you sell new ammo or whatever.)

Save, etc, let's take a trip back to the old gal. Yep, Moira now sells two Widowmakers.

Of course, you could add it to any other chest instead. E.g., to some enclave gun locker or whatnot.

#4
banjo_oz

banjo_oz

    Fan

  • Members
  • PipPipPip
  • 316 posts

Possibly second best would be to give it to some vendor to sell, or add it to some locker or chest. Both are actually the same thing, since a lot of the vendors' inventory is in their lockers. (Unless you fancy editing placement on their shelves without a CS ;) ) You'd want the CONT section there, since that's the containers.


AWESOME! That's what I was wondering if it was possible... you're a legend (wish I could give more than one kudos point!). I'm going to give it a try tonight.

I also gave it a new FormID of "00f6b533". (Again, we're not replacing Wanda, we're creating a new gun.) A new FULL name of "Widowmaker" also helps distinguish it from the old Wanda.


One question... when making a new weapon, how did you decide on what FormID to give it? If you're not replacing an existing gun, I mean?

#5
Moraelin

Moraelin

    Negotiator Gladiarius

  • Premium Member
  • 5,170 posts

One question... when making a new weapon, how did you decide on what FormID to give it? If you're not replacing an existing gun, I mean?


Well, there were a few more FormIDs than that in that "walkthrough", as you noticed. But basically you take a number that's high enough so you don't accidentally overwrite something else in the stock game, and keep your fingers crossed that nobody else used the same ID.

The advice seems to be to have yours start with "01" since all of Bethesda's start with "00". I went for "00F" instead of "000" and hopefully I didn't break anything. But there are smarter people than me who recommend the "01" scheme, so if in doubt, it's probably a good idea to play it safe and follow their advice.

I guess being creative with the numbers probably also helps a bit. If everyone just bumps the same digit, it will probably cause conflicts down the line. So pick a good random number for the last digits, I guess.

#6
vash1985

vash1985

    Enthusiast

  • Members
  • PipPip
  • 111 posts
how would new animations factor into all this, if possible.

would you be able to just plug them in like with oblivion, or would additional hexing be required?

forgive me but im not actually versed in the animation system for gamebryo, iirc though they are compiled with the nif and are placed in a certain directory

#7
Moraelin

Moraelin

    Negotiator Gladiarius

  • Premium Member
  • 5,170 posts

how would new animations factor into all this, if possible.

would you be able to just plug them in like with oblivion, or would additional hexing be required?

forgive me but im not actually versed in the animation system for gamebryo, iirc though they are compiled with the nif and are placed in a certain directory


I have no idea whatsoever. Sorry. I have no idea about gamebryo at all, I'm just a guy who dug in the hex stuff and swore copiously in the process.

_Some_ stuff, like how you hold it, muzzle flash, ROF, seems to be in the MODT block of binary data in the WEAP record itself. E.g., copying the MODT data from the SMG to the combat shotgun, makes the shotgun be held with one hand, shoot on auto, and shoot bullets instead of a handful of pellets.

Unfortunately I can't really read that mess of hex :(

#8
Moraelin

Moraelin

    Negotiator Gladiarius

  • Premium Member
  • 5,170 posts
Ok, let's try a more detailed step by step “walkthrough”. I've also uploaded an empty plugin file with the master set, the groups already in it, but no content in them to the Nexus. You can use it as a template for future mods. The rest of the walkthrough will assume that you use that one.

This time, as an example, I'll use alexscorpion's Desert Eagle 10mm skin from the Nexus. (He's the same talented artist behind the superb black G3 skin used in the previous tutorial, btw.) As the author says, it doesn't look anything like a Desert Eagle from our world, but it's an alternate universe after all. And it _is_ a beautiful skin. Download that first. Ignore the instructions and especially the archive invalidation bits, they're not relevant for what _we_ are about to do.

If you're an artist and want to do your own texture editing, obviously you don't need to download someone else's textures first, so you can skip the previous paragraph.

Also download and install FOMM and the Fallout 3 Archive utility while you're at it, we'll use both. The FO3Archive utility also needs Java installed, you can start from java.sun.com for that. Make sure you have a hex editor handy. Good, now we can actually begin.

1.Copy the empty .esp into your game's Data directory and rename it to DesertEagleGun.esp.

2.Start the FO3Archive. (If all else fails, just associate the .jar file with java.exe and double click it.) Open the “Fallout - textures.bsa” file from the Data directory, extract everything to some other directory than you installed the game, e.g., “C:\Fallout3unpacked”. Do the same for the meshes.

Close the FO3Archive tool, we're done with it for this one.

If you have enough patience to look around the directories, you'll notice that both the textures and the meshes have a “weapons” directory, and each “weapons” directory has a “1handpistol” directory in it. (And if you don't have enough patience, take my word for it ;) ) Ah-ha. Our 10mm base pistol is probably there.

3.Create the directories Textures and Meshes in your game's Data directory, if they don't exist already. Create a directory called “DEagle1” in each of them. Create a directory called “1handpistol” in each “Deagle1” directory.

4. Go into the directory “C:\Fallout3\unpacked\meshes\weapons\1handpistol and copy the file 10mmpistol.nif to your own Data\meshes\DEagle1\1handpistol directory.

5.Now have a look at the nif with a viewer and note which textures it uses. Search for .dds to save time. You'll see:

10mmPistol.dds
10mmPistol_m.dds
10mmpistol_n.dds
10mmClip.dds
10mmClip_n.dds

6.Copy those five textures, from the C:\Fallout3unpacked\meshes\weapons\1handpistol to your game's Data\Textures\Deagle1\1handpistols.

While I'm at it, I notice there are also the following textures there that might be relevant too:

1stperson10mmpistol.dds
1stperson10mmpistol_n.dds

I'll copy them too.

This step is needed both if you want to do the texture editing yourself (we just nicely isolated the ones you have to edit, and also the ones you'll upload with your mod), and in case a textures mod didn't actually change _all_ textures. Some only change a texture or two.

7.At this point, if you're a graphics artist, you'll probably want to edit those textures yourself. Since I'm just an untalented guy writing a tutorial, I'll overwrite them with alexscorpion's beautiful textures. (BTW, extract the archive without directories. If you end up with directories under Data\Textures\Deagle1\1handpistols, you've done it wrong.)

8.Now it's time for the hex-editor-fu. Go through the pistol .nif file you extracted and change every single occurence of “\weapons\” to “\DEagle1\” (without the quotes.)

Save, close the hex editor, we're done with it too.

9.Open FOMM. Open the DesertEagleGun.esp. Open Fallout3.esm. Expand both by clicking the + sign before their name (the first level should suffice for a start.)

10.Expand the TXST group in Fallout3.esm, look for the 1st Person pistol entries, and try to find the 10mm ones. I.e., use Find with “10mm”, partial matches checked, “search only under the selected node only” checked. In this case only the “1stPerson10mmPistolTexture” entry actually looks relevant. Copy it to the TXST group of our own esp.

11.Give it a new FormID. It had 00025b81, so I called mine 00F25b81. Give it a new EDID. I called mine “1stPerson10mmDesertEagle”.

Look at the texture entries in it. TX00, TX01 and TX02 are the texture files we just copied. Change them to our paths. E.g., TX00 becomes “DEagle1\1HandPistol\1stPerson10mmPistol.dds” instead of “Weapons\1HandPistol\1stPerson10mmPistol.dds”. TX01 and TX02 get edited the same way, i.e., they get a “DEagle1” where “Weapons” used to be.

TX05 is a shiny metal effect. Unless you plan to edit effects too, leave that one alone.

Done here. Close both TXST groups so they're out of the way. (Click the [-] before the name of the group.

12.Open the STAT group from Fallout3.esm. Look for the 10mm pistol. (Which is to say, use the previous search again, only this time on the STAT group.) The relevant one is “1stPerson10mmPistol”. Copy it to the empty STAT group of your own mod.

13.Give it a new FormID. It was “00025b82” so I'll call mine “00f25b82”. Give it a new EDID. I called mine “1stPerson10mmDesertEagle”.

Change its MODL sub-record to our own nif, i.e., “Deagle1\1HandPistol\10mmPistol.NIF”.

Now switch to hex mode and double click the MODS sub-record. You'll see a mess o' hex numbers like: “06 00 00 00 0C 00 00 00 31 30 4D 4D 50 69 73 74 6F 6C 3A 30 81 5B 02 00 05 00 00 00 0A 00 00 00 23 23 48 61 6D 6D 65 72 3A 30 81 5B 02 00 04 00 00 00 08 00 00 00 23 23 43 6C 69 70 3A 30 81 5B 02 00 03 00 00 00 09 00 00 00 23 23 43 61 74 63 68 3A 30 81 5B 02 00 02 00 00 00 0B 00 00 00 23 23 54 72 69 67 67 65 72 3A 30 81 5B 02 00 01 00 00 00 09 00 00 00 23 23 53 6C 69 64 65 3A 30 81 5B 02 00 00 00 00 00”.

Remember the re-indexing we did with the TXST entry: 00025b81 => 00F25b81. So we'll look for all instances of “81 5b 02 00” and change them to “81 5b f2 00”. (Yes, it's a pain in the rear. You can cheat by copying and pasting into notepad and using its search and replace :) )

The new string is: “06 00 00 00 0C 00 00 00 31 30 4D 4D 50 69 73 74 6F 6C 3A 30 81 5B F2 00 05 00 00 00 0A 00 00 00 23 23 48 61 6D 6D 65 72 3A 30 81 5B F2 00 04 00 00 00 08 00 00 00 23 23 43 6C 69 70 3A 30 81 5B F2 00 03 00 00 00 09 00 00 00 23 23 43 61 74 63 68 3A 30 81 5B F2 00 02 00 00 00 0B 00 00 00 23 23 54 72 69 67 67 65 72 3A 30 81 5B F2 00 01 00 00 00 09 00 00 00 23 23 53 6C 69 64 65 3A 30 81 5B F2 00 00 00 00 00”. Without the quotes.

Close both STAT groups so they're out of the way. Rejoice, for we're almost done with the hard stuff and about to see the results of that work.

14.Open Fallout3.esm's WEAP group. Find the “Weap10mmPistol” entry in it. Copy it to your own mod's empty WEAP group.

15.Give it a new FormID. From “0000434f” it becomes “00F0434f”. Give it a new EDID. I called mine “Weap10mmDesertEagle”.

(And if by now “Copy. Change the FormID. Change the EDID.” sounds like a chorus, good. Remember it well ;) )

Change its FULL name to “10mm Desert Eagle”.

Change its MODL to “DEagle1\1HandPistol\10mmPistol.NIF”.

Change its WNAM to the ID of the newly created STAT record, i.e., to “82 5B F2 00”.

That's it. You have your unique pistol, with unique looks, while all the unwashed peons in the game still run with the rusty old skin on their 10mm pistol. (The _washed_ peons, of course, died of radiation poisoning long ago ;) )

Of course, now you'll probably want to edit the DATA and CRDT records too, to make it do more damage. It's a well maintained DesertEagle after all. Maybe also mess with the NAM0 entry, to make it shoot .44 ammo befitting a DesertEagle instead of the 10mm. Go nuts. It's your gun.

BONUS STAGE

If you made it this far, and assuming you're an original artist and going to upload it, you'll probably also want to place the gun in the game, so the players can find it somewhere instead of having to use the cheat to get it. It's that extra touch that makes it nice.

So we'll put it in a container or give it to some vendor to sell. Both are the same thing, since vendors too have lockers or chests with the stuff they sell.

16.Open Fallout3.esm's CONT group. Look for one that looks promising. I'll go with “VendorChestBuriedMoiraBrown”, so everyone's favourite mad scientist gets DesertEagles to sell.

(But you could be more creative than that, since if everyone edits the old gal's chest, they'll conflict with each other. So show some other vendors some love too, or get creative and place it in some unique lockers in dungeons.)

Copy that record to your own mod's CONT group. You don't have to give this one new FormID and EDID.

The CNTO entries are the content rows. Each one is a different type of item she sells. Each contains 8 bytes (8 groups of 2 hex digits). The first four are the item type. The second four say how many she gets.

Duplicate one of them, and change its contents to the hex string “4F 43 F0 00 01 00 00 00”. The first four, “4F 43 F0 00” are the ID of our newly created gun. The last 4 say she'll sell one Desert Eagle. You can't go akimbo anyway, and they inherited the repair list of the 10mm pistol, so 1 should suffice.

#9
vash1985

vash1985

    Enthusiast

  • Members
  • PipPip
  • 111 posts
epic win. thanks very much for this.

i make models though so i cant do squat untill i can compile .nifs for Fo3 =(

#10
vash1985

vash1985

    Enthusiast

  • Members
  • PipPip
  • 111 posts
sorry for the double post, but will this work if i wanted to use a oblivion nif as my base? i.e. could i compile everything for oblivion then "hex" it over to Fo3?




Page loaded in: 0.736 seconds