Jump to content

NPC Inventory


OmniTree

Recommended Posts

I released the first version of my mod this evening and a rather glaring oversight sprang into view almost immediately. After altering the ammo used by the Hunting Rifle it appears that NPC's carrying that rifle now run out of ammo.

 

I'm searching through the .esm for Inventory as related to NPC's and the weapon / ammo combination's they carry. Can anyone point me in the direction I need to go? I'm hoping it's a matter of associating the Weapon with a specific Ammo outside the Weapon group and not on a per NPC basis.

 

Any help is appreciated.

 

Thanks :)

Link to comment
Share on other sites

I released the first version of my mod this evening and a rather glaring oversight sprang into view almost immediately. After altering the ammo used by the Hunting Rifle it appears that NPC's carrying that rifle now run out of ammo.

 

I'm searching through the .esm for Inventory as related to NPC's and the weapon / ammo combination's they carry. Can anyone point me in the direction I need to go? I'm hoping it's a matter of associating the Weapon with a specific Ammo outside the Weapon group and not on a per NPC basis.

 

Any help is appreciated.

 

Thanks :)

Knowing Bethsoft, my guess would probably be to check the leveled item lists. If there is one place to control how much ammo NPCs have, it would be there. Beyond that, unless there are some totally different systems used in this game, you would have to alter each actor individually. Or maybe the moral of the story is to refrain from changing the ammo types used by weapons for vanilla weapons. I believe there have been some methods described which create a new weapon entry, and others which describe how to add that weapon to a container somewhere. It seems more complicated to do without a CS, but is apparently doable.

Link to comment
Share on other sites

I dug through the .esm and LVLI finding entries for (WithAmmo<weaponname><faction>) i.e. (WithAmmoHuntingRifleSuperMutant). Within said entries there are LVL0 entries one of which contains the FORMID for the appropriate ammo.

 

While this change appears simple between Talon, Raider, Super Mutant, and NPC (yes there is an entry dedicated specifically to NPC's). The difficulty as you mentioned is determining which of the numerous named NPC's carry the weapon/ammo combination. What is hopefully being done inside LVLI is the Named NPC entry is using the FORMID for WithAmmo<Weapon>NPC and With<Weapon>NPC to fill that aspect of it's inventory. Research will need to be done to determine the validity of that claim.

 

*Side NOTE*

Upon first glance it appears Ammo Clip size is located within LVLI. So with minor editing the Sniper Rifle can go from 5 shots to say 15. Once again that's first glance and hasn't been proven as yet.

Link to comment
Share on other sites

The clip size for the rifle itself is the last byte (pair of hex digits) in the DATA sub-record of your WEAP record. So, yes, it's trivial to give it a 15 shot clip, or 255 if you want a belt-fed hunting rifle ;)

 

As for NPCs and levelled lists, hmm, good question. At least theoretically it's possible that Bethesda automatically generates some ammo based on weapon type, via scripts. I haven't checked though.

Link to comment
Share on other sites

I dug through the .esm and LVLI finding entries for (WithAmmo<weaponname><faction>) i.e. (WithAmmoHuntingRifleSuperMutant). Within said entries there are LVL0 entries one of which contains the FORMID for the appropriate ammo.

 

While this change appears simple between Talon, Raider, Super Mutant, and NPC (yes there is an entry dedicated specifically to NPC's). The difficulty as you mentioned is determining which of the numerous named NPC's carry the weapon/ammo combination. What is hopefully being done inside LVLI is the Named NPC entry is using the FORMID for WithAmmo<Weapon>NPC and With<Weapon>NPC to fill that aspect of it's inventory. Research will need to be done to determine the validity of that claim.

 

*Side NOTE*

Upon first glance it appears Ammo Clip size is located within LVLI. So with minor editing the Sniper Rifle can go from 5 shots to say 15. Once again that's first glance and hasn't been proven as yet.

I would imagine that there would be some generic ammo listing somewhere. If not, atleast you've covered the main things that will be shooting at you. Leveled items "should" be listed in that actor's inventory, so you might be able to know if such a list exists by checking out individual actors, and hunting down the form IDs.

Link to comment
Share on other sites

I was all set to rechamber a bunch of weapons in the game yesterday... until I discovered the same problem the TC now has: sure, the weapons have new calibres, but now any NPC armed with them has the wrong ammo (and thus usually, an unloaded weapon)!

 

I haven't looked myself (will try tomorrow with some of the info in this thread), but I have a sneaking suspicion the only way to fix this would be to edit every single NPC's inventory... :(

Link to comment
Share on other sites

I was all set to rechamber a bunch of weapons in the game yesterday... until I discovered the same problem the TC now has: sure, the weapons have new calibres, but now any NPC armed with them has the wrong ammo (and thus usually, an unloaded weapon)!

 

I haven't looked myself (will try tomorrow with some of the info in this thread), but I have a sneaking suspicion the only way to fix this would be to edit every single NPC's inventory... :(

 

Your suspicion is correct, although it is only a small set of entries per weapon. For instance there are only 5 entries for WithAmmoHuntingRifle<faction> (Loot, NPC, Raider, Talon, and Super Mutant). That's not to say Named NPC's etc do not carry a given weapon type, but it appears at first glance they get their inventory from either the Loot or NPC tables. Unless of course they carry a Unique.

 

Essentially, if a Faction (BoS, Enclave, Raider, etc) uses a given weapon there is an entry for it. Obviously certain weapons are more prevalent such as the Chinese Assault Rifle, as such it will have more entries.

 

What would be an interesting Test is the creation of a brand new weapon and associated Ammo/Weapon<Faction> entries. I'd like to see how the game handles that situation given our current tool sets.

 

Results of Test Run A:

Hunting Rifle (Subject Item of Test)

.308 Caliber Ammo (Subject Item of Test)

 

Upon replacing the appropriate FormID in the various Factions (as mentioned previously), the Test Subject NPC (Super Mutant) was carrying .308 Caliber Ammo (a single unit). As well as a few rounds of .32 Caliber Ammo. The Group LVLI does not appear to influence Ammo associated with the Weapon. A primary Inventory table must be somewhere else that governs what a NPC carries in ammo based upon the weapon.

 

Note:

Hunting Rifle is set to .308

 

Edited to reflect additional testing.

Link to comment
Share on other sites

When anything picks up a new weapon(thats empy on the ground) the game automaticly gives it ammo for that weapon.

You can actually cheat by destroying the weapon of say a supermutant, droping a minigun on the ground.. letting it pick it up and then killing it for both minigun ammo and whatever other ammo it had previously.

 

Are you sure you didnt just change the type of ammo needed and as the chars/npcs/mutants etc had already spawned they had been given ammo for the old class of weapon and not the new type of ammo required?

Link to comment
Share on other sites

When anything picks up a new weapon(thats empy on the ground) the game automaticly gives it ammo for that weapon.

You can actually cheat by destroying the weapon of say a supermutant, droping a minigun on the ground.. letting it pick it up and then killing it for both minigun ammo and whatever other ammo it had previously.

 

Are you sure you didnt just change the type of ammo needed and as the chars/npcs/mutants etc had already spawned they had been given ammo for the old class of weapon and not the new type of ammo required?

 

Thats an interesting thought. Basically, while the LVLI entry has all proper entries for the new ammo type, so the npc has access to the ammo. There is an entry somewhere dedicated to the weapon that creates the ammo in the inventory because the weapon is in the inventory. Not sure where I'll find that entry, but I'll keep looking.

 

Excellent idea.

Link to comment
Share on other sites

I THINK I've got it solved/fixed, at least as far as I can tell... further testing/playing will tell if it broke anything or not, but after MANY attempts, I've managed to rechamber the Chinese Assault Rifle to 5mm AND have NPCs carrying one also have the correct ammo for it (before they were freaking out because they had the wrong ammo and an empty gun, now they lock and load!).

 

OmtiTree, you were on the right track with the "WithAmmo" entries, but there were also other LVL records that were referenced by these, too... it's probably harder to explain than it is to just upload my "mod" and let folks have a look... and also see if I've done it right, or if something is broken by how I did it!

 

There IS a fair chance some NPCs might still have a problem, if they have their own specific loot table somewhere I didn't find... so let me know if that happens too!

 

The mod (my first ever!) is here:

 

http://www.fallout3nexus.com/downloads/file.php?id=369

 

I've also done one for the Hunting Rifle (rechambered to 5.56mm/.223) as well:

 

http://www.fallout3nexus.com/downloads/file.php?id=370

 

Again, this is my first EVER posted mod of anything, so please be gentle... but please let me know if things need fixing/changing.

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...