• If you have a mod, tool or prefab, please use the Resources section. Click Mods at the top of the forums.

Need help with my trader modlet

SorenBC

Refugee
Hello. I am trying to remove the perk magazines from the trader, but keep the trader_item_group: perkMagazines, but I can´t get it to work.

The console tells me in yellow that it hasn´t been loaded but not why. I also tried a new game without eac but nothing.

I am still very new to this, so it´s most likely my code. So I could really use some help on this, thanks in advance.

Code:
<configs>

<remove xpath="/trader_item_groups/trader_item_group[@name='perkMagazines']/item[@name='magazinePerkShotgunMessiah']"/>
<remove xpath="/trader_item_groups/trader_item_group[@name='perkMagazines']/item[@name='magazinePerkAutomaticWeapons']"/>
<remove xpath="/trader_item_groups/trader_item_group[@name='perkMagazines']/item[@name='magazinePerkDeadEye']"/>
<remove xpath="/trader_item_groups/trader_item_group[@name='perkMagazines']/item[@name='magazinePerkArchery']"/>
<remove xpath="/trader_item_groups/trader_item_group[@name='perkMagazines']/item[@name='magazinePerkExplosiveWeapons']"/>
<remove xpath="/trader_item_groups/trader_item_group[@name='perkMagazines']/item[@name='magazinePerkHeadshot']"/>
<remove xpath="/trader_item_groups/trader_item_group[@name='perkMagazines']/item[@name='magazinePerkRunAndGun']"/>
<remove xpath="/trader_item_groups/trader_item_group[@name='perkMagazines']/item[@name='magazinePerkLuckyLooter']"/>
<remove xpath="/trader_item_groups/trader_item_group[@name='perkMagazines']/item[@name='magazinePerkSalvageOperations']"/>
<remove xpath="/trader_item_groups/trader_item_group[@name='perkMagazines']/item[@name='magazinePerkSexualTrex']"/>
<remove xpath="/trader_item_groups/trader_item_group[@name='perkMagazines']/item[@name='magazinePerkFlurryOfBlows']"/>
<remove xpath="/trader_item_groups/trader_item_group[@name='perkMagazines']/item[@name='magazinePerkDeepCuts']"/>
<remove xpath="/trader_item_groups/trader_item_group[@name='perkMagazines']/item[@name='magazinePerkStayDown']"/>
<remove xpath="/trader_item_groups/trader_item_group[@name='perkMagazines']/item[@name='magazinePerkHeavyMetal']"/>
<remove xpath="/trader_item_groups/trader_item_group[@name='perkMagazines']/item[@name='magazinePerkSkullCrusher']"/>
<remove xpath="/trader_item_groups/trader_item_group[@name='perkMagazines']/item[@name='magazinePerkMiner69r']"/>
<remove xpath="/trader_item_groups/trader_item_group[@name='perkMagazines']/item[@name='magazinePerkPackMule']"/>
<remove xpath="/trader_item_groups/trader_item_group[@name='perkMagazines']/item[@name='magazinePerkMotherLode']"/>
<remove xpath="/trader_item_groups/trader_item_group[@name='perkMagazines']/item[@name='magazinePerkHeavyArmor']"/>
<remove xpath="/trader_item_groups/trader_item_group[@name='perkMagazines']/item[@name='magazinePerkTheHuntsman']"/>
<remove xpath="/trader_item_groups/trader_item_group[@name='perkMagazines']/item[@name='magazinePerkIntrinsicImmunity']"/>
<remove xpath="/trader_item_groups/trader_item_group[@name='perkMagazines']/item[@name='magazinePerkWellInsulated']"/>
<remove xpath="/trader_item_groups/trader_item_group[@name='perkMagazines']/item[@name='magazinePerkLivingOffTheLand']"/>
<remove xpath="/trader_item_groups/trader_item_group[@name='perkMagazines']/item[@name='magazinePerkPainTolerance']"/>
<remove xpath="/trader_item_groups/trader_item_group[@name='perkMagazines']/item[@name='magazinePerkHealingFactor']"/>
<remove xpath="/trader_item_groups/trader_item_group[@name='perkMagazines']/item[@name='magazinePerkSlowMetabolism']"/>
<remove xpath="/trader_item_groups/trader_item_group[@name='perkMagazines']/item[@name='magazinePerkRuleOneCardio']"/>
<remove xpath="/trader_item_groups/trader_item_group[@name='perkMagazines']/item[@name='magazinePerkLightArmor']"/>
<remove xpath="/trader_item_groups/trader_item_group[@name='perkMagazines']/item[@name='magazinePerkChargingBull']"/>
<remove xpath="/trader_item_groups/trader_item_group[@name='perkMagazines']/item[@name='magazinePerkParkour']"/>
<remove xpath="/trader_item_groups/trader_item_group[@name='perkMagazines']/item[@name='magazinePerkOlympicSwimmer']"/>
<remove xpath="/trader_item_groups/trader_item_group[@name='perkMagazines']/item[@name='magazinePerkNinjaMovement']"/>
<remove xpath="/trader_item_groups/trader_item_group[@name='perkMagazines']/item[@name='magazinePerkHiddenStrike']"/>
<remove xpath="/trader_item_groups/trader_item_group[@name='perkMagazines']/item[@name='magazinePerkFromTheShadows']"/>
<remove xpath="/trader_item_groups/trader_item_group[@name='perkMagazines']/item[@name='magazinePerkBetterBarter']"/>
<remove xpath="/trader_item_groups/trader_item_group[@name='perkMagazines']/item[@name='magazinePerkDaringAdventurer']"/>
<remove xpath="/trader_item_groups/trader_item_group[@name='perkMagazines']/item[@name='magazinePerkCharismaticNature']"/>
<remove xpath="/trader_item_groups/trader_item_group[@name='perkMagazines']/item[@name='magazinePerkHammerForge']"/>
<remove xpath="/trader_item_groups/trader_item_group[@name='perkMagazines']/item[@name='magazinePerkGreaseMonkey']"/>
<remove xpath="/trader_item_groups/trader_item_group[@name='perkMagazines']/item[@name='magazinePerkAdvancedEngineering']"/>
<remove xpath="/trader_item_groups/trader_item_group[@name='perkMagazines']/item[@name='magazinePerkYeahScience']"/>
<remove xpath="/trader_item_groups/trader_item_group[@name='perkMagazines']/item[@name='magazinePerkPhysician']"/>
<remove xpath="/trader_item_groups/trader_item_group[@name='perkMagazines']/item[@name='magazinePerkMasterChef']"/>

</configs>
 
I haven't tried to mod 7 Days to Die too much myself, but I believe this file should be saved in Mods\Name_Of_Your_Mod\Config\traders.xml, but you should also make sure that the whole directory and file structure is correct. Try to read this thread, if you didn't do that yet. It should help you make sure that your mod has correct structure.

 
Hello, thanks for replying.

Sorry for not clarifying I am kinda new to this whole forum thing.

It is saved in its own mod folder with the correct structure and a ModInfo.xml.

There are other parts of this mod that is working correctly, like items.xml and loot.xml. It is only the trader.xml that isn't working, where the code from above is from.

 
Have you checked the xpaths ?

Code:
<[color="#FFD700"]remove xpath="/traders[/color]/trader_item_groups/trader_item_group[@name='perkMagazines']/item[@name='magazinePerkShotgunMessiah']"/>
Although it does not seem obvious on some xml files where the start node name is

similar to this one where we changed the inventory size

Code:
<set xpath="/traders/trader_info[@id='1']/@max_inventory">100</set>
And loot.xml is another example that at first sight does not look obvious where the start node is

Code:
<remove xpath="/lootcontainers/lootgroup[@name='gasPumps']"></remove>
Hope this helps

Ragsy

 
Last edited by a moderator:
Thanks you so much, I had completely overlooked the traders path at line 01.

Now it works perfectly, this has been nagging me for days :)

Now that I have your attention maybe you you could help me with a different problem.

I am trying to make a mod that destroys garbage pile containers when you close them but I can't get it to work.

I basically want to add the destroy_on_close="true" attribute to the container.

I tried using the setattribute function but kept getting red errors...

This is my latest attempt:

Code:
<configs>
<append xpath="/lootcontainers/lootcontainer[@id='10']">
<destroy_on_close="true">
</append>
</configs>
 
Thanks you so much, I had completely overlooked the traders path at line 01.Now it works perfectly, this has been nagging me for days :)

Now that I have your attention maybe you you could help me with a different problem.

I am trying to make a mod that destroys garbage pile containers when you close them but I can't get it to work.

I basically want to add the destroy_on_close="true" attribute to the container.

I tried using the setattribute function but kept getting red errors...

This is my latest attempt:

Code:
<configs>
<append xpath="/lootcontainers/lootcontainer[@id='10']">
<destroy_on_close="true">
</append>
</configs>

Glad I could help you out :) and you have the trader changes working as desired.

Regarding the other option to destroy garbage.

I have a modlet already that does this called Take Out The Trash. There are other versions by other modders on the forums , mine is slightly different take on it.

If you just want the id=10 to destroy garbage bags and containers bear in mind it also destroys the small waste bins found in loo's and the zoe's salon POI where as my version does not.

The set attribute is a clean method and the code I used on my modlet is as follows

Code:
<setattribute xpath="/lootcontainers/lootcontainer[@id='10']" name="destroy_on_close">true</setattribute>
Feel free to look at any of the code I have to get inspiration for other ideas you may have yourself and I wish you good luck with the modding experience.

Once hooked it will take over your life ;)

Ragsy !!

 
Last edited by a moderator:
Also, you could shorten your remove code by a lot if you are targetting 'all' magazinesPerk items, which it looks like you are.

Try:

Code:
<remove xpath="//item[contains(@name, 'magazinePerk')]"/>
 
Glad I could help you out :) and you have the trader changes working as desired.

Regarding the other option to destroy garbage.

I have a modlet already that does this called Take Out The Trash. There are other versions by other modders on the forums , mine is slightly different take on it.

If you just want the id=10 to destroy garbage bags and containers bear in mind it also destroys the small waste bins found in loo's and the zoe's salon POI where as my version does not.

The set attribute is a clean method and the code I used on my modlet is as follows

Code:
<setattribute xpath="/lootcontainers/lootcontainer[@id='10']" name="destroy_on_close">true</setattribute>
Feel free to look at any of the code I have to get inspiration for other ideas you may have yourself and I wish you good luck with the modding experience.

Once hooked it will take over your life ;)

Ragsy !!
Thanks again, I had not considered the trash bins, that would have been awkward... I will try out your mod. Glad I am not the only one annoyed by the oxymoron that is empty garbage ;)

It is a fun game to mod and play around with, I am definitely hooked already.

Also, you could shorten your remove code by a lot if you are targetting 'all' magazinesPerk items, which it looks like you are.
Try:

Code:
<remove xpath="//item[contains(@name, 'magazinePerk')]"/>
That is indeed very clean, I will try it out. I have been reading up on it but the examples were too complicated for me :)

 
Well if this helps you in anyway

Start simple .... you will have messy but functional stuff and the cool looking neat stuff comes from the experience of playing with the messy code and the odd pointer you pick up along the way such as posted above by OrbitalBliss.

 
Back
Top