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

XPath Modding Explanation Thread

This is a large amount of information in these posts. I'll be working on a full, properly formed tutorial as we get access to A17 and we can really make the xpath system shine. I've listed some examples here, and we'll be posting a ton more xpath samples over the coming weeks, as we port the SDX modlets over to use the native hooks.

By all means, begin posting your comments, questions, or requests for clarity.

Since we now know that xpath support will be built-into the vanilla base game, and discussions earlier were getting a bit confusing, I've decided to make a new thread to try to demystify xpath and what it'll mean for mods and modders going forward in A17. The information in this thread has been pieced together from forum and discord discussions. They may not be 100% accurate, but I will update this thread when we know the full implementation.

XPath is a way of adding, changing, or removing XML lines and nodes, without directly editing the XML files. It allows you to apply patches to the XML files without manually editing the vanilla XML files.

SDX has had partial support for this since its initial release, and a lot of the SDX Modlets are already written this way. We will be using some of the SDX's xpath as examples in this thread, but SDX is not required to do this in A17 and onwards.

I believe in using examples to explain concept, so in the next few posts, you'll see a mixture of explanation, along with sample xpath code.

The following Mod structure is expected for A17 and beyond:

Code:
Mods/
   <ModName>/
       Config/
       UIAtlases/ItemIconAtlas/
       ModInfo.xml

   <ModName2>/
       Config/
       ModInfo.xml
You will be able to have multiple mods loaded, and loading will occur as long as the ModInfo.xml exists. This is unchanged from what we've been doing doing with other alphas, with the exception of the Config folder.

This Config folder will support loading XML files, written using xpath, in the following folder structure:

Code:
Config/entityclasses.xml
Config/gamestages.xml
Config/items.xml
The files in the Config folder will not be a full copy of the vanilla file with your changes. Rather, it'll contain the changes you want done to the vanilla files. The files under the Config must match the vanilla file name. You cannot create an entityclasses2.xml file, and expect it to work. Any changes in the entityclasses.xml will have to be done in the same file. However, each mod can have its own entityclasses.xml.

During the game's initialization, it will perform the xpath merge in-memory only; no files will be actually be modified. This would allow us to remove mods we no longer want, without re-validating against steam, or previous copies of the xml. That's a big one. No more half merging of a mod, and not having it work, then trying to pull it back out.

What this means for us is that we'll be able to make a variety of smaller mods, which I've been calling modlets, which can add, remove and change smaller pieces of the game. They can be used together, or they could be added to an overhaul mod, in order to style your game play easier.

These modlets would also exists outside of the Data/Config folder, so if you have made direct XML changes in your Alpha 17.1 Data/Config files, and Steam updated the game to 17.2, you would have lost your changes, or would have to re-merge them in. We've all been there before. But if they existed as modlets, under the Mods folder, they would be safe. And as long as your xpath is still valid to the new XML, it should load up with no additional work on your part.

If we could use xyth's JunkItems modlet, which adds random, scrappable junk items to loot containers, and add them to Valmod Overhaul. Likewise, if Valmod Overhaul did not have the No Ammo modlet (which gives you the ability to unload a gun and get its bullets back without disassembling it), you could drop the NoAmmo modlet into your Mods folder. Headshots only? Want to increase stack sizes? Same deal.

With a properly constructed modlet, we'll be able to piece together new play styles for people to enjoy and share. A modder working on a large overhaul won't have to duplicate work. If they wanted to include the No Ammo mod, they wouldn't have to code it themselves, letting them focus on the bits that make their mod really unique.

Let's get started on your journey...

 
Last edited by a moderator:
I meant to change at once every <item /> that contains such Material property inside itself.

So that when adding a mod for a gigantic number of weapons, this all overlaps when it goes next (and it wasn't necessary to add mini-fixes, due to which hundreds of "yellow errors" appear)
Ok, if I understand you correctly, you want to know how to check all items to see if the 'Material' is 'MMachineGunParts', then, if that check is true, change the item needed to repair it from 'RepairTools' to 'gunMGT1AK47Parts'.  Is that correct?

Even if I am not understanding you correctly, I do not know how the xml coding would work for that.  Sorry.  
What I would do as an easy fix, though perhaps not an optimal one, is make sure the code I gave you works for one item.  Then duplicate it for any weapon that you want to use AK47 Parts as the ingredient to repair it.  Again, it may not be the optimal way to do it, but it would at least get it done.

 
Ok, if I understand you correctly, you want to know how to check all items to see if the 'Material' is 'MMachineGunParts', then, if that check is true, change the item needed to repair it from 'RepairTools' to 'gunMGT1AK47Parts'.  Is that correct?

Even if I am not understanding you correctly, I do not know how the xml coding would work for that.  Sorry.  
What I would do as an easy fix, though perhaps not an optimal one, is make sure the code I gave you works for one item.  Then duplicate it for any weapon that you want to use AK47 Parts as the ingredient to repair it.  Again, it may not be the optimal way to do it, but it would at least get it done.
I came here precisely to find out whether it can be done or not.

Just example:

<!--rickyalph Guns-->
<set xpath="/items/item[@name='gunHandgunT1FN57']/property[@name='RepairTools']/@value">gunHandgunT1PistolParts</set>
<set xpath="/items/item[@name='gunHandgunT1FN57']/effect_group[@name='gunHandgunT1FN57']/passive_effect[@name='DegradationPerUse'][@operation='base_set']/@value">0.4</set>
<set xpath="/items/item[@name='gunHandgunT2M1911']/property[@name='RepairTools']/@value">gunHandgunT1PistolParts</set>
<set xpath="/items/item[@name='gunHandgunT2M1911']/effect_group[@name='gunHandgunT2M1911']/passive_effect[@name='DegradationPerUse'][@operation='base_set']/@value">0.4</set>
<set xpath="/items/item[@name='gunMGT2M4A1']/property[@name='RepairTools']/@value">gunMGT1AK47Parts</set>
<set xpath="/items/item[@name='gunMGT2M4A1']/effect_group[@name='gunMGT2M4A1']/passive_effect[@name='DegradationPerUse'][@operation='base_set']/@value">0.4</set>
<set xpath="/items/item[@name='gunRifleT3SCARH']/property[@name='RepairTools']/@value">gunRifleT1HuntingRifleParts</set>
<set xpath="/items/item[@name='gunRifleT3SCARH']/effect_group[@name='gunRifleT3SCARH']/passive_effect[@name='DegradationPerUse'][@operation='base_set']/@value">0.4</set>

<!--Sykriss VFX-->
<set xpath="/items/item[@name='gun1911']/property[@name='RepairTools']/@value">gunHandgunT1PistolParts</set>
<set xpath="/items/item[@name='gun1911']/effect_group[@name='gunPistol']/passive_effect[@name='DegradationPerUse'][@operation='base_set']/@value">0.4</set>
<set xpath="/items/item[@name='gun45revolver']/property[@name='RepairTools']/@value">gunHandgunT1PistolParts</set>
<set xpath="/items/item[@name='gun45revolver']/effect_group[@name='gun44Magnum']/passive_effect[@name='DegradationPerUse'][@operation='base_set']/@value">0.4</set>
<set xpath="/items/item[@name='gun556rifle']/property[@name='RepairTools']/@value">gunRifleT1HuntingRifleParts</set>
<set xpath="/items/item[@name='gun556rifle']/effect_group[@name='gunHuntingRifle']/passive_effect[@name='DegradationPerUse'][@operation='base_set']/@value">0.4</set>
<set xpath="/items/item[@name='gun9mmrevolver']/property[@name='RepairTools']/@value">gunHandgunT1PistolParts</set>
<set xpath="/items/item[@name='gun9mmrevolver']/effect_group[@name='gun44Magnum']/passive_effect[@name='DegradationPerUse'][@operation='base_set']/@value">0.4</set>
<set xpath="/items/item[@name='gun9mmrifle']/property[@name='RepairTools']/@value">gunRifleT1HuntingRifleParts</set>
<set xpath="/items/item[@name='gun9mmrifle']/effect_group[@name='gunHuntingRifle']/passive_effect[@name='DegradationPerUse'][@operation='base_set']/@value">0.4</set>
<set xpath="/items/item[@name='gunGlock17']/property[@name='RepairTools']/@value">gunHandgunT1PistolParts</set>
<set xpath="/items/item[@name='gunGlock17']/effect_group[@name='gunPistol']/passive_effect[@name='DegradationPerUse'][@operation='base_set']/@value">0.4</set>
<set xpath="/items/item[@name='gunak101']/property[@name='RepairTools']/@value">gunMGT1AK47Parts</set>
<set xpath="/items/item[@name='gunak101']/effect_group[@name='gunAK47']/passive_effect[@name='DegradationPerUse'][@operation='base_set']/@value">0.4</set>
<set xpath="/items/item[@name='gunaks74u']/property[@name='RepairTools']/@value">gunMGT1AK47Parts</set>
<set xpath="/items/item[@name='gunaks74u']/effect_group[@name='gunAK47']/passive_effect[@name='DegradationPerUse'][@operation='base_set']/@value">0.4</set>
<set xpath="/items/item[@name='gunar15']/property[@name='RepairTools']/@value">gunRifleT1HuntingRifleParts</set>
<set xpath="/items/item[@name='gunar15']/effect_group[@name='gunAK47']/passive_effect[@name='DegradationPerUse'][@operation='base_set']/@value">0.4</set>
<set xpath="/items/item[@name='gundeserteagle']/property[@name='RepairTools']/@value">gunHandgunT1PistolParts</set>
<set xpath="/items/item[@name='gundeserteagle']/effect_group[@name='gunPistol']/passive_effect[@name='DegradationPerUse'][@operation='base_set']/@value">0.4</set>
<set xpath="/items/item[@name='gundoublebarrelproper']/property[@name='RepairTools']/@value">gunShotgunT1DoubleBarrelParts</set>
<set xpath="/items/item[@name='gundoublebarrelproper']/effect_group[@name='gunDoubleBarrelShotgun']/passive_effect[@name='DegradationPerUse'][@operation='base_set']/@value">0.4</set>
<set xpath="/items/item[@name='gung36c']/property[@name='RepairTools']/@value">gunRifleT1HuntingRifleParts</set>
<set xpath="/items/item[@name='gung36c']/effect_group[@name='gunAK47']/passive_effect[@name='DegradationPerUse'][@operation='base_set']/@value">0.4</set>
<set xpath="/items/item[@name='gunhk416']/property[@name='RepairTools']/@value">gunRifleT1HuntingRifleParts</set>
<set xpath="/items/item[@name='gunhk416']/effect_group[@name='gunAK47']/passive_effect[@name='DegradationPerUse'][@operation='base_set']/@value">0.4</set>
<set xpath="/items/item[@name='gunm1pcarbine']/property[@name='RepairTools']/@value">gunHandgunT1PistolParts</set>
<set xpath="/items/item[@name='gunm1pcarbine']/effect_group[@name='gunAK47']/passive_effect[@name='DegradationPerUse'][@operation='base_set']/@value">0.4</set>
<set xpath="/items/item[@name='gunmac11']/property[@name='RepairTools']/@value">gunHandgunT1PistolParts</set>
<set xpath="/items/item[@name='gunmac11']/effect_group[@name='gunPistol']/passive_effect[@name='DegradationPerUse'][@operation='base_set']/@value">0.4</set>
<set xpath="/items/item[@name='gunmakarov']/property[@name='RepairTools']/@value">gunHandgunT1PistolParts</set>
<set xpath="/items/item[@name='gunmakarov']/effect_group[@name='gunPistol']/passive_effect[@name='DegradationPerUse'][@operation='base_set']/@value">0.4</set>
<set xpath="/items/item[@name='gunmicrouzi']/property[@name='RepairTools']/@value">gunHandgunT1PistolParts</set>
<set xpath="/items/item[@name='gunmicrouzi']/effect_group[@name='gunPistol']/passive_effect[@name='DegradationPerUse'][@operation='base_set']/@value">0.4</set>
<set xpath="/items/item[@name='gunmk23']/property[@name='RepairTools']/@value">gunHandgunT1PistolParts</set>
<set xpath="/items/item[@name='gunmk23']/effect_group[@name='gunPistol']/passive_effect[@name='DegradationPerUse'][@operation='base_set']/@value">0.4</set>
<set xpath="/items/item[@name='gunp250']/property[@name='RepairTools']/@value">gunHandgunT1PistolParts</set>
<set xpath="/items/item[@name='gunp250']/effect_group[@name='gunPistol']/passive_effect[@name='DegradationPerUse'][@operation='base_set']/@value">0.4</set>
<set xpath="/items/item[@name='gunp99']/property[@name='RepairTools']/@value">gunHandgunT1PistolParts</set>
<set xpath="/items/item[@name='gunp99']/effect_group[@name='gunPistol']/passive_effect[@name='DegradationPerUse'][@operation='base_set']/@value">0.4</set>
<set xpath="/items/item[@name='gunpp19']/property[@name='RepairTools']/@value">gunMGT1AK47Parts</set>
<set xpath="/items/item[@name='gunpp19']/effect_group[@name='gunSMG5']/passive_effect[@name='DegradationPerUse'][@operation='base_set']/@value">0.4</set>
<set xpath="/items/item[@name='gunrsx1']/property[@name='RepairTools']/@value">gunShotgunT1DoubleBarrelParts</set>
<set xpath="/items/item[@name='gunrsx1']/effect_group[@name='gunPumpShotgun']/passive_effect[@name='DegradationPerUse'][@operation='base_set']/@value">0.4</set>
<set xpath="/items/item[@name='gunscarh']/property[@name='RepairTools']/@value">gunMGT1AK47Parts</set>
<set xpath="/items/item[@name='gunscarh']/effect_group[@name='gunAK47']/passive_effect[@name='DegradationPerUse'][@operation='base_set']/@value">0.4</set>
<set xpath="/items/item[@name='gunscarl']/property[@name='RepairTools']/@value">gunRifleT1HuntingRifleParts</set>
<set xpath="/items/item[@name='gunscarl']/effect_group[@name='gunAK47']/passive_effect[@name='DegradationPerUse'][@operation='base_set']/@value">0.4</set>
<set xpath="/items/item[@name='gunsg553']/property[@name='RepairTools']/@value">gunRifleT1HuntingRifleParts</set>
<set xpath="/items/item[@name='gunsg553']/effect_group[@name='gunAK47']/passive_effect[@name='DegradationPerUse'][@operation='base_set']/@value">0.4</set>
<set xpath="/items/item[@name='gunsinglebarrelshotgun']/property[@name='RepairTools']/@value">gunShotgunT1DoubleBarrelParts</set>
<set xpath="/items/item[@name='gunsinglebarrelshotgun']/effect_group[@name='gunDoubleBarrelShotgun']/passive_effect[@name='DegradationPerUse'][@operation='base_set']/@value">0.4</set>
<set xpath="/items/item[@name='gunskorpion']/property[@name='RepairTools']/@value">gunHandgunT1PistolParts</set>
<set xpath="/items/item[@name='gunskorpion']/effect_group[@name='gunPistol']/passive_effect[@name='DegradationPerUse'][@operation='base_set']/@value">0.4</set>
<set xpath="/items/item[@name='gunsks']/property[@name='RepairTools']/@value">gunMGT1AK47Parts</set>
<set xpath="/items/item[@name='gunsks']/effect_group[@name='gunAK47']/passive_effect[@name='DegradationPerUse'][@operation='base_set']/@value">0.4</set>
<set xpath="/items/item[@name='gunsvd']/property[@name='RepairTools']/@value">gunRifleT1HuntingRifleParts</set>
<set xpath="/items/item[@name='gunsvd']/effect_group[@name='gunAK47']/passive_effect[@name='DegradationPerUse'][@operation='base_set']/@value">0.4</set>
<set xpath="/items/item[@name='guntec9']/property[@name='RepairTools']/@value">gunHandgunT1PistolParts</set>
<set xpath="/items/item[@name='guntec9']/effect_group[@name='gunPistol']/passive_effect[@name='DegradationPerUse'][@operation='base_set']/@value">0.4</set>
<set xpath="/items/item[@name='guntoz34']/property[@name='RepairTools']/@value">gunShotgunT1DoubleBarrelParts</set>
<set xpath="/items/item[@name='guntoz34']/effect_group[@name='gunDoubleBarrelShotgun']/passive_effect[@name='DegradationPerUse'][@operation='base_set']/@value">0.4</set>
<set xpath="/items/item[@name='gunump45']/property[@name='RepairTools']/@value">gunHandgunT1PistolParts</set>
<set xpath="/items/item[@name='gunump45']/effect_group[@name='gunSMG5']/passive_effect[@name='DegradationPerUse'][@operation='base_set']/@value">0.4</set>
<set xpath="/items/item[@name='gunusp']/property[@name='RepairTools']/@value">gunHandgunT1PistolParts</set>
<set xpath="/items/item[@name='gunusp']/effect_group[@name='gunPistol']/passive_effect[@name='DegradationPerUse'][@operation='base_set']/@value">0.4</set>


Edited: I understood how. Need to change names to apply something like

Code:
<set xpath="//item[contains(@name,'gunHandgunT') or contains(@name,'gunShotgunT') or contains(@name,'gunRifleT') or contains(@name,'gunMGT') and not(contains(@name,'gunShotgunT0'))]/effect_group/passive_effect[@name='DegradationPerUse'][@operation='base_set']/@value">0.4</set>
<set xpath="//item[contains(@name,'gunExplosivesT') or contains(@name,'gunBowT') and not(contains(@name,'gunBowT0'))]/effect_group/passive_effect[@name='DegradationPerUse'][@operation='base_set']/@value">0.4</set>
<set xpath="//item[@name='meleeWpnClubT3SteelClub' or @name='meleeWpnSledgeT3SteelSledgehammer']/effect_group/passive_effect[@name='DegradationPerUse'][@operation='base_set']/@value">0.4</set>
<set xpath="//item[@name='meleeToolPickT3Auger' or @name='meleeToolAxeT3Chainsaw' or @name='meleeToolSalvageT3ImpactDriver']/effect_group/passive_effect[@name='DegradationPerUse'][@operation='base_set']/@value">0.3</set>
 
Last edited by a moderator:
i'm working on a gameplay series that has no traders on the map, but i would still like to do the challenges that i find in loot.

i have tried the following 2 lines of code, and they both do not seem to work
 

<remove xpath="/quests/quest[contains(@id, 'challenge')]/property[@name='completiontype']" />
<remove xpath="/quests/quest[contains(@id, 'challenge')]/objective[@type='InteractWithNPC']" />




using the following challenge as an example:

the property of "completiontype" value= "TurnIn" i was going to use <set xpath> but there is no other completion type for me to set it to. the basic survival quest (which is completed without having to turn in or return to trader) does not have a completion type. does anyone know how i can achieve this?

Code:
<quest id="challenge_silenceofthelambs">
        <property name="name_key" value="challenge_silenceofthelambs"/>
        <property name="subtitle_key" value="challenge_silenceofthelambs_subtitle"/>
        <property name="description_key" value="challenge_silenceofthelambs_offer"/>
        <property name="icon" value="ui_game_symbol_zombie"/>
        <property name="repeatable" value="true"/>
        <property name="category_key" value="challenge"/>
        <property name="offer_key" value="challenge_silenceofthelambs_offer"/>
        <property name="difficulty" value="insane"/>
        <property name="completiontype" value="TurnIn"/>

        <objective type="RandomGoto" value="500-800" phase="1">
            <property name="completion_distance" value="50"/>
            <property name="nav_object" value="quest" />
        </objective>

        <objective type="RallyPoint">
            <property name="start_mode" value="Create"/>
            <property name="phase" value="2"/>
            <property name="nav_object" value="rally" />
        </objective>

        <action type="SpawnEnemy" id="zombieScreamer" value="2" phase="3"/>
        <objective type="ZombieKill" id="zombieScreamer" value="2" phase="3"/>

        <objective type="InteractWithNPC">
            <property name="phase" value="4"/>
        </objective>

        <reward type="Exp" value="500"/>
        <!-- You can define a range of rewards like <reward type="Item" id="casinoCoin" value="200-500"/> -->
        <reward type="Item" id="casinoCoin" value="350"/>
    </quest>
 
i'm working on a gameplay series that has no traders on the map, but i would still like to do the challenges that i find in loot.

i have tried the following 2 lines of code, and they both do not seem to work
 

<remove xpath="/quests/quest[contains(@id, 'challenge')]/property[@name='completiontype']" />
<remove xpath="/quests/quest[contains(@id, 'challenge')]/objective[@type='InteractWithNPC']" />




using the following challenge as an example:

the property of "completiontype" value= "TurnIn" i was going to use <set xpath> but there is no other completion type for me to set it to. the basic survival quest (which is completed without having to turn in or return to trader) does not have a completion type. does anyone know how i can achieve this?

<quest id="challenge_silenceofthelambs">
        <property name="name_key" value="challenge_silenceofthelambs"/>
        <property name="subtitle_key" value="challenge_silenceofthelambs_subtitle"/>
        <property name="description_key" value="challenge_silenceofthelambs_offer"/>
        <property name="icon" value="ui_game_symbol_zombie"/>
        <property name="repeatable" value="true"/>
        <property name="category_key" value="challenge"/>
        <property name="offer_key" value="challenge_silenceofthelambs_offer"/>
        <property name="difficulty" value="insane"/>
        <property name="completiontype" value="TurnIn"/>

        <objective type="RandomGoto" value="500-800" phase="1">
            <property name="completion_distance" value="50"/>
            <property name="nav_object" value="quest" />
        </objective>

        <objective type="RallyPoint">
            <property name="start_mode" value="Create"/>
            <property name="phase" value="2"/>
            <property name="nav_object" value="rally" />
        </objective>

        <action type="SpawnEnemy" id="zombieScreamer" value="2" phase="3"/>
        <objective type="ZombieKill" id="zombieScreamer" value="2" phase="3"/>

        <objective type="InteractWithNPC">
            <property name="phase" value="4"/>
        </objective>

        <reward type="Exp" value="500"/>
        <!-- You can define a range of rewards like <reward type="Item" id="casinoCoin" value="200-500"/> -->
        <reward type="Item" id="casinoCoin" value="350"/>
    </quest>

I would try removing the completion type from the quest and then load up the game.  Worst case scenario, it errors out and you need a different idea.  Best case scenario, it doesn't give you an error and it works.  I guess the actual worst case scenario might be that you get no error, use creative mode to get the quest, do said quest, and get nothing for your efforts.  What I like to do is to have a "Test" game save that I hop into and out of as I make changes to my mods to see if they are working, and more importantly, working as I expected them to.  

Hopefully though, just removing that will do the trick.  Though you may need to remove that from all of the challenge quests, I honestly don't have a clue how to use the "contains" parameter in XML yet.  I'm pretty new to this myself.

 
I would try removing the completion type from the quest and then load up the game.  Worst case scenario, it errors out and you need a different idea.  Best case scenario, it doesn't give you an error and it works.  I guess the actual worst case scenario might be that you get no error, use creative mode to get the quest, do said quest, and get nothing for your efforts.  What I like to do is to have a "Test" game save that I hop into and out of as I make changes to my mods to see if they are working, and more importantly, working as I expected them to.  

Hopefully though, just removing that will do the trick.  Though you may need to remove that from all of the challenge quests, I honestly don't have a clue how to use the "contains" parameter in XML yet.  I'm pretty new to this myself.
i did. i get no error and the quest says "return to trader" after i kill the zombies that are spawned.

this is the code i used.. so let me know if the code is wrong

 

Code:
[COLOR=#e8bd89]<remove[/COLOR][COLOR=#ebe7e3] [/COLOR][COLOR=#df897a]xpath[/COLOR][COLOR=#d9b180]=[/COLOR][COLOR=#7ea9c4]"/quests/quest[contains(@id, 'challenge')]/property[@name='completiontype']"[/COLOR][COLOR=#ebe7e3] [/COLOR][COLOR=#e8bd89]/>[/COLOR]
 
But I still don't understand, is it possible to change yellowish to violet if reddish is bluish?

<item name="gunMGT1AK47">
.....
    <property name="Material" value="MMachineGunParts"/>

    <property name="RepairTools" value="resourceRepairKit"/>
.......

</item>
As example, I wanna replace:

<property name="RepairTools" value="resourceRepairKit"/>
to:

<property name="RepairTools" value="gunMGT1AK47Parts"/>
ONLY if items contains:

<property name="Material" value="MMachineGunParts"/>
And so for each item!

 
Last edited by a moderator:
CrazyAluminum said:
Is it possible to change


<property name="RepairTools" value="resourceRepairKit"/>


with one line to 

<property name="RepairTools" value="gunMGT1AK47Parts"/>


if

<property name="Material" value="MMachineGunParts"/>


?


It's possible to do this with XPath generally, but I don't know if it's supported in the version of XPath used by 7D2D. You could try it and find out.

The key is to not think of it as targeting a property node with a sibling property node, whose name and value match. Instead, target the property whose parent item has a child property node, whose name and value match. (It's also more intuitive - you're changing something about a "kind of item.")

Here's the XML to do this:

Code:
<set xpath="/items/item[/property[@name='Materials' and @value='MMachineGunParts']]/property[@name='RepairTools']/@value">gunMGT1AK47Parts</set>
 
Last edited by a moderator:
I'm looking to make a modlet that gives vehicles a speed boost for using the roadways around the map. I'm having a real difficult time though trying to figure out where this should be implemented. As a block property, some sort of buff, or something modifying in the vehicle xml itself. Just need a pointer to get the ball rolling, the roads need some love.

 
Hi friends. I'm trying to use a conditional to set the value of "SpreadMultiplierAiming" (which is nested within an effect_group) to 0 for all guns.

I've tried a couple variations of this:

<set xpath="/items/item[contains(@name, 'gun')]/effect_group/passive_effect[contains(@name, 'SpreadMultiplierAiming')]/@value">0</set>


But none work.

Can I use a conditional statement to navigate into an effect_group like this? Or am I way off?

 
Hello all,

i just want to create a server side only mod where I would also like to change the models for certain blocks.
Example: I want to create a block that has the forge as a base but should look like a concrete block.
Is that possible?

I also wonder if it is possible to paint this new block or to determine a texture from the known paintings. For example, with a red cross for medicine.
Is that possible?

I also wonder if I can combine several blocks for one block. By this I mean, for example, to put a lamp or candle on this concrete block.
Is that possible?

Finally, where can I find an overview of all the models that are available? There are already some xpaths in this article but I am almost sure that there are more. Is there a link or something?

Looking forward to your answers

 
dwarfmaster1974 said:
i just want to create a server side only mod where I would also like to change the models for certain blocks.
Example: I want to create a block that has the forge as a base but should look like a concrete block.
Is that possible?
Do you mean a forge that looks like a concrete block in simple terms? Yes, this is possible.

I also wonder if it is possible to paint this new block or to determine a texture from the known paintings. For example, with a red cross for medicine.
Is that possible?


Can this new concrete forge block be painted? Yes

 

I also wonder if I can combine several blocks for one block. By this I mean, for example, to put a lamp or candle on this concrete block.
Is that possible?
Do you mean that the block has the appearance of a concrete block with a candle on top of it - but is actually only 1 block?
Yes, this is possible, but not as simple as changing codes around. You would need to create a block in a program like Unity with this appearance then export it as a unity3d file.
Then link to this model in the xml and change the MultiBlockDim value to "1,2,1".

Finally, where can I find an overview of all the models that are available? There are already some xpaths in this article but I am almost sure that there are more. Is there a link or something?
I haven't read all of this article but a good starting point is to browse through the ItemIconAtlas folder

 
Hi @Vincenzo,

Thanks for your answer!

Of course, it would be great if I knew what that would look like:

Do you mean a forge that looks like a concrete block in simple terms? Yes, this is possible.
A small example would be super helpful.

Can this new concrete forge block be painted? Yes
Again, a small example would really help me.🙂

Do you mean that the block has the appearance of a concrete block with a candle on top of it - but is actually only 1 block?
No. Only one block of cement and one block on top of it. Dimension can then be 1,2,1. But I don't want to create any new unitity models, because I want to run the server in question without an additional mod installation.

 I haven't read all of this article but a good starting point is to browse through the ItemIconAtlas folder.
Do you mean the folder that contains PNG files that represent the images of the individual items and blocks? Or are you talking about a different directory.

I am looking forward to your answer

 
Hi All - 

This part as been stumping me for a bit. I thought I had it, but then it turns out I had been fooling myself and I really had just been removing the attribute itself and not the values of the attribute, which is what i'm after. 

Here's a bit of what I'm wanting to do.

@ lvl 1 in skill in GreaseMonkey, everyone has the ability to create wheels, bike chassis, and bike handlebars. 
@ lvl 2 in skill, this expands to everyone can now create a bar battery, make gas, and engineer a minibike chassis and minibike handlebars.  

(and so on and so forth).

For this exercise, what I wanted to do was say... yaaaaah. NO,  INSTEAD, all you can do is find the chassis/handlebars for the minibike in loot or on vendors to purchase. The schematic to learn how to make the chassis and handlebars doesn't even exist.... and oh yeah - you have to be skill lvl 1 to even understand how to assemble a minibike now. So unskilled players can no longer just luck into finding all the parts in the world and just make a minibike out of their magic backpacks.

This is the code I had been playing with, with some success, but of course, there's things I'm just not getting as to why it's not exactly working. 

 

progression.xml
<TEST>
<removeattribute xpath="/progression/perks/perk[@name='perkGreaseMonkey']/effect_group/passive_effect[@level='1,5']/@tags">,vehicleBicycleChassis</removeattribute>
<append xpath="/progression/perks/perk[@name='perkGreaseMonkey']/effect_group/passive_effect[@level='1,5']/@tags">,vehicleBicyclePlaceable</append>
<removeattribute xpath="/progression/perks/perk[@name='perkGreaseMonkey']/effect_group/passive_effect[@level='2,5']/@tags">vehicleMinibikeChassis,vehicleMinibikeHandlebars</removeattribute>
<append xpath="/progression/perks/perk[@name='perkGreaseMonkey']/effect_group/passive_effect[@level='2,5']/@tags">,vehicleMinibikePlaceable</append>
</TEST>

loot.xml snip
<TEST>
<removeattribute xpath="/lootcontainers/lootgroup[@name='schematicsVehiclesT1']/[@item='vehicleMinibikeChassisSchematic']"></removeattribute>
<removeattribute xpath="/lootcontainers/lootgroup[@name='schematicsVehiclesT1']/[@item='vehicleMinibikeHandlebarsSchematic']"></removeattribute>
</TEST>

items.xml snip
<TEST>
<remove xpath="/items/item[@name='vehicleMinibikeChassisSchematic']"/>
<remove xpath="/items/item[@name='vehicleMinibikeHandlebarsSchematic']"/>
</TEST>

traders.xml
<TEST>
<removeattribute xpath="/traders/trader_item_groups/trader_item_group[@name='schematicsVehiclesCommon']/[@item='vehicleMinibikeChassisSchematic']"/>
<removeattribute xpath="/traders/trader_item_groups/trader_item_group[@name='schematicsVehiclesCommon']/[@item='vehicleMinibikeHandlebarsSchematic']"/>
</TEST>



So yeah. Lots of failing code comes out of this of course. I've tried variations on a lot of different moving parts. I started by just trying to focus on one file (of course), and only get the one thing working. 

 

This by the way is litterally all it's doing to the progression.xml file
<perk name="perkGreaseMonkey" parent="skillIntellectCraftsmanship" name_key="perkGreaseMonkeyName" desc_key="perkGreaseMonkeyDesc" icon="ui_game_symbol_service">
<level_requirements level="1"><requirement name="ProgressionLevel" progression_name="attIntellect" operation="GTE" value="2" desc_key="reqIntellectLevel02" /></level_requirements>
<level_requirements level="2"><requirement name="ProgressionLevel" progression_name="attIntellect" operation="GTE" value="4" desc_key="reqIntellectLevel04" /></level_requirements>
<level_requirements level="3"><requirement name="ProgressionLevel" progression_name="attIntellect" operation="GTE" value="6" desc_key="reqIntellectLevel06" /></level_requirements>
<level_requirements level="4"><requirement name="ProgressionLevel" progression_name="attIntellect" operation="GTE" value="8" desc_key="reqIntellectLevel08" /></level_requirements>
<level_requirements level="5"><requirement name="ProgressionLevel" progression_name="attIntellect" operation="GTE" value="10" desc_key="reqIntellectLevel10" /></level_requirements>

<effect_group>
<passive_effect name="CraftingTier" operation="base_set" level="0,5" value="0,5" tags="perkGreaseMonkey" /><!-- fake crafting perk that is used to scale resources or quality like on carBattery -->

<passive_effect name="RecipeTagUnlocked" operation="base_set" level="1,5" value="1"><!--Attribute "tags" removed by: "TEST-MOD"--></passive_effect>
<passive_effect name="RecipeTagUnlocked" operation="base_set" level="2,5" value="1"><!--Attribute "tags" removed by: "TEST-MOD"--></passive_effect>
<passive_effect name="RecipeTagUnlocked" operation="base_set" level="3,5" value="1" tags="resourceOil,vehicleMotorcycleChassis,vehicleMotorcycleHandlebars" />
<passive_effect name="RecipeTagUnlocked" operation="base_set" level="4,5" value="1" tags="ammoGasCanBundle,vehicle4x4TruckChassis,vehicle4x4TruckAccessories" />
<passive_effect name="RecipeTagUnlocked" operation="base_set" level="5" value="1" tags="vehicleGyroCopterChassis,vehicleGyroCopterAccessories" />

<effect_description level="1" desc_key="perkGreaseMonkeyRank1Desc" long_desc_key="perkGreaseMonkeyRank1LongDesc" />
<effect_description level="2" desc_key="perkGreaseMonkeyRank2Desc" long_desc_key="perkGreaseMonkeyRank2LongDesc" />
<effect_description level="3" desc_key="perkGreaseMonkeyRank3Desc" long_desc_key="perkGreaseMonkeyRank3LongDesc" />
<effect_description level="4" desc_key="perkGreaseMonkeyRank4Desc" long_desc_key="perkGreaseMonkeyRank4LongDesc" />
<effect_description level="5" desc_key="perkGreaseMonkeyRank5Desc" long_desc_key="perkGreaseMonkeyRank5LongDesc" />
</effect_group>
</perk>






So clearly - it's not doing the equivalent of a "replace" function, which is probably all I'd really need.  I could probably do this all with a set, where I just set the effects to a start point I want, and then use append to add in the recipes to them, so that the tags attribute doesn't get removed....

OH ok.. all this typing I might have just got it out loud. It's cause it's removing the TAG attribute that the entire set of values is going poof and it can't append the placeable minibike.

So what's the correct way to do it? Just using <remove xpath="/.... etc... "  ????
Would this also explain why it's not being removed from the traders.xml or the loot.xml?

 
Hi All - 

This part as been stumping me for a bit. I thought I had it, but then it turns out I had been fooling myself and I really had just been removing the attribute itself and not the values of the attribute, which is what i'm after. 

Here's a bit of what I'm wanting to do.

@ lvl 1 in skill in GreaseMonkey, everyone has the ability to create wheels, bike chassis, and bike handlebars. 
@ lvl 2 in skill, this expands to everyone can now create a bar battery, make gas, and engineer a minibike chassis and minibike handlebars.  

(and so on and so forth).

For this exercise, what I wanted to do was say... yaaaaah. NO,  INSTEAD, all you can do is find the chassis/handlebars for the minibike in loot or on vendors to purchase. The schematic to learn how to make the chassis and handlebars doesn't even exist.... and oh yeah - you have to be skill lvl 1 to even understand how to assemble a minibike now. So unskilled players can no longer just luck into finding all the parts in the world and just make a minibike out of their magic backpacks.

This is the code I had been playing with, with some success, but of course, there's things I'm just not getting as to why it's not exactly working. 

So what's the correct way to do it? Just using <remove xpath="/.... etc... "  ????
Would this also explain why it's not being removed from the traders.xml or the loot.xml?
Did anyone answer your question?

One thing I noticed (and I am new to this so I just learned myself) is progression file.  You might want to do to the following instead

<set xpath="/progression/perks/perk[@name='perkGreaseMonkey']/effect_group/passive_effect[@name='RecipeTagUnlocked'][@tags='carBattery,ammoGasCan,vehicleMinibikeChassis,vehicleMinibikeHandlebars']/@tags">carBattery</set>




That changes what can be unlocked via perk points.  So now if someone buys that perk, the only recipe they unlock is car batteries.  Leave the tags in so you can reference them later on.

To set requirement on level, I think you need to do it in the recipes file and add the level requirement (not sure on this).

        <level_requirements level="2"><requirement name="ProgressionLevel" progression_name="attPerception" operation="GTE" value="3" desc_key="reqPerceptionLevel03"/></level_requirements>




This is from the procession file and sets a level requirement to unlock specific perks.  Progression name might be changed to the perk name and value is the level of the perk (so 2 for minibikes).  This is all theory in my head as I haven't tried the set level to craft

 
Hey i try to give a few guns other ammo with the xpath

not sure if this is the right setup

<set xpath="items/item[@name='gunRifleT3SniperRifle']/property[@name='Magazine_items' and @value='ammo762mmBulletBall,ammo762mmBulletHP,ammo762mmBulletAP']/@value">,50 Caliber Ammo</set>




will this work or is there some kind of error ? :D

 
Hey i try to give a few guns other ammo with the xpath

not sure if this is the right setup

<set xpath="items/item[@name='gunRifleT3SniperRifle']/property[@name='Magazine_items' and @value='ammo762mmBulletBall,ammo762mmBulletHP,ammo762mmBulletAP']/@value">,50 Caliber Ammo</set>




will this work or is there some kind of error ? :D
Should have a slash in front (before items).  You also should have /property[@class="Action0'] between item[@name] and property[@name='Magazine_items'

Also, are you trying to replace the ammo with 50 cal or add it as an option?

If replacing, remove the comma

If adding, you should use append instead of set.

Another point, the spaces in your item could cause issues (50 Caliber Ammo).  Best thing to do is to id the ammo as ammo50Caliber (order not critical but eliminate the spaces in the ID).

This is how I would do it

Code:
<set xpath="/items/item[@name='gunRifleT3SniperRifle']/property[@class='Action0']/property[@name='Magazine_items']/@value">ammo50Cal</set>
 
Last edited by a moderator:
Back
Top