Page 35 of 36 FirstFirst ... 2533343536 LastLast
Results 511 to 525 of 540

Thread: XPath Modding Explanation Thread

  1. #511
    Colony Founder sphereii's Avatar
    Join Date
    Dec 2015
    Posts
    3,685
    Rep Power
    1
    Quote Originally Posted by layarion View Post
    ...i need to remove these T5 quest from vanilla quests.xml: https://i.imgur.com/cSOOrT2.png

    Code:
        <quest_list id="trader_quests">
            <!-- Tier 1 -->
                <quest id="tier1_clear" />
                <quest id="tier1_fetch" />
                <quest id="tier1_buried_supplies" />
            <!-- Tier 2 -->
                <quest id="tier2_clear" />
                <quest id="tier2_fetch" />
                <quest id="tier2_hidden_cache" />
                <quest id="tier2_fetch_clear" />
            <!-- Tier 3 -->
                <quest id="tier3_clear" />
                <quest id="tier3_fetch" />
                <quest id="tier3_hidden_cache" />
                <quest id="tier3_fetch_clear" />
                <quest id="tier3_hidden_clear" />
            <!-- Tier 4 -->
                <quest id="tier4_clear" />
                <quest id="tier4_fetch" />
                <quest id="tier4_hidden_cache" />
                <quest id="tier4_fetch_clear" />
                <quest id="tier4_hidden_clear" />    
            <!-- Tier 5 -->
                <quest id="tier5_clear" />
                <quest id="tier5_fetch" />
                <quest id="tier5_hidden_cache" />
                <quest id="tier5_fetch_clear" />
                <quest id="tier5_hidden_clear" />
            <!-- Tier 6 -->
                <!--    <quest id="tier6_clear" /> -->
                <!--    <quest id="tier6_fetch" /> -->
                <!--    <quest id="tier6_hidden_cache" /> -->
                <!--    <quest id="tier6_fetch_clear" /> -->
                <!--    <quest id="tier6_hidden_clear" /> -->
        </quest_list>
    This is what i got, but doubt it's right, and i can't test it right now:
    Code:
    <configs>
        <remove xpath="/quests/quest_list[@id='trader_quests']//quest[@id='tier5_clear']"/>
        <remove xpath="/quests/quest_list[@id='trader_quests']//quest[@id='tier5_fetch']"/>
        <remove xpath="/quests/quest_list[@id='trader_quests']//quest[@id='tier5_hidden_cache']"/>
        <remove xpath="/quests/quest_list[@id='trader_quests']//quest[@id='tier5_fetch_clear']"/>
        <remove xpath="/quests/quest_list[@id='trader_quests']//quest[@id='tier5_hidden_clear']"/>
    </configs>
    this is to bypass a game-breaking bug found here: https://7daystodie.com/forums/showth...FoundException
    That should work. Are you getting any errors or warnings in your output_log.txt of it not applying?

  2. #512
    Refugee
    Join Date
    Jul 2019
    Posts
    2
    Rep Power
    0
    Hi,It's me again
    This time I need help on how to change the dry time of the concrete block on both the reinforce and the normal one, I been doing some digging but came up with nothing ,So before I change every value I see , I would like to ask you for help!

  3. #513
    Refugee
    Join Date
    Aug 2019
    Posts
    2
    Rep Power
    0
    Quote Originally Posted by PasiRin View Post
    Hi,It's me again
    This time I need help on how to change the dry time of the concrete block on both the reinforce and the normal one, I been doing some digging but came up with nothing ,So before I change every value I see , I would like to ask you for help!
    Hi,

    To change the drying speed of concrete you need to change the values for UpgradeRated.Rate under pouredConcreteMaster and pouredRConcreteMaster blocks in blocks.xml file.

    It appears that it dries fastest when the value is 1 (default value is 4 and 5 respectively). I have tried lower values but decimals (e.g. 0.5) give an error and the world fails to load and 0 or negative values didn't seem to be any different from 1. Someone please correct me if there are any values which make it even faster.

    Alternatively to editing the file yourself, you can download my mod which I have created just now and which does exactly that: https://www.nexusmods.com/7daystodie/mods/406

    Here's the code that my mod uses.

    Code:
    <configs>
    	<set xpath="/blocks/block[@name='pouredConcreteMaster']/property[@name='UpgradeRated.Rate']/@value">1</set>
    	<set xpath="/blocks/block[@name='pouredRConcreteMaster']/property[@name='UpgradeRated.Rate']/@value">1</set>
    </configs>

  4. #514
    Refugee
    Join Date
    Aug 2019
    Posts
    2
    Rep Power
    0
    Hi,

    I have a question regarding the xpath command remove.

    Is it possible to remove only a part of a string in an attribute?

    For example, Advanced Engineering skill level 2 teaches these recipes:

    gunPistol,gunPumpShotgun,gunHuntingRifle,spotlight Player,speaker,pressureplate,pressureplateLong,ele ctrictimerrelay,motionsensor,cementMixer,ammoDartS teel,dartTrap

    Code:
    <passive_effect name="RecipeTagUnlocked" operation="base_set" value="1" level="2,5" tags="gunPistol,gunPumpShotgun,gunHuntingRifle,spotlightPlayer,speaker,pressureplate,pressureplateLong,electrictimerrelay,motionsensor,cementMixer,ammoDartSteel,dartTrap" />
    Is is possible to use the remove command to remove only a single recipe from this skill? I tried to format the remove command in a similar fashion as append command but that didn't work.

    Code:
    <remove xpath="/progression/perks/perk[@name='perkAdvancedEngineering']/effect_group/passive_effect[@name='RecipeTagUnlocked' and @level='2,5']/@tags">,dartTrap</remove>
    Or do I have to use the set command and set it to the same string but without the one recipe that I don't want there?

    Code:
    <set xpath="/progression/perks/perk[@name='perkAdvancedEngineering']/effect_group/passive_effect[@name='RecipeTagUnlocked' and @level='2,5']/@tags">gunPistol,gunPumpShotgun,gunHuntingRifle,spotlightPlayer,speaker,pressureplate,pressureplateLong,electrictimerrelay,motionsensor,cementMixer,ammoDartSteel</set>
    Is there any other command which can remove only a specific part of the string?

    Thanks.

  5. #515
    Reconstructionist layarion's Avatar
    Join Date
    Jun 2015
    Location
    U.S.A. East Coast
    Posts
    566
    Rep Power
    0
    could you add a page explaining how to use different Xpath functions such as pulling a numerical value from the vanilla files, and multiplying them by 2, and then setting that multiplication as the new value?

  6. #516
    Colony Founder sphereii's Avatar
    Join Date
    Dec 2015
    Posts
    3,685
    Rep Power
    1
    Quote Originally Posted by moriakGG View Post
    Hi,

    I have a question regarding the xpath command remove.

    Is it possible to remove only a part of a string in an attribute?

    For example, Advanced Engineering skill level 2 teaches these recipes:

    gunPistol,gunPumpShotgun,gunHuntingRifle,spotlight Player,speaker,pressureplate,pressureplateLong,ele ctrictimerrelay,motionsensor,cementMixer,ammoDartS teel,dartTrap

    Code:
    <passive_effect name="RecipeTagUnlocked" operation="base_set" value="1" level="2,5" tags="gunPistol,gunPumpShotgun,gunHuntingRifle,spotlightPlayer,speaker,pressureplate,pressureplateLong,electrictimerrelay,motionsensor,cementMixer,ammoDartSteel,dartTrap" />
    Is is possible to use the remove command to remove only a single recipe from this skill? I tried to format the remove command in a similar fashion as append command but that didn't work.

    Code:
    <remove xpath="/progression/perks/perk[@name='perkAdvancedEngineering']/effect_group/passive_effect[@name='RecipeTagUnlocked' and @level='2,5']/@tags">,dartTrap</remove>
    Or do I have to use the set command and set it to the same string but without the one recipe that I don't want there?

    Code:
    <set xpath="/progression/perks/perk[@name='perkAdvancedEngineering']/effect_group/passive_effect[@name='RecipeTagUnlocked' and @level='2,5']/@tags">gunPistol,gunPumpShotgun,gunHuntingRifle,spotlightPlayer,speaker,pressureplate,pressureplateLong,electrictimerrelay,motionsensor,cementMixer,ammoDartSteel</set>
    Is there any other command which can remove only a specific part of the string?

    Thanks.
    I don't think its possible. XPath itself is just a method of referencing XML nodes and attributes, and the game's own settings control what it can do with that information. Remove itself removes a node or attribute, but not a sub-string value. Append can add a sub-string, but I don't think its possible to remove one.

  7. #517
    Colony Founder sphereii's Avatar
    Join Date
    Dec 2015
    Posts
    3,685
    Rep Power
    1
    Quote Originally Posted by layarion View Post
    could you add a page explaining how to use different Xpath functions such as pulling a numerical value from the vanilla files, and multiplying them by 2, and then setting that multiplication as the new value?
    I don't think this is possible either. While you can do math in an xpath evaluation, there isn't a way for us to take the new value it calculates and add it to the @value.

    The xpath="" finds the node, then the game takes the <set, <append, etc and replaces the node or attribute with the >NEED THE CALCULATED VALUE HERE<. Inside those > <, there isn't support for an xpath statement.
    Code:
    <set xpath="/myNod/price">NEED THE CALCULATED VALUE HERE</set>

  8. #518
    Colony Founder Laz Man's Avatar
    Join Date
    Jan 2014
    Posts
    4,538
    Rep Power
    1
    Thanks for this tutorial. Will try creating a prefab modlet soon. 😎

  9. #519
    Guppycurian Forum Whore Guppycur's Avatar
    Join Date
    Apr 2014
    Location
    Enemy for life
    Posts
    22,399
    Rep Power
    1
    Yeh, so about that ...

  10. #520
    Colony Founder sphereii's Avatar
    Join Date
    Dec 2015
    Posts
    3,685
    Rep Power
    1
    Last edited by sphereii; 2 Weeks Ago at 12:36 PM.

  11. #521
    Refugee
    Join Date
    Oct 2019
    Posts
    3
    Rep Power
    0
    I understand how to change the size of a loot container's loot box. What I don't understand is how to make a mod that edits the amount of each item in the loot container.

    For example, I know

    <set xpath="/lootcontainers/lootcontainer[@id='25']/@size">7,6</set>
    will change the bird nest's loot box size to 7x6.

    However, how do I change the amount of eggs and feathers gained from each bird's nest? I don't understand how to point to "resourceFeather" to change the count. I know I can easily change the XML itself. What I'm asking is how do I make a modlet to edit this?

    <lootcontainer id="25" count="1,2" size="6,2" sound_open="UseActions/open_garbage" sound_close="UseActions/close_garbage" loot_quality_template="qualBaseTemplate">
    <item name="foodEgg" prob="0.25"/>
    <item name="resourceFeather" count="1,5" prob="0.75"/>
    </lootcontainer>

    I've tried

    Code:
    <config> <set xpath="/loot/lootcontainer[@id='25']/@name='resourceFeather'/@count">5,10</set> </config>
    and many other things but nothing works. Can't find any other mods to reverse engineer to make this work, either.
    Last edited by GoGoGadget; 2 Weeks Ago at 02:18 PM.

  12. #522
    Colony Founder sphereii's Avatar
    Join Date
    Dec 2015
    Posts
    3,685
    Rep Power
    1
    Quote Originally Posted by GoGoGadget View Post
    I understand how to change the size of a loot container's loot box. What I don't understand is how to make a mod that edits the amount of each item in the loot container.

    For example, I know

    <set xpath="/lootcontainers/lootcontainer[@id='25']/@size">7,6</set>
    will change the bird nest's loot box size to 7x6.

    However, how do I change the amount of eggs and feathers gained from each bird's nest? I don't understand how to point to "resourceFeather" to change the count. I know I can easily change the XML itself. What I'm asking is how do I make a modlet to edit this?

    <lootcontainer id="25" count="1,2" size="6,2" sound_open="UseActions/open_garbage" sound_close="UseActions/close_garbage" loot_quality_template="qualBaseTemplate">
    <item name="foodEgg" prob="0.25"/>
    <item name="resourceFeather" count="1,5" prob="0.75"/>
    </lootcontainer>

    I've tried

    Code:
    <config> <set xpath="/loot/lootcontainer[@id='25']/@name='resourceFeather'/@count">5,10</set> </config>
    and many other things but nothing works. Can't find any other mods to reverse engineer to make this work, either.
    Your XPath starts with /loot/, which isn't a valid node. Shouldn't it be xpath="/lootcontainers/ ?

  13. #523
    Refugee
    Join Date
    Oct 2019
    Posts
    3
    Rep Power
    0
    Quote Originally Posted by sphereii View Post
    Your XPath starts with /loot/, which isn't a valid node. Shouldn't it be xpath="/lootcontainers/ ?
    Is everything else right? I still get an error "XpathException: Expression must evaluate to a node-set" after changing it to

    <config>
    <set xpath="/lootcontainers[@id='25']/@name='resourceFeather'/@count">5,10</set>
    </config>
    I've tried <set xpath="/lootcontainers/lootcontainer[@id='25']/@name='resourceFeather'/@count">5,10</set> too and get the same error.

    I'm just not clear on how to target the things beyond "[@id='25']" and its attributes.
    Last edited by GoGoGadget; 2 Weeks Ago at 02:44 PM.

  14. #524
    Colony Founder sphereii's Avatar
    Join Date
    Dec 2015
    Posts
    3,685
    Rep Power
    1
    Quote Originally Posted by GoGoGadget View Post
    Is everything else right? I still get an error "XpathException: Expression must evaluate to a node-set" after changing it to

    <config>
    <set xpath="/lootcontainers[@id='25']/@name='resourceFeather'/@count">5,10</set>
    </config>
    I've tried <set xpath="/lootcontainers/lootcontainer[@id='25']/@name='resourceFeather'/@count">5,10</set> too and get the same error.

    I'm just not clear on how to target the things beyond "[@id='25']" and its attributes.
    Oh, sorry, I did misunderstand

    The words in between the / / are nodes in the XML.

    Code:
    	<lootcontainer id="25" count="1,2" size="6,2" sound_open="UseActions/open_garbage" sound_close="UseActions/close_garbage" loot_quality_template="qualBaseTemplate">
    		<item name="foodEgg" prob="0.25"/>
    		<item name="resourceFeather" count="1,5" prob="0.75"/>
    	</lootcontainer>
    To reference the count, you want to do this:

    xpath="/lootcontainers/lootcontainer[@id='25'"]/item[@name='resourceFeather']/@count"

    The item itself is a node, that has a name, much like the lootcontainer has an id.

  15. #525
    Refugee
    Join Date
    Oct 2019
    Posts
    3
    Rep Power
    0
    <config>
    <set xpath="/lootcontainers/lootcontainer[@id='25'"]/item[@name='resourceFeather']/@count">5,10</set>
    </config>

    gives me an error upon loading "XmlException: name cannot begin with the "]" character, hexadecimal value 0x5D. Line 2, position 53" which I believe is referring to the "]" after @id='25'"]?

    Edit: Figured it out, it was the " after '25'. Thanks for the help!

Posting Permissions

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