Announcement

Collapse
No announcement yet.

XPath Modding Explanation Thread

Collapse
This is a sticky topic.
X
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Originally posted by Tallon View Post
    It was to an actual Block
    Do you have the full error?

    - - - Updated - - -

    Originally posted by Heliox View Post
    id=numbers or not in use anymore, or are they?

    cant see them anywhere
    if yes, where do i find the ids?
    if no, the id is now the item/block name?
    Loot containers, as far as I know, still use hard coded numbers, rather than names. Hopefully that'll see a similar update as the blocks.xml and items.xml in the future. You would have to manually look through the loot.xml to find a 'free' sequential number.

    - - - Updated - - -

    Originally posted by ivailogeimara View Post
    Edit: I just checked the game code and saw that "AnimatotSet" functions don't accept CVars.

    Hi
    I am trying to pass an Int variable to the AnimationController but for some reason I get an error.

    If I do:
    Code:
        <triggered_effect trigger="onSelfPrimaryActionStart" action="ModifyCVar" target="self" cvar="TestCVar" operation="set" value="1"/>
        <triggered_effect trigger="onSelfPrimaryActionStart" action="AnimatorSetInt" target="self" property="TempProp" value="@TestCVar"/>
    I get:
    Code:
    ERR XML loader: Loading and parsing 'items.xml' failed
    FormatException: Input string was not in the correct format.
    and if I do:
    Code:
        <triggered_effect trigger="onSelfPrimaryActionStart" action="ModifyCVar" target="self" cvar="TestCVar" operation="set" value="1"/>
        <triggered_effect trigger="onSelfPrimaryActionStart" action="AnimatorSetFloat" target="self" property="TempProp" value="@TestCVar"/>
    I get:
    Code:
    ERR XML loader: Loading and parsing 'items.xml' failed
    FormatException: Unknown char: @ (input: '@TempCVar')
    Basically these are the 2 lines that are causing it (actually the last line is causing it). For sake of testing I just created a new CVar and tried to pass it to the AnimationController.


    If I pass a value like "3" it works fine. In this post from last year is noted that you can use a CVar for value with '@' in front of the name of the CVar and you can use it with Animator actions.
    What am I doing wrong?
    That's unfortunate it doesn't use cvars. That could have been used in a few interesting ways.

    Comment


    • hi there, i followed your guide and attempted to add in a stainless steel mod but make it so that instead of it being craftable that it would be obtainable from the trader, i created a traders.xml file, added in the following code: <trader_item_group name="generalResources"> <!-- bundle size -->
      <item name="steelPolish" count="50,1000"/> <!-- 50 -->

      i know i went somewhere wrong, i had to open and close the code so to speak? so i put <append=xpath> or something, i tried different variations, i am very noob at this stuff sorry, i was just wondering if someone can help me figure this out, thanks.

      Link to the mod and my issue here: https://7daystodie.com/forums/showth...el-Again/page2

      Comment


      • I don't think I read anything about setting the position of elements.

        I'd like to move the UI elements out towards the edges more.

        Only the things you see when no windows are open, like health, stamina, compass, toolbelt etc. All the static elements.

        I've downloaded an addon that's a windows.xml to kinda dissect, if you will, but I can't make heads or tails of 'pos" attribute. I don't know where these values would be on screen.

        Comment


        • Is it something wrong with my game or <property name="Sound_reload"> does not work? I tried to change the reload sound of my imported gun and nothing happened (it plays default pistol reload sound). Then I tested with simple mod:
          items.xml
          Code:
          <config>
              <set xpath="/items/item[@name='gunPistol']/property[@class='Action0']/property[@name='Sound_reload']/@value">44magnum_reload</set>
          </config>
          and again the pistol_reload (not 44magnum_reload) sound plays.
          Last edited by ivailogeimara; 10-30-2019, 11:58 PM.

          Comment


          • This may sound silly, but is xpath limited to changes to xml files within only the config folder? I am trying to write a modlet for changes to an xml file contained within the Worlds directory instead.

            For example, adding the following prefab location line to a World Map prefabs.xml file.

            Code:
                <decoration type="model" name="LazManPrison" position="5755,28,3164" rotation="0" />

            Comment


            • Originally posted by Laz Man View Post
              This may sound silly, but is xpath limited to changes to xml files within only the config folder? I am trying to write a modlet for changes to an xml file contained within the Worlds directory instead.

              For example, adding the following prefab location line to a World Map prefabs.xml file.

              Code:
                  <decoration type="model" name="LazManPrison" position="5755,28,3164" rotation="0" />
              I think only the Data/Config files are read for xpath insertion. I'm assuming this is to add something to Navezgane?

              Comment


              • Originally posted by sphereii View Post
                I think only the Data/Config files are read for xpath insertion. I'm assuming this is to add something to Navezgane?
                A custom world. No big deal though. Will just ask creator to include the xml edits and/or provide copy/paste instructions with the files. Thanks sphereii!

                Comment


                • Originally posted by Laz Man View Post
                  A custom world. No big deal though. Will just ask creator to include the xml edits and/or provide copy/paste instructions with the files. Thanks sphereii!
                  No problem. Good luck!

                  Comment


                  • Originally posted by Laz Man View Post
                    A custom world. No big deal though. Will just ask creator to include the xml edits and/or provide copy/paste instructions with the files. Thanks sphereii!
                    Add a mods/modname/worlds/yourworldname folder and put the fully edited prefabs.xml in there.

                    No Xpath, but it should "install" the worlds folder when run.

                    Comment


                    • Originally posted by Guppycur View Post
                      Add a mods/modname/worlds/yourworldname folder and put the fully edited prefabs.xml in there.

                      No Xpath, but it should "install" the worlds folder when run.
                      I think he was trying to add the prison to someone else' generated world. Kind of like a mod to an existing worl.

                      Comment


                      • Yeh, he's adding it to Sam Neils world (see prefab section). If Sam packages it correctly (they're both learning how I think?), it'll be a non issue for him.

                        Comment


                        • I not speak english. Sorry my english.
                          Not work:
                          <removeattribute xpath="/Sounds/SoundDataNode[@name='Auger_Fire_Start']/Noise/heat_map_strength" />
                          Work:
                          <removeattribute xpath="/Sounds/SoundDataNode[@name='Auger_Fire_Start']/Noise/@heat_map_strength" />

                          A18

                          Thanks for the description. Greatly help.
                          Last edited by MxSam; 11-05-2019, 01:29 PM.

                          Comment


                          • hello, I'm looking for some help if u dont mind :c

                            Because I changed max stacks of items I also need to change the bundles to something more appropriate. So I did, but their names specify how many units they used to contain.

                            I need to change the name of the bundle items.

                            1 - preferred method through a property, couldn't find one working so far.

                            2 - localization file, I dislike that they would need to download it but whatever, thing is I put the localization file with the exact same name and structure in the indicated folder, loaded the game, the changes aren't reflected there yet no error is shown.

                            would you know a property to change its name or take a look at my localization file? its inside the config folder of the mod.

                            thanks!

                            Localization.txt
                            Last edited by danielspoa; 11-06-2019, 01:02 AM.

                            Comment


                            • Originally posted by Guppycur View Post
                              Yeh, he's adding it to Sam Neils world (see prefab section). If Sam packages it correctly (they're both learning how I think?), it'll be a non issue for him.
                              Yeah, I think sam incorporated into his v14 so my installation instructions probably no longer needed...😂

                              Comment


                              • Hi guys. I feel really, really dumb. I've tried and tried to grasp XPath and been through the tutorials and looked at other mods and I just cannot get the syntax of it right. Sometimes it works for me, but mostly it doesn't seem to.

                                Can someone help me understand how to alter the birdnest block as an example and maybe I can finally get a firm understanding of how some of this is supposed to be properly done? I picked this block because I do want to change it and also I think it's a good example of covering several different cases such as altering, removing and appending lines.

                                Here's what I could really use help with:

                                1) Does the name of the XML file in a modlet matter? For example Can I use birdnest.xml to implement changes (provided I use proper syntax and nesting) or does it need to be blocks.xml ?

                                2) Does nesting in the XML file need to contain <config> or <configs>? Is there a necessary syntax for that (it doesn't seem so judging from other modlets I looked at trying to understand). Can I just use <JRavens> or <blahblahblah> so long as it has the requisite closing piece </JRavens>, </blahblahblah> etc.

                                3) Let's say I want to change a blocks material. In this example changing the birdnest from Wood to Grass (because well I think it's a little silly that birdnests have 100 health, clunk when you walk over them and explode into wood chips when destroyed). I tried this with no success:

                                Code:
                                <set xpath="/blocks/block[@name='cntBirdnest']/property[@name='Material']/@value">Mtallgrass</set>
                                4) Since I don't want bird nests to be harvested (just destroyed) I want to alter the harvest and destroy lines
                                (i.e. I want to player to get a some fibers and maybe some additional feathers when a nest is destroyed)

                                So I want to remove these lines:
                                Code:
                                	<drop event="Harvest" name="resourceCloth" count="1" prob="0.3" tag="allHarvest"/>
                                	<drop event="Harvest" name="resourceFeather" count="3" prob="0.35" tag="allHarvest"/>
                                	<drop event="Harvest" name="resourceFeather" count="2" prob="0.6" tag="allHarvest"/>
                                What's the proper syntax to remove those drop events?

                                5) Then say I want to alter this line to drop say half as many max fibers:
                                Code:
                                	<drop event="Destroy" name="resourceYuccaFibers" count="2,8"/>
                                So would this be a correct way to change that line??
                                Code:
                                <set xpath="/blocks/block[@name='cntBirdnest']/drop[@name='resourceYuccaFibers']/@count">2,4</set>
                                6) Finally lets say I want to append (add) in some lines to give a chance to drop some feathers (bird feathers often get stuck in nests and are even used when building them... actually lets go ahead and add back in a tiny chance for cloth or even paper to have been used as material for the nest...).

                                Would this code be proper?
                                Code:
                                <append xpath="/blocks/block[@name='cntBirdnest']" > 
                                	<drop event="Destroy" name="resourceFeather" count="0,6" prob="0.8"/>
                                	<drop event="Destroy" name="resourceCloth" count="0,1" prob="0.01"/>
                                	<drop event="Destroy" name="resourcePaper" count="0,1" prob="0.01"/>
                                </append>

                                Thanks for any help and / or pointers. I am really struggling with this for some reason. I've never been good with code / regex style strings and such... my brain just doesn't work that way. I much prefer plain text, but I understand the need for xpath and so I would like to understand how to compose it correctly so I cna make my own modlets / mods. Thank you

                                Comment

                                Working...
                                X