Jump to content
sphereii

XPath Modding Explanation Thread

Recommended Posts

I love modlets, because you don't have to overwrite the vanilla files. But I can't use these modlets in my own mod with the mod launcher because the launcher replaces all vanilla files in Data/Config with the modlet xml files inside the mod folder. That's weird. Is there any solution?

Share this post


Link to post
Share on other sites
I love modlets, because you don't have to overwrite the vanilla files. But I can't use these modlets in my own mod with the mod launcher because the launcher replaces all vanilla files in Data/Config with the modlet xml files inside the mod folder. That's weird. Is there any solution?

 

The Mod Launcher isn't ready yet for modlets, but support is coming. Right now I'm just watching to see how people are setting things up.

 

If you create a folder called "Mods", then place all the modlets in there, the launcher should copy the Mods folder in the correct place.

 

TempMods/Mods/<modname>

Share this post


Link to post
Share on other sites

can someone tell me why this doesnt work

im not getting any errors but it is not lowering the volume of the chainsaw

<configs>
<set xpath="/Sounds/SoundDataNode[@name='chainsaw_fire_start']/Noise/@volume">3</set>
<set xpath="/Sounds/SoundDataNode[@name='chainsaw_fire_rev']/Noise/@volume">3</set>
</configs>

Share this post


Link to post
Share on other sites

never mind

seems you cant edit the volume of sounds through the xml

that setting only changes the volume that the zeds hear not what comes out of the speakers

damn I need to lower that volume

Share this post


Link to post
Share on other sites
ok, didn't see it, so.... where do you find the item ID number? items.xml says it's generated internally on loading the game.

 

IDs in the items.xml and blocks.xml aren't a thing anymore. We can have about 32,000 unique items and 32,000 unique blocks now. Be sure your block name is unique.

Share this post


Link to post
Share on other sites
IDs in the items.xml and blocks.xml aren't a thing anymore. We can have about 32,000 unique items and 32,000 unique blocks now. Be sure your block name is unique.

 

I was basing the question on your code snippets at the start.

 

I want to modify the damage for some weapons and ammo, and I *think* I can do that without item id.

(I know there were there in 16, but noticed nope, can't find'em and saw the line at the bottom of the file)

 

Oh well, if it asplodes, then back to the drawing board. :)

 

thanks.

Share this post


Link to post
Share on other sites
I was basing the question on your code snippets at the start.

 

I want to modify the damage for some weapons and ammo, and I *think* I can do that without item id.

(I know there were there in 16, but noticed nope, can't find'em and saw the line at the bottom of the file)

 

Oh well, if it asplodes, then back to the drawing board. :)

 

thanks.

 

If you show us an example, we can help get you started

Share this post


Link to post
Share on other sites

Here's a question:

 

<recipe name="foodGrilledMeat" count="1" craft_area="campfire" craft_tool="toolCookingGrill" tags="learnable">
<ingredient name="foodRawMeat" count="5"/>
</recipe>

I only want to remove

 

tags="learnable"

Is it possible? If I set it to "0" it still unlocks the recipe, but... Maybe there are cases where I can't do that. And it's kinda ugly.

 

Of course I looked for a solution already, but didn't find anything.

Share this post


Link to post
Share on other sites

Could someone help me add infinite bullets

all weapons by XPath "modlet": 02,47-tranquilidade:

gunPistol

* gunSMG5

*gun44Magnum

*gunPumpShotgun

*gunHuntingRifle

*gunAK47

*gunCrossbow

 

Would have like?:upset:

Share this post


Link to post
Share on other sites
Here's a question:

 

<recipe name="foodGrilledMeat" count="1" craft_area="campfire" craft_tool="toolCookingGrill" tags="learnable">
<ingredient name="foodRawMeat" count="5"/>
</recipe>

I only want to remove

 

tags="learnable"

Is it possible? If I set it to "0" it still unlocks the recipe, but... Maybe there are cases where I can't do that. And it's kinda ugly.

 

Of course I looked for a solution already, but didn't find anything.

 

I've never tried; have you tried <remove xpath="/recipes/recipe[@name=foodGrilledMeat]/@tags" /> ?

Share this post


Link to post
Share on other sites
Could someone help me add infinite bullets

all weapons by XPath "modlet": 02,47-tranquilidade:

gunPistol

* gunSMG5

*gun44Magnum

*gunPumpShotgun

*gunHuntingRifle

*gunAK47

*gunCrossbow

 

Would have like?:upset:

 

<append xpath="/recipes/recipe[@name='gunSMG5']/property[@class='Action1']" >
      <property name="Infinite_ammo" value="true" />
</append>

 

It'd look like that, for each gun you want.

Share this post


Link to post
Share on other sites

<item name="gunMR10">

<effect_group name="Base Effects">

<passive_effect name="EntityDamage" operation="perc_add" value="8.0"/>

 

8 is what I changed it to in items,

 

edit:

 

<set xpath="/items/item[@name=MR10]/effect_group[@name=Base Effects]/passive_effect[@name=EntityDamage][@operation=perc_add]/@value">.25,8.0</set>

 

I think that would do it (copied format from another thread)

Edited by canadianbluebeer (see edit history)

Share this post


Link to post
Share on other sites
No sorry, there's no math operation in the current xpath system. xpath is just a method of finding stuff in the XML. The game uses the xpath to make the appropriate changes.

 

I kinda figured but wanted to double check. Haven't used XPATH yet (I'm WAY behind the times in languages) so I'm getting the hang of it. Guess I have a lot of copy/pasting to do. Thanks!

Share this post


Link to post
Share on other sites

@sphereii - I don't recall seeing a possible answer to something I have been wondering with the Mods & Modlet system.

 

Question is Localization files. If we are adding in new blocks and items (I have about 4000+ to be added in now), How do we handle the Localization.txt and Quest files? Do we just add them to our Mods in the Configs folder? Or is there a way to Amend them using this new style?

 

I am sure I cannot be the only one who is wondering this. Being most of this stuff can be pushed via the dedicated server. I know some stuff will require client side downloads if we have additional Icons or Resource files. I know with SDX it would just amend to them and that was awesome! However with this new method I do like it more BUT with some of the SDX Mods I loved that altered the DLL because of scripts and what not (like changing the BloodMoonNight scripts to a different day then every 7).

 

How do we handle that kind of stuff now?

 

Thanks this was just driving me crazy lol

Share this post


Link to post
Share on other sites
@sphereii - I don't recall seeing a possible answer to something I have been wondering with the Mods & Modlet system.

 

Question is Localization files. If we are adding in new blocks and items (I have about 4000+ to be added in now), How do we handle the Localization.txt and Quest files? Do we just add them to our Mods in the Configs folder? Or is there a way to Amend them using this new style?

 

I am sure I cannot be the only one who is wondering this. Being most of this stuff can be pushed via the dedicated server. I know some stuff will require client side downloads if we have additional Icons or Resource files. I know with SDX it would just amend to them and that was awesome! However with this new method I do like it more BUT with some of the SDX Mods I loved that altered the DLL because of scripts and what not (like changing the BloodMoonNight scripts to a different day then every 7).

 

How do we handle that kind of stuff now?

 

Thanks this was just driving me crazy lol

 

Localization isn't supported yet, but I think it's coming something in A17.* or A18. So we'll have an awkward period where we don't have a lot of flexibility with it.

 

Only the XML files from the Mods folder get pushed from the dedicated (localization doesn't either).

 

As for SDX, it will work along side with the Mods. You will still neet client side installs for any SDX mods, any mods that contain asset bundles, or custom icons. SDX can compile Scripts and PatchScripts into the DLL, and it also can handle the Localization merges, like it always has.

 

From a player perspective, they'll install the mods like they normally do: Copying a zip file with all the files in the right place.

 

xpath and modlets are an easier way for modders to create small patches and portable mods for others to enjoy that is also less maintenance for them.

Share this post


Link to post
Share on other sites

ok, I am starting with stack sizes to learn. can someone break this down for me

 

this is just for feathers

<set xpath="/items/item[@name=resourceFeather]/property[@name=Stacknumber' and @value='5000]</set>

is this correct? to get a stack size of 5000

 

 

<set xpath="/items/item/property[@name=Stacknumber' and @value='500]/@value">512</set>

 

what is the @512 for?

Share this post


Link to post
Share on other sites
Will there be a " X path" Mod Launcher?

 

Yes, a solution will be shown soon on how we can deal with modlets. Right now the modlets are a bit of a mess for distribution, but it's experimental, so it hasn't be a huge concern of mine.

 

However, a github/gitlab based solution, like we do with mods, will have hooks into this "modlet" launcher.

Share this post


Link to post
Share on other sites
Yes, a solution will be shown soon on how we can deal with modlets. Right now the modlets are a bit of a mess for distribution, but it's experimental, so it hasn't be a huge concern of mine.

 

However, a github/gitlab based solution, like we do with mods, will have hooks into this "modlet" launcher.

 

I <3 you

Share this post


Link to post
Share on other sites
<effect_group>

<triggered_effect trigger="onSelfAttackedOther" action="ModifyCVar" target="other" cvar="KillStreakTargetCounter" operation="add" value="1"/>

<triggered_effect trigger="onSelfAttackedOther" action="AddBuff" target="self" buff="buffPerkKillStreakCleanup"/>

</effect_group>

 

<effect_group>

<requirement name="HoldingItemHasTags" tags="perkDeadEye"/>

<passive_effect name="WeaponHandling" operation="perc_add" value="0.1,0.5" level="1,5"/>

<passive_effect name="ReloadSpeedMultiplier" operation="perc_add" value="0.1" level="1"/>

<passive_effect name="ReloadSpeedMultiplier" operation="perc_add" value="0.1,0.3" level="2,5"/>

 

Does anyone know how to add to the second effect group in this instance. Its the Deadeye perk, want to append lines after passive_effect name="ReloadSpeedMultiplier" but theres two Effect Groups and neither are named.

Share this post


Link to post
Share on other sites
Does anyone know how to add to the second effect group in this instance. Its the Deadeye perk, want to append lines after passive_effect name="ReloadSpeedMultiplier" but theres two Effect Groups and neither are named.

 

If you have multiple nodes, that do not have anything unique about them, you can use their element

 

Something like //effect_group/passive_effect[3]. which will change the third entry. It can be a bit risky, since any kind of change in nodes would break the mod, but if you don't have anything else unique about it, you can use it.

Share this post


Link to post
Share on other sites
If you have multiple nodes, that do not have anything unique about them, you can use their element

 

Something like //effect_group/passive_effect[3]. which will change the third entry. It can be a bit risky, since any kind of change in nodes would break the mod, but if you don't have anything else unique about it, you can use it.

 

thanks bud, used <append xpath="/progression/perks/perk[@name=perkDeadEye]/effect_group[2]"> and it works great

Share this post


Link to post
Share on other sites

Could you change multiple recipes with one line of code? I want to remove the RNG of needing to find a schematic every time I want to make a mod for my items and was wondering if it is easily done... maybe something like:

<remove xpath="/recipes/*/ingredient[contains(@name, 'Schematic')]"/>

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...