Jump to content

XPath Modding Explanation Thread


sphereii

Recommended Posts

hmm, it is loading after, but i haven't thought to check the log yet, i guess what i'm asking is if my syntax is correct?

 

well, the log shows no evidence of rejection.

 

2019-03-22T21:06:17 12.032 INF [MODS] Start loading
2019-03-22T21:06:17 12.034 INF [MODS] Trying to load from Firearms
2019-03-22T21:06:17 12.072 INF [MODS] Loaded Mod: Mayics Custom Firearms (1.2)
2019-03-22T21:06:17 12.072 INF [MODS] Trying to load from JRB_ZombieLootDrop_15
2019-03-22T21:06:17 12.077 INF [MODS] Loaded Mod: JRB_ZombieLootDrop_15 (3.0)
2019-03-22T21:06:17 12.077 INF [MODS] Trying to load from Melee
2019-03-22T21:06:17 12.078 INF [MODS] Loaded Mod: Melee (1.0)
2019-03-22T21:06:17 12.078 INF [MODS] Trying to load from S420_SimpleUI-BiggerBackpack120
2019-03-22T21:06:17 12.082 INF [MODS] Loaded Mod: S420_SimpleUI-BiggerBackpack120 (1.0)
2019-03-22T21:06:17 12.082 INF [MODS] Trying to load from S420_SimpleUI-Compass
2019-03-22T21:06:17 12.087 INF [MODS] Loaded Mod: S420_SimpleUI-Compass (1.0)
2019-03-22T21:06:17 12.087 INF [MODS] Trying to load from S420_SimpleUI-CraftingQueue
2019-03-22T21:06:17 12.091 INF [MODS] Loaded Mod: S420_SimpleUI-CraftingQueue (1.0)
2019-03-22T21:06:17 12.091 INF [MODS] Trying to load from S420_SimpleUI-ForgeInput
2019-03-22T21:06:17 12.092 INF [MODS] Loaded Mod: S420_SimpleUI-ForgeInput (1.0)
2019-03-22T21:06:17 12.092 INF [MODS] Trying to load from S420_SimpleUI-LeftHUD
2019-03-22T21:06:17 12.094 INF [MODS] Loaded Mod: S420_SimpleUI-LeftHUD (1.0)
2019-03-22T21:06:17 12.094 INF [MODS] Trying to load from SovietWeaponPack
2019-03-22T21:06:17 12.095 INF [MODS] Loaded Mod: SovietPack (1.2.1)
2019-03-22T21:06:17 12.096 INF [MODS] Trying to load from XXAdvancedAmmoCrafting
2019-03-22T21:06:17 12.102 INF [MODS] Loaded Mod: Olfurinars Advanced Ammo Crafting (1.0)
2019-03-22T21:06:17 12.102 INF [MODS] Initializing mod code
2019-03-22T21:06:17 12.103 INF [MODS] Loading done

Edited by Olfurinar (see edit history)
Link to comment
Share on other sites

hmm, it is loading after, but i haven't thought to check the log yet, i guess what i'm asking is if my syntax is correct?

 

well, the log shows no evidence of rejection.

 

2019-03-22T21:06:17 12.032 INF [MODS] Start loading
2019-03-22T21:06:17 12.034 INF [MODS] Trying to load from Firearms
2019-03-22T21:06:17 12.072 INF [MODS] Loaded Mod: Mayics Custom Firearms (1.2)
2019-03-22T21:06:17 12.072 INF [MODS] Trying to load from JRB_ZombieLootDrop_15
2019-03-22T21:06:17 12.077 INF [MODS] Loaded Mod: JRB_ZombieLootDrop_15 (3.0)
2019-03-22T21:06:17 12.077 INF [MODS] Trying to load from Melee
2019-03-22T21:06:17 12.078 INF [MODS] Loaded Mod: Melee (1.0)
2019-03-22T21:06:17 12.078 INF [MODS] Trying to load from S420_SimpleUI-BiggerBackpack120
2019-03-22T21:06:17 12.082 INF [MODS] Loaded Mod: S420_SimpleUI-BiggerBackpack120 (1.0)
2019-03-22T21:06:17 12.082 INF [MODS] Trying to load from S420_SimpleUI-Compass
2019-03-22T21:06:17 12.087 INF [MODS] Loaded Mod: S420_SimpleUI-Compass (1.0)
2019-03-22T21:06:17 12.087 INF [MODS] Trying to load from S420_SimpleUI-CraftingQueue
2019-03-22T21:06:17 12.091 INF [MODS] Loaded Mod: S420_SimpleUI-CraftingQueue (1.0)
2019-03-22T21:06:17 12.091 INF [MODS] Trying to load from S420_SimpleUI-ForgeInput
2019-03-22T21:06:17 12.092 INF [MODS] Loaded Mod: S420_SimpleUI-ForgeInput (1.0)
2019-03-22T21:06:17 12.092 INF [MODS] Trying to load from S420_SimpleUI-LeftHUD
2019-03-22T21:06:17 12.094 INF [MODS] Loaded Mod: S420_SimpleUI-LeftHUD (1.0)
2019-03-22T21:06:17 12.094 INF [MODS] Trying to load from SovietWeaponPack
2019-03-22T21:06:17 12.095 INF [MODS] Loaded Mod: SovietPack (1.2.1)
2019-03-22T21:06:17 12.096 INF [MODS] Trying to load from XXAdvancedAmmoCrafting
2019-03-22T21:06:17 12.102 INF [MODS] Loaded Mod: Olfurinars Advanced Ammo Crafting (1.0)
2019-03-22T21:06:17 12.102 INF [MODS] Initializing mod code
2019-03-22T21:06:17 12.103 INF [MODS] Loading done

 

Nothing stands out at a glance, but I don't see the structure of the item you are changing. Any WARN errors after the log of it parsing?

 

If you load into a game, do an "exportcurrentconfigs" in the console, is your changes applied?

Link to comment
Share on other sites

The original code,

<item name="Luger">
<snipped>
<property class="Action0">
	<property name="Magazine_items" value="9x19mm Bullet"/>
<snipped>
</item>

 

What i need it to be,

<item name="Luger">
<snipped>
<property class="Action0">
	<property name="Magazine_items" value="ammo9mmBullet,ammo9mmBulletSteel,9x19mm Bullet,9x19mm JHP Bullet,9x19mm FMJ Bullet,9x19mm Bullet Steel,9x19mm JHP Bullet Steel,9x19mm FMJ Bullet Steel"/>
<snipped>
</item>

 

I'm terribly sorry, i keep forgetting... we have an ammo type limit of 8 types per weapon, i was trying to shove in 10.

:shame:

Link to comment
Share on other sites

The original code,

<item name="Luger">
<snipped>
<property class="Action0">
	<property name="Magazine_items" value="9x19mm Bullet"/>
<snipped>
</item>

 

What i need it to be,

<item name="Luger">
<snipped>
<property class="Action0">
	<property name="Magazine_items" value="ammo9mmBullet,ammo9mmBulletSteel,9x19mm Bullet,9x19mm JHP Bullet,9x19mm FMJ Bullet,9x19mm Bullet Steel,9x19mm JHP Bullet Steel,9x19mm FMJ Bullet Steel"/>
<snipped>
</item>

 

I'm terribly sorry, i keep forgetting... we have an ammo type limit of 8 types per weapon, i was trying to shove in 10.

:shame:

 

So all good... or no? :)

Link to comment
Share on other sites

Hey everyone, working on some mods and I can't seem to get this to work.

 

code:

<remove xpath="/lootcontainers/lootgroup[@name=weaponsHuntingRifle+ammo]/item[@name'ammo762mmBulletFMJ']"/>

 

I want to remove the ammo from the loot group so i can insert other ammo that the hunting rifle now fires.

Link to comment
Share on other sites

Hey everyone, working on some mods and I can't seem to get this to work.

 

code:

<remove xpath="/lootcontainers/lootgroup[@name=weaponsHuntingRifle+ammo]/item[@name'ammo762mmBulletFMJ']"/>

 

I want to remove the ammo from the loot group so i can insert other ammo that the hunting rifle now fires.

 

Sorry for the delay. Your xpath is nearly correct. You forgot a = between @name='ammo762mmBulletFMJ']

 

- - - Updated - - -

 

if i wanted to swap out the entire section of the property name="RandomTintColor of the cars, would i need to do each tint color individually or is there a way to change it as a group?

 

I'm sorry, I didn't see your message earlier.

 

you can do things like this, which will change all the RandomTintColor1 value in the entire file. You can just omit the block[@name=''] condition.

 

<set xpath="/blocks/block/property[@name='RandomTintColor1']/@value">0,200,0</set>

Link to comment
Share on other sites

Hi, I've been toying around with xpath since yesterday and I couldn't figure out how to set more than one variable (modify an existing variable) with the same set xpath command, I basically just copy pasted the almost same thing 3 times. I was wondering if there was a way to simplify this for future use, thanks!

 

Here's an example where I had to use an index since I don't think I can distinguish the spawner from one another any other way (feel free to correct me on this).

Here's the original xml code

	<biome name="pine_forest">
	<spawn maxcount="2" respawndelay="4" time="Any" entitygroup="ZombiesAll" />
	<spawn maxcount="1" respawndelay="7" time="Any" entitygroup="EnemyAnimalsForest" spawnDeadChance="0" />
	<spawn maxcount="1" respawndelay="7" time="Any" entitygroup="FriendlyAnimalsForest" spawnDeadChance="0" />
</biome>

And here's the xpath to change the max count of each line

<set xpath="/spawning/biome[@name='pine_forest']/spawn[1]/@maxcount">5</set>
<set xpath="/spawning/biome[@name='pine_forest']/spawn[2]/@maxcount">2</set>
<set xpath="/spawning/biome[@name='pine_forest']/spawn[3]/@maxcount">3</set>

Can this be done in just one xpath? Kinda like this

<set xpath="/spawning/biome[@name='pine_forest']
spawn[1]/@maxcount" 5
spawn[2]/@maxcount" 2
spawn[3]/@maxcount" 3
</set>

 

 

 

Another example where I'd like to modify a bunch of variables for all zombies, here's the original in entityclasses.xml (just random variables for testing)

<entity_class name="zombieTemplateMale">
<!-- other variables -->
<property name="Mass" value="170"/>
<property name="Weight" value="70"/>
<property name="MaxViewAngle" value="180"/>
<property name="SightRange" value="30"/> 
<!-- other variables -->
</entity_class>

 

And here's the code to change just one of those variables, but I would basically have to copy paste almost the same set command for each variable I'd like to change. Again if all 4 could be done with just one command I would appreciate a hint or two. ;p

<set xpath="/entity_classes/entity_class[starts-with(@name, 'zombie')]/property[@name='Mass']/@value">420</set>

Link to comment
Share on other sites

Hi, I've been toying around with xpath since yesterday and I couldn't figure out how to set more than one variable (modify an existing variable) with the same set xpath command, I basically just copy pasted the almost same thing 3 times. I was wondering if there was a way to simplify this for future use, thanks!

 

Here's an example where I had to use an index since I don't think I can distinguish the spawner from one another any other way (feel free to correct me on this).

Here's the original xml code

	<biome name="pine_forest">
	<spawn maxcount="2" respawndelay="4" time="Any" entitygroup="ZombiesAll" />
	<spawn maxcount="1" respawndelay="7" time="Any" entitygroup="EnemyAnimalsForest" spawnDeadChance="0" />
	<spawn maxcount="1" respawndelay="7" time="Any" entitygroup="FriendlyAnimalsForest" spawnDeadChance="0" />
</biome>

And here's the xpath to change the max count of each line

<set xpath="/spawning/biome[@name='pine_forest']/spawn[1]/@maxcount">5</set>
<set xpath="/spawning/biome[@name='pine_forest']/spawn[2]/@maxcount">2</set>
<set xpath="/spawning/biome[@name='pine_forest']/spawn[3]/@maxcount">3</set>

Can this be done in just one xpath? Kinda like this

<set xpath="/spawning/biome[@name='pine_forest']
spawn[1]/@maxcount" 5
spawn[2]/@maxcount" 2
spawn[3]/@maxcount" 3
</set>

 

 

 

Another example where I'd like to modify a bunch of variables for all zombies, here's the original in entityclasses.xml (just random variables for testing)

<entity_class name="zombieTemplateMale">
<!-- other variables -->
<property name="Mass" value="170"/>
<property name="Weight" value="70"/>
<property name="MaxViewAngle" value="180"/>
<property name="SightRange" value="30"/> 
<!-- other variables -->
</entity_class>

 

And here's the code to change just one of those variables, but I would basically have to copy paste almost the same set command for each variable I'd like to change. Again if all 4 could be done with just one command I would appreciate a hint or two. ;p

<set xpath="/entity_classes/entity_class[starts-with(@name, 'zombie')]/property[@name='Mass']/@value">420</set>

 

You are adding conditions to your spawn in your first example that limits the changes it does.

 

Here, you are saying change the 2nd spawn node's maxcount:

<set xpath="/spawning/biome[@name='pine_forest']/spawn[2]/@maxcount">2</set>

 

or you could loosen up your filter, and remove the condition on the spawn node, and it'd apply to all spawns in the pine_forest biome:

<set xpath="/spawning/biome[@name='pine_forest']/spawn/@maxcount">2</set>

 

For your second example, that should work, and adjust each Mass value for each zombie. It will not add a Mass property if it doesn't exists.

Link to comment
Share on other sites

You are adding conditions to your spawn in your first example that limits the changes it does.

 

Here, you are saying change the 2nd spawn node's maxcount:

<set xpath="/spawning/biome[@name='pine_forest']/spawn[2]/@maxcount">2</set>

 

or you could loosen up your filter, and remove the condition on the spawn node, and it'd apply to all spawns in the pine_forest biome:

<set xpath="/spawning/biome[@name='pine_forest']/spawn/@maxcount">2</set>

Yeah, figured that one out, problem is I'd like to be able to specify a different value for each spawn using only one xpath instead of 3, not apply the same value to all spawn nodes. ;)

 

For your second example, that should work, and adjust each Mass value for each zombie. It will not add a Mass property if it doesn't exists.

I just wanted to add another example without the index, but it's basically the same request: modify more than one variable on the same xpath instead of using a seperate xpath for each and every property of the same class.

 

Just wanted to know if that is even possible, and if yes how. ;p

Link to comment
Share on other sites

Help, i'm trying to change the drop on destroy commands for a specific item, tree and I can accomplish easily insert and insert the entire code of the tree. But i'd rather do this the right way with set xpath and i do not think i can get into the right node to make my changes.

 

Here is original:

 

<block name="treeCactus01">

SNIP ************

<drop event="Harvest" name="resourceYuccaFibers" count="10" tag="oreWoodHarvest"/>

<drop event="Destroy" name="foodCropYuccaFruit" count="3" prob="1"/>

<drop event="Destroy" name="resourceYuccaFibers" count="5"/>

SNIP ***************

</block>

 

Here is my updated line after trying so many variations. Goal, to make the above cactus drop 20 Fibers instead of 3. Code says 5, but in my game it drops 3. ???

<set xpath="/blocks/block[@name=treeCactus01]/drop[@event=Destroy][@name=resourceYuccaFibers]/@count">20</set>

 

Any help would be appreciated.

 

Thanks

Link to comment
Share on other sites

sbangs007 I had a similar problem, my code was

<set xpath="/entity_classes/entity_class[@name='animalStag']/drop[@event='harvest'][@name='resourceFemur][@tag='butcherHarvest']/@count">5</set>

 

What i found to work was this

<set xpath="/entity_classes/entity_class[@name='animalStag']/drop[@tag='butcherHarvest']/@count">5</set>

 

so for you i would have somthing like this

<set xpath="/blocks/block[@name='treeCactus01']/drop[@name='resourceYuccaFibers']/@count">20</set>

Link to comment
Share on other sites

sbangs007 I had a similar problem, my code was
<set xpath="/entity_classes/entity_class[@name='animalStag']/drop[@event='harvest'][@name='resourceFemur][@tag='butcherHarvest']/@count">5</set>

 

What i found to work was this

<set xpath="/entity_classes/entity_class[@name='animalStag']/drop[@tag='butcherHarvest']/@count">5</set>

 

so for you i would have somthing like this

<set xpath="/blocks/block[@name='treeCactus01']/drop[@name='resourceYuccaFibers']/@count">20</set>

 

ok thanks, will give that a go.. appreciate the info

 

- - - Updated - - -

 

sbangs007 I had a similar problem, my code was
<set xpath="/entity_classes/entity_class[@name='animalStag']/drop[@event='harvest'][@name='resourceFemur][@tag='butcherHarvest']/@count">5</set>

 

What i found to work was this

<set xpath="/entity_classes/entity_class[@name='animalStag']/drop[@tag='butcherHarvest']/@count">5</set>

 

so for you i would have somthing like this

<set xpath="/blocks/block[@name='treeCactus01']/drop[@name='resourceYuccaFibers']/@count">20</set>

 

Question, since you have it in your example, what is the purpose or definition of a "tag" with 7days?

 

Thanks

Link to comment
Share on other sites

sbangs007 I had a similar problem, my code was
<set xpath="/entity_classes/entity_class[@name='animalStag']/drop[@event='harvest'][@name='resourceFemur][@tag='butcherHarvest']/@count">5</set>

 

What i found to work was this

<set xpath="/entity_classes/entity_class[@name='animalStag']/drop[@tag='butcherHarvest']/@count">5</set>

 

so for you i would have somthing like this

<set xpath="/blocks/block[@name='treeCactus01']/drop[@name='resourceYuccaFibers']/@count">20</set>

 

 

So i used this...

<set xpath="/blocks/block[@name='treeCactus01']/drop[@name='resourceYuccaFibers']/@count">20</set>

 

Didnt work. No errors, but the cactus01 just gave 3 the default. So i also tested this line, just to be sure i was in the right node.

<set xpath="/blocks/block[@name='treeCactus01']/property[@name='OnlySimpleRotations']/@value">false</set>

Since I know that syntax really well, little room for error, and that code failed too. The trees were able to use advanced rotation.

 

So I dont think, i'm getting the first part right or getting into the correct node, ugh, not sure.

Link to comment
Share on other sites

In the code I was working with the tag was being used to define how the animal was being harvested, ie with hunting knife or butcherHarvest vs say a stone ax an alltoolsharvest.

 

I am no expert but i see Tag used to say if a recipe is learnable etc... thus i would define it as a way of setting parameters to use or get somthing.

 

Hope that helps maybe a more experienced coder can give us a better definition of the Tag .

Link to comment
Share on other sites

have you tried the and?

 

something like this

<set xpath="/blocks/block[@name='treeCactus01']/drop[@event='Destroy' and @name='resourceYuccaFibers']/@count">20</set>

 

yea, just now.. but still not working, again no error, but no change in drop.

 

Also, i cant even get the basic code for rotation changed, code is in an updated reply above. So if thats not working, im missing the entire node in my opinion.

Link to comment
Share on other sites

yea, just now.. but still not working, again no error, but no change in drop.

 

Also, i cant even get the basic code for rotation changed, code is in an updated reply above. So if thats not working, im missing the entire node in my opinion.

 

Those are valid xpath. Have you checked the output of exportcurrentconfigs? Do you have a log file?

Link to comment
Share on other sites

no, i havent.. prob my next step i figure :)

 

 

Ok, got the logs, and checked my target node. Nothing is being changed.. ugh

 

<block name="treeCactus01">
<property name="Class" value="Cactus" />
<property name="DisplayType" value="blockMulti" />
<property name="Material" value="Mcactus" />
<property name="Shape" value="DistantDeco" />
<property name="Model" value="Entities/Trees/Saguaro_Cactus_20Prefab" />
<property name="ModelOffset" value="0,-0.1,0" />
<property name="MultiBlockDim" value="1,6,1" />
<property name="IsTerrainDecoration" value="true" />
<property name="IsDistantDecoration" value="true" />
<property name="ImposterDontBlock" value="true" />
<property name="BigDecorationRadius" value="2" />
<property name="OnlySimpleRotations" value="true" />
<property name="Tag" value="TreeTrunk" />
<property name="Damage" value="3" />
<property name="IsPlant" value="true" />
<property name="CanPlayersSpawnOn" value="false" />
<drop event="Harvest" name="resourceYuccaFibers" count="10" tag="oreWoodHarvest" />
<drop event="Destroy" name="foodCropYuccaFruit" count="3" prob="1" />
<drop event="Destroy" name="resourceYuccaFibers" count="5" />
<property name="FilterTags" value="foutdoor,fcactus,fshrubbery" />
<property name="SortOrder1" value="a0e0" />
<property name="ActivationDistance" value="10" />
</block>

Link to comment
Share on other sites

Ok, got the logs, and checked my target node. Nothing is being changed.. ugh

 

<block name="treeCactus01">
<property name="Class" value="Cactus" />
<property name="DisplayType" value="blockMulti" />
<property name="Material" value="Mcactus" />
<property name="Shape" value="DistantDeco" />
<property name="Model" value="Entities/Trees/Saguaro_Cactus_20Prefab" />
<property name="ModelOffset" value="0,-0.1,0" />
<property name="MultiBlockDim" value="1,6,1" />
<property name="IsTerrainDecoration" value="true" />
<property name="IsDistantDecoration" value="true" />
<property name="ImposterDontBlock" value="true" />
<property name="BigDecorationRadius" value="2" />
<property name="OnlySimpleRotations" value="true" />
<property name="Tag" value="TreeTrunk" />
<property name="Damage" value="3" />
<property name="IsPlant" value="true" />
<property name="CanPlayersSpawnOn" value="false" />
<drop event="Harvest" name="resourceYuccaFibers" count="10" tag="oreWoodHarvest" />
<drop event="Destroy" name="foodCropYuccaFruit" count="3" prob="1" />
<drop event="Destroy" name="resourceYuccaFibers" count="5" />
<property name="FilterTags" value="foutdoor,fcactus,fshrubbery" />
<property name="SortOrder1" value="a0e0" />
<property name="ActivationDistance" value="10" />
</block>

 

You got that snippet from your main 7 Days To Die Config folder, or from the Save Game folder?

Link to comment
Share on other sites

1444810916_2019-04-1109_29_05-Window.jpg.cfc62cac43338feecc99fc7ab05ecfc9.jpg

 

That was the location

I test it on my single player client machine, when the mod works, i then dump it over to my server machine.

 

- - - Updated - - -

 

1444810916_2019-04-1109_29_05-Window.jpg.cfc62cac43338feecc99fc7ab05ecfc9.jpg

 

That was the location

I test it on my single player client machine, when the mod works, i then dump it over to my server machine.

 

I decided to test another xml file for a mod of a sport bike i made, and that mod is present. So this is the right folder.

Link to comment
Share on other sites

[ATTACH=CONFIG]28157[/ATTACH]

 

That was the location

I test it on my single player client machine, when the mod works, i then dump it over to my server machine.

 

- - - Updated - - -

 

[ATTACH=CONFIG]28157[/ATTACH]

 

That was the location

I test it on my single player client machine, when the mod works, i then dump it over to my server machine.

 

I decided to test another xml file for a mod of a sport bike i made, and that mod is present. So this is the right folder.

 

Anything in your output_log.txt about the modlet not loading?

Link to comment
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...