Jump to content

Looking for easy way to remove Guns/Ammo/Explosives from all loot containers

Recommended Posts

Hey guys, In my custom mod the setting is more focused on melee and primitive ranged weaponry (Bows, Spears) so I'm looking for ideas to make removing Guns/Ammo/Explosives/Modern Weaponry from all Loot Containers, as well as their crafting components (Rifle Parts, Pistol Parts, etc)


In "loot.xml" would I want to look through every lootgroup, and note down its Name tag, then in my mod's "loot.xml" I'll access that lootcontainer and do necessary edits?


Or perhaps there is a way to access every loot container and, for example, if it had:

<item name="resourceGunPowder" count ="VALUE HERE"/>

I could append/set the count to 0, or remove that item from Loot Containers that have "resourceGunPowder".

By "access every loot container" I'm thinking something simple like this:

if lootgroup contains "resourceGunPowder", then count = 0
if lootgroup contains "resourceGunPowder", then remove resourceGunPowder from lootgroup




Thoughts? Suggestions? Thanks : )

Link to comment
Share on other sites

I would recommend creating a small modlet that does the following


<set xpath="/lootcontainers/lootgroup/item[contains(@name='ammo')]/@name">resourceScrapIron</set>


In this example, this one line will change all instances of loot containing the word ammo in it to resourceScrapIron..  I used scrap iron as a replacement, but this way you get something back if that group is rolled on the loot table.  Otherwise, if you just remove the items, you will be looting containers and not getting anything (like weapon bags).


You can do the same thing with guns, gun parts, etc.


Once you load up the modlet in a new world, you can check the output data file to see if the code is changing all those instances that you wanted.

Link to comment
Share on other sites


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

  • Create New...