Results 1 to 9 of 9

Thread: Need help with my trader modlet

  1. #1
    Refugee
    Join Date
    May 2019
    Location
    Denmark
    Posts
    4
    Rep Power
    0

    Need help with my trader modlet

    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>

  2. #2
    Colony Founder
    Join Date
    Feb 2014
    Posts
    1,145
    Rep Power
    1
    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.

  3. #3
    Refugee
    Join Date
    May 2019
    Location
    Denmark
    Posts
    4
    Rep Power
    0
    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.

  4. #4
    Ranger Ragsy 2145's Avatar
    Join Date
    Dec 2018
    Location
    In your past mind
    Posts
    261
    Rep Power
    1
    Have you checked the xpaths ?


    Code:
    <remove xpath="/traders/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 Ragsy 2145; 4 Weeks Ago at 12:03 AM. Reason: More info

  5. #5
    Refugee
    Join Date
    May 2019
    Location
    Denmark
    Posts
    4
    Rep Power
    0
    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>

  6. #6
    Ranger Ragsy 2145's Avatar
    Join Date
    Dec 2018
    Location
    In your past mind
    Posts
    261
    Rep Power
    1
    Quote Originally Posted by SorenBC View Post
    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 Ragsy 2145; 4 Weeks Ago at 01:07 PM. Reason: More info

  7. #7
    Refugee OrbitalBliss's Avatar
    Join Date
    Mar 2019
    Posts
    21
    Rep Power
    0
    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')]"/>

  8. #8
    Refugee
    Join Date
    May 2019
    Location
    Denmark
    Posts
    4
    Rep Power
    0
    Quote Originally Posted by Ragsy 2145 View Post
    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.

    Quote Originally Posted by OrbitalBliss View Post
    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

  9. #9
    Ranger Ragsy 2145's Avatar
    Join Date
    Dec 2018
    Location
    In your past mind
    Posts
    261
    Rep Power
    1
    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.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •