Jump to content

I'm trying to add a new lootgroup to a container but I'm doing something wrong


Recommended Posts

<config>

 

    <append xpath="/lootcontainers/">

        <lootgroup name="soldierGunParts" prob="1">
            <item name="partsPistol_barrel" prob="1"/>
            <item name="partsPistol_grip" prob="1"/>
            <item name="partsPistol_parts" prob="1"/>
            <item name="partsPistol_receiver" prob="1"/>
        </lootgroup>
        
        <append xpath="/lootcontainers/lootgroup[@name='zombieSoldier']">
            <lootgroup name="soldierGunParts"/>
        </append>
    </append>
    
</config>

Edited by LastTugBoat243
misspelling (see edit history)
Link to comment
Share on other sites

  • LastTugBoat243 changed the title to I'm trying to add a new lootgroup to a container but I'm doing something wrong

You are saying you are doing something wrong, but not explaining what is happening in game for you.

 

Somethings I noticed:

 

your first bit of code is adding a new lootgroup, but the way it is coded, it is being added to the end of the loot file which is after lootcontainer.  Change 

 

<append xpath="/lootcontainers/">

 

to

 

<append xpath="/lootcontainers/lootgroup[@name='groupCaskets']">

 

That should add it after the last lootgroup in the vanilla xml file.  But based on your coding, you are modding a mod, so maybe check that one out to ensure you are putting it inside the lootgroup areas.

 

Second,  your </append> structure is wrong.  After the first append (but before the second append), you need to close it out with its own </append> .  So your code should look something like this:

 

<config>

    <append xpath="/lootcontainers/lootgroup[@name='groupCaskets']">
        <lootgroup name="soldierGunParts" prob="1">
            <item name="partsPistol_barrel" prob="1"/>
            <item name="partsPistol_grip" prob="1"/>
            <item name="partsPistol_parts" prob="1"/>
            <item name="partsPistol_receiver" prob="1"/>
        </lootgroup>
	</append>
        
	<append xpath="/lootcontainers/lootgroup[@name='zombieSoldier']">
            <lootgroup name="soldierGunParts"/>
	</append>
</config>

 

Link to comment
Share on other sites

13 hours ago, LastTugBoat243 said:

I tried the code but its saying that the xml patch did not applyimage.thumb.png.e60af82089c2ac86ee10b45be1d72770.png

 

In the vanilla game, there is no loot group called "zombieSoldier".

 

In vanilla, the entity that is dropped when a zombie dies, is determined by its "LootDropEntityClass" property in its entity class (in entityclasses.xml). That is in the "zombieTemplateMale" entity and is inherited by other zombies. Unless the individual zombie entity class overrides it, it will be the "EntityLootContainerRegular" entity.

 

That is the case for most soldier zombies. The exception is radiated soldier zombies, and that is overridden so they drop "EntityLootContainerStrong" loot bag entities.

 

Those loot container entities, in turn, use different loot containers, as determined by their "LootListOnDeath" values. "EntityLootContainerRegular" uses the "zPackReg" loot container. "EntityLootContainerStrong" uses the "zPackStrong" loot container.

 

The "zPackReg" loot container uses the "groupZpackReg" loot group, and the "zPackStrong" loot container uses the "groupZpackStrong" loot group.

 

So if you want to make soldier zombies - and only soldier zombies - drop gun parts, you will need to do this:

  1. In loot.xml, create a new loot group for soldier zombies (or loot groups plural, if you want to follow the vanilla game and have radiated zombies drop better loot)
  2. In loot.xml, create new loot container(s) that uses the new loot group(s)
  3. In entityclasses.xml, create a new loot container entity (or entities) that uses that new loot container
  4. In entityclasses.xml, make the soldiers drop the entity container(s) by overriding or replacing the value of the soldier zombies' "LootDropEntityClass" properties

Good luck!

Edited by khzmusik (see edit history)
Link to comment
Share on other sites


Well I got to work .

 


Untitled.png

image.png

<config>

    <append xpath="//lootcontainers">
        <lootgroup name="soldierGunParts" count="3" prob="1">
            <item name="partsPistol_barrel" />
            <item name="partsPistol_grip" />
            <item name="partsPistol_parts" />
            <item name="partsPistol_receiver" />
        </lootgroup>
    </append>
        
    <append xpath="//lootcontainer[@id='281']">
            <lootgroup name="soldierGunParts"/>
    </append>
</config>

Edited by LastTugBoat243
misspelling (see edit history)
Link to comment
Share on other sites

I am glad you got it to work. But, from your screenshots, you are using one or more mods.

 

Vanilla (non-modded) 7D2D is different from that mod:

  • Players can not loot the bodies of zombies. (Zombies drop loot bags, players can only loot those.)
  • There is no loot container with the ID of 281.
  • There are no pistol barrels, grips, parts, or receivers.

Since you didn't tell us you are using a mod, none of us had any way to know about those differences.

 

In the future, you need to tell people those details when you ask for help. Otherwise you will only confuse people, and get advice that won't help you.

Link to comment
Share on other sites

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
×
×
  • Create New...