Jump to content

XPath Modding Explanation Thread


sphereii

Recommended Posts

Howdy!

 

I've been working on a "no crafting" mod, and this thread has been gold! for information. I've learned a lot about xpath, etc.

I have unfortunately run into something.. Ive been able to get everything working the way i want it, but one part is giving me some issue.

The short story is this:

<config>

<remove xpath="/items/item[@name='modArmorPlatingBasicSchematic']" />

<append xpath="/items">
<item name="modArmorPlatingBasicSchematic">
<property name="Extends" value="schematicNoQualityMaster"/>
<property name="CreativeMode" value="Player"/>
<property name="CustomIcon" value="modArmorPlatingBasic"/>
<property name="Unlocks" value="modArmorPlatingBasic"/>
<effect_group tiered="false">
	<triggered_effect trigger="onSelfPrimaryActionEnd" action="ModifyCVar" 
cvar="modArmorPlatingBasic" operation="set" value="0"/>
	<triggered_effect trigger="onSelfPrimaryActionEnd" action="GiveExp" exp="50"/>
</effect_group>
</item>
</append>

</config>

 

this works, but everything i have tried to try to write it shorter.. to take up less space, and not have to

include everything... how am i trying to say this...

 

For some reason, just the way the game is, and does what it does right now, i can remove

all recipes from "recipes.xml", BUT, when i do, the trader sells all the item mods at 0 cost..

while all other items they sell DO have cost..

my workaround was to leave the recipes in there (that works fine), then to change

this line from value=1 --> value=0

<triggered_effect trigger="onSelfPrimaryActionEnd" action="ModifyCVar" 
cvar="modArmorPlatingBasic" operation="set" value="0"/>

 

that allows the trader to sell the item mods for #cost, but when you read the schematic,

you get the xp, but not the ability to craft it.

This is the intended goal, but i am looking for a shorter way to write this, rather than

write it the way i did above for every mod*schematic...

 

btw.. if i have to, i will. but i am sure there is a better way..

also, before i try with xpath, i DO try the changes in the actual xml file,

to make sure what i am trying is even valid..

i have tried starts-with, ends-with, set, etc...

each time it looks me right in the eye, and says F you,

 

for example:

<set xpath="/items/item[starts-with(@name, 'mod')]/triggered_effect[@operation='set']/@value">0</set>

 

this fails, for some reason..

 

Thanks!

Link to comment
Share on other sites

can xpath add in new entityclasses like a new zombie or animal? or do I need sdx still?

 

You can add new models for zombies and animals using just XML and Unity Bundles.

 

You would need SDX/DMT if you wanted to add a custom entity with its own animations, etc

Link to comment
Share on other sites

Howdy!

 

I've been working on a "no crafting" mod, and this thread has been gold! for information. I've learned a lot about xpath, etc.

I have unfortunately run into something.. Ive been able to get everything working the way i want it, but one part is giving me some issue.

The short story is this:

<config>

<remove xpath="/items/item[@name='modArmorPlatingBasicSchematic']" />

<append xpath="/items">
<item name="modArmorPlatingBasicSchematic">
<property name="Extends" value="schematicNoQualityMaster"/>
<property name="CreativeMode" value="Player"/>
<property name="CustomIcon" value="modArmorPlatingBasic"/>
<property name="Unlocks" value="modArmorPlatingBasic"/>
<effect_group tiered="false">
	<triggered_effect trigger="onSelfPrimaryActionEnd" action="ModifyCVar" 
cvar="modArmorPlatingBasic" operation="set" value="0"/>
	<triggered_effect trigger="onSelfPrimaryActionEnd" action="GiveExp" exp="50"/>
</effect_group>
</item>
</append>

</config>

 

this works, but everything i have tried to try to write it shorter.. to take up less space, and not have to

include everything... how am i trying to say this...

 

For some reason, just the way the game is, and does what it does right now, i can remove

all recipes from "recipes.xml", BUT, when i do, the trader sells all the item mods at 0 cost..

while all other items they sell DO have cost..

my workaround was to leave the recipes in there (that works fine), then to change

this line from value=1 --> value=0

<triggered_effect trigger="onSelfPrimaryActionEnd" action="ModifyCVar" 
cvar="modArmorPlatingBasic" operation="set" value="0"/>

 

that allows the trader to sell the item mods for #cost, but when you read the schematic,

you get the xp, but not the ability to craft it.

This is the intended goal, but i am looking for a shorter way to write this, rather than

write it the way i did above for every mod*schematic...

 

btw.. if i have to, i will. but i am sure there is a better way..

also, before i try with xpath, i DO try the changes in the actual xml file,

to make sure what i am trying is even valid..

i have tried starts-with, ends-with, set, etc...

each time it looks me right in the eye, and says F you,

 

for example:

<set xpath="/items/item[starts-with(@name, 'mod')]/triggered_effect[@operation='set']/@value">0</set>

 

this fails, for some reason..

 

Thanks!

 

I think the reason the above fails is that triggered_effect does not exist off an item node. They are always inside an <effect_group>

 

Either add a // or add in /effect_group

 

<set xpath="/items/item[starts-with(@name, 'mod')]//triggered_effect[@operation='set']/@value">0</set>
<set xpath="/items/item[starts-with(@name, 'mod')]/effect_group/triggered_effect[@operation='set']/@value">0</set>

Link to comment
Share on other sites

I think the reason the above fails is that triggered_effect does not exist off an item node. They are always inside an <effect_group>

 

Either add a // or add in /effect_group

 

<set xpath="/items/item[starts-with(@name, 'mod')]//triggered_effect[@operation='set']/@value">0</set>
<set xpath="/items/item[starts-with(@name, 'mod')]/effect_group/triggered_effect[@operation='set']/@value">0</set>

 

Well, i'll be... yep.. that did the trick..

I tried both, and they did work.. I know that I did try adding in the /effect_group/ on at least one try, but most likely had some other

punctuation wrong or misplaced...

 

Many Thanks!

+1

 

I will probably post this modlet after i play it for a little bit to make sure nothing in normal gameplay got buggered..

Link to comment
Share on other sites

Hi All,

 

Maybe someone could point me in the right direction, I am trying to modify value on a perk. It is from darkness falls mod, but this should not matter. I run into similar problem modifying random brackets on vanila game. Anyway here is xml code:

 

<perk name="perkASMiningTools" parent="skillMiningTools" max_level="100" base_skill_point_cost="0" name_key="perkASMiningToolsName" desc_key="perkASMiningToolsDesc" icon="ui_game_symbol_mining">
	<effect_group>
		<requirement name="HoldingItemHasTags" tags="perkMotherLode"/>
			<passive_effect name="BlockDamage" operation="perc_add" value="0.01,1" level="1,100"/>
			<passive_effect name="HarvestCount" operation="perc_add" value="0.01,1" level="1,100" />
			<effect_description level="1,100" desc_key="perkASMiningDesc"/>				
	</effect_group>

 

What I am aiming for is setting different value for HarvestCount. Here is my xpath:

 

<set xpath="perks/perk[@name="perkASMiningTools"]/effect_group/passive_effect[@name="HarvestCount"]/@value">0.01,0.5</set>

 

Word perks comes from file structure perks/perk etc. On game load I always get an error. Only way to go around this is to xpathremove whole effect_group and append new one. I would like some more flexible solution :).

 

Thanks

Link to comment
Share on other sites

Hi All,

 

Maybe someone could point me in the right direction, I am trying to modify value on a perk. It is from darkness falls mod, but this should not matter. I run into similar problem modifying random brackets on vanila game. Anyway here is xml code:

 

<perk name="perkASMiningTools" parent="skillMiningTools" max_level="100" base_skill_point_cost="0" name_key="perkASMiningToolsName" desc_key="perkASMiningToolsDesc" icon="ui_game_symbol_mining">
	<effect_group>
		<requirement name="HoldingItemHasTags" tags="perkMotherLode"/>
			<passive_effect name="BlockDamage" operation="perc_add" value="0.01,1" level="1,100"/>
			<passive_effect name="HarvestCount" operation="perc_add" value="0.01,1" level="1,100" />
			<effect_description level="1,100" desc_key="perkASMiningDesc"/>				
	</effect_group>

 

What I am aiming for is setting different value for HarvestCount. Here is my xpath:

 

<set xpath="perks/perk[@name="perkASMiningTools"]/effect_group/passive_effect[@name="HarvestCount"]/@value">0.01,0.5</set>

 

Word perks comes from file structure perks/perk etc. On game load I always get an error. Only way to go around this is to xpathremove whole effect_group and append new one. I would like some more flexible solution :).

 

Thanks

 

The start of your xpath is probably not as correct as it should be. should it be something like /progression/perks/ ? or just add //perks/perk...

Link to comment
Share on other sites

Thanks @Sphereii,

That did the trick.... I was so worried about the rest of the syntax I missed such simple thing.

Purpose of // is to start at that line as I understand, so I can avoid typing to long strings in such instances?

Link to comment
Share on other sites

Now I'm back with even more weird problems -.-

I'm trying to add a item that can be used to repair the different oven/stoves found to a working one based from Valmod.

The repairitem is added in and can be found in lootlists, but when I try to update an oven it just shows the 'missing item' error (correct one though) even when I have the item on me.

This is what I have appended in blocks.xml under <append xpath="/blocks">

<block name="workstationOven">
	<property name="DescriptionKey" value="workstationOvenDesc"/>
	<property name="Class" value="Campfire" />
	<property name="CustomIcon" value="cntWallOven" />
	<property name="Place" value="TowardsPlacerInverted" />
	<property name="Stacknumber" value="1" />
	<property name="Material" value="Mwood_weak" />
	<property name="Texture" value="346,345,341,345,262,345" />
	<property name="LootList" value="130" />
	<drop event="Destroy" name="resourceScrapIron" count="5,10" />
	<drop event="Fall" name="woodDebris" count="1" prob="1.0"  stick_chance=".75" />
	<property name="HeatMapStrength" value="1"/>
	<property name="HeatMapTime" value="1200"/>
	<property name="HeatMapFrequency" value="25"/>
	<property name="Group" value="Food/Cooking,Decor" />
	<property name="ActiveRadiusEffects" value="+heatSource(3)"/>
	<property class="Workstation">
		<property name="Modules" value="tools,output,input"/>
		<property name="CraftingAreaRecipes" value="campfire" />
	</property>
</block>
</append>	

<append xpath="blocks/block[@name='cntWallOven']">
	<property class="UpgradeBlock">
	<property name="ToBlock" value="workstationOven"/>
	<property name="Item" value="ElectricalRepairKit"/>
	<property name="ItemCount" value="1"/>
	<property name="UpgradeHitCount" value="5"/>
</property>
<property name="CustomUpgradeSound" value="place_block_metal" />
</append>

<append xpath="blocks/block[@name='cntStoveOldVer1Closed']">
	<property class="UpgradeBlock">
	<property name="ToBlock" value="workstationOven"/>
	<property name="Item" value="ElectricalRepairKit"/>
	<property name="ItemCount" value="1"/>
	<property name="UpgradeHitCount" value="5"/>
</property>
<property name="CustomUpgradeSound" value="place_block_metal" />
</append>

And this is the item appended in items.xml

<append xpath="/items">
<item name="ElectricalRepairKit">
<property name="HoldType" value="45" />
<property name="Meshfile" value="#Other/Items?Misc/sackPrefab.prefab" />
<property name="DropMeshfile" value="#Other/Items?Misc/sack_droppedPrefab.prefab" />
<property name="Material" value="MresourceScrapIron" />
<property name="Weight" value="1" />
<property name="Stacknumber" value="25" /> <!-- STK resource -->
<property name="EconomicValue" value="10" />
<property name="EconomicBundleSize" value="10" />
<property name="Group" value="Resources" />
<property name="RepairTime" value=".5" />
<property name="RepairAmount" value="20" />
<property name="CraftingIngredientTime" value=".2" />
<property name="CustomIcon" value="resourceRepairKit" />
</item>
</append>

I tried to change the item to just need resourceScrapIron, and then it worked flawlessly and used one scrapiron, but not with the ElectricalRepairKit. All the items are loaded and looks correct in the configdump xmls

Link to comment
Share on other sites

Now I'm back with even more weird problems -.-

I'm trying to add a item that can be used to repair the different oven/stoves found to a working one based from Valmod.

The repairitem is added in and can be found in lootlists, but when I try to update an oven it just shows the 'missing item' error (correct one though) even when I have the item on me.

This is what I have appended in blocks.xml under <append xpath="/blocks">

<block name="workstationOven">
	<property name="DescriptionKey" value="workstationOvenDesc"/>
	<property name="Class" value="Campfire" />
	<property name="CustomIcon" value="cntWallOven" />
	<property name="Place" value="TowardsPlacerInverted" />
	<property name="Stacknumber" value="1" />
	<property name="Material" value="Mwood_weak" />
	<property name="Texture" value="346,345,341,345,262,345" />
	<property name="LootList" value="130" />
	<drop event="Destroy" name="resourceScrapIron" count="5,10" />
	<drop event="Fall" name="woodDebris" count="1" prob="1.0"  stick_chance=".75" />
	<property name="HeatMapStrength" value="1"/>
	<property name="HeatMapTime" value="1200"/>
	<property name="HeatMapFrequency" value="25"/>
	<property name="Group" value="Food/Cooking,Decor" />
	<property name="ActiveRadiusEffects" value="+heatSource(3)"/>
	<property class="Workstation">
		<property name="Modules" value="tools,output,input"/>
		<property name="CraftingAreaRecipes" value="campfire" />
	</property>
</block>
</append>	

<append xpath="blocks/block[@name='cntWallOven']">
	<property class="UpgradeBlock">
	<property name="ToBlock" value="workstationOven"/>
	<property name="Item" value="ElectricalRepairKit"/>
	<property name="ItemCount" value="1"/>
	<property name="UpgradeHitCount" value="5"/>
</property>
<property name="CustomUpgradeSound" value="place_block_metal" />
</append>

<append xpath="blocks/block[@name='cntStoveOldVer1Closed']">
	<property class="UpgradeBlock">
	<property name="ToBlock" value="workstationOven"/>
	<property name="Item" value="ElectricalRepairKit"/>
	<property name="ItemCount" value="1"/>
	<property name="UpgradeHitCount" value="5"/>
</property>
<property name="CustomUpgradeSound" value="place_block_metal" />
</append>

And this is the item appended in items.xml

<append xpath="/items">
<item name="ElectricalRepairKit">
<property name="HoldType" value="45" />
<property name="Meshfile" value="#Other/Items?Misc/sackPrefab.prefab" />
<property name="DropMeshfile" value="#Other/Items?Misc/sack_droppedPrefab.prefab" />
<property name="Material" value="MresourceScrapIron" />
<property name="Weight" value="1" />
<property name="Stacknumber" value="25" /> <!-- STK resource -->
<property name="EconomicValue" value="10" />
<property name="EconomicBundleSize" value="10" />
<property name="Group" value="Resources" />
<property name="RepairTime" value=".5" />
<property name="RepairAmount" value="20" />
<property name="CraftingIngredientTime" value=".2" />
<property name="CustomIcon" value="resourceRepairKit" />
</item>
</append>

I tried to change the item to just need resourceScrapIron, and then it worked flawlessly and used one scrapiron, but not with the ElectricalRepairKit. All the items are loaded and looks correct in the configdump xmls

 

I'm not much of an expert on this, but how are you applying the upgrade? via a hammer? Did you also update the hammer's Allowed_upgrade_items to include your new item?

Link to comment
Share on other sites

I'm not much of an expert on this, but how are you applying the upgrade? via a hammer? Did you also update the hammer's Allowed_upgrade_items to include your new item?

 

I tried with nailgun and stoneaxe, but I was unaware of that allowed_upgrade_item. That's probably it! Gonna apply that example code from page one to change all of those when I get back home :D

Many many thanks for helping with my numerous mishaps. I just can't seem to get the hang of xpath's logic :(

Link to comment
Share on other sites

  • 2 weeks later...

Hi, how do I enter here with xpath:

 

"<effect_group name="gunJunkTurret">

<passive_effect name="MaxRange" operation="base_set" value="15"/>

<passive_effect name="DamageFalloffRange" operation="base_set" value="10"/>

<passive_effect name="DamageFalloffRange" operation="perc_add" value="-.2,.2"/> <!-- random effective rng -->

<passive_effect name="BlockRange" operation="base_set" value="3"/>

 

<passive_effect name="EntityDamage" operation="base_set" value="11.8"/>

<passive_effect name="EntityDamage" operation="perc_add" value="-.15,.15"/> <!-- random EntityDmg -->

<passive_effect name="EntityDamage" operation="perc_add" value=".1,.5" tier="2,6"/> <!-- tier bonus -->

 

<passive_effect name="DegradationMax" operation="perc_add" value="-.2,.2" tags="perkTurrets"/> <!-- random DegMax -->

<passive_effect name="WeaponHandling" operation="perc_add" value="-.08,.08"/> <!-- random WeaponHandling -->

 

<passive_effect name="RoundsPerMinute" operation="perc_add" value="-.1,.1"/> <!-- random APM -->

<passive_effect name="MagazineSize" operation="perc_add" value="-.122,.122"/> <!-- random MagazineSize -->

<passive_effect name="WeaponHandling" operation="perc_add" value="-.08,.08"/> <!-- random WeaponHandling -->

 

<passive_effect name="BlockDamage" operation="base_set" value="1"/>

 

<passive_effect name="RoundsPerMinute" operation="base_set" value="105.6"/>

<passive_effect name="BurstRoundCount" operation="base_set" value="1"/>

 

 

<!-- was

<passive_effect name="MagazineSize" operation="base_set" value="50"/>

<passive_effect name="MagazineSize" operation="base_add" value="2,10" tier="2,6"/>

-->

 

<passive_effect name="MagazineSize" operation="base_set" value="62"/>

<passive_effect name="MagazineSize" operation="base_add" value="6,30" tier="2,6"/>

<passive_effect name="ReloadSpeedMultiplier" operation="base_set" value="1"/>

 

<passive_effect name="SpreadDegreesVertical" operation="base_set" value="5"/>

<passive_effect name="SpreadDegreesHorizontal" operation="base_set" value="5"/>

<passive_effect name="SpreadMultiplierAiming" operation="perc_add" value="-.13"/>

<passive_effect name="SpreadMultiplierCrouching" operation="perc_add" value="-.05"/>

<passive_effect name="SpreadMultiplierWalking" operation="perc_add" value=".15"/>

<passive_effect name="SpreadMultiplierRunning" operation="perc_add" value=".3"/>

 

<passive_effect name="KickDegreesVerticalMin" operation="base_set" value="3"/>

<passive_effect name="KickDegreesVerticalMax" operation="base_set" value="3"/>

 

<passive_effect name="KickDegreesHorizontalMin" operation="base_set" value="-2"/>

<passive_effect name="KickDegreesHorizontalMax" operation="base_set" value="2"/>

 

<passive_effect name="IncrementalSpreadMultiplier" operation="base_set" value="0"/>

<passive_effect name="WeaponHandling" operation="base_set" value="1"/>

 

<passive_effect name="JunkTurretActiveRange" operation="base_set" value="30"/>

 

<passive_effect name="DegradationMax" operation="base_set" value="250,600" tier="1,6" tags="perkTurrets"/>

<passive_effect name="DegradationPerUse" operation="base_set" value="0.35" tags="perkTurrets"/>

<passive_effect name="ModSlots" operation="base_set" value="1,1,2,2,3,4" tier="1,2,3,4,5,6"/>

<passive_effect name="ModPowerBonus" operation="perc_add" value=".10" tags="EntityDamage"/>

<passive_effect name="ModPowerBonus" operation="base_add" value="300" tags="EconomicValue"/>

</effect_group>

"

Link to comment
Share on other sites

  • 1 month later...
How can i remove dynamite completly from the game?

So you cant craft or loot it.

 

Thanks in advance ;)

 

Orakel

My quick anser is to set damage to 0 if the griefing is what worries you, that's easy. But if you want to achieve what you said, redo the nodes of loot groups where it appears, and for the crafting, you can alter the recipe, either set the ammount result to 0, or add an unobtainable resource to it.

Link to comment
Share on other sites

  • 1 month later...
  • 2 weeks later...

i cant get this to work, any ideas?

 

 

<configs>

<!--CDSStartingLoot-->

<set xpath="/entity_classes/entity_class[@name=playerMale]/property[@name=ItemsOnEnterGame.GameModeSurvival]/@value">hitMe1</set>

<set xpath="/entity_classes/entity_class[@name=playerMale]/property[@name=ItemsOnEnterGame.GameModeSurvivalSP]/@value">hitMe1</set>

<set xpath="/entity_classes/entity_class[@name=playerMale]/property[@name=ItemsOnEnterGame.GameModeSurvivalMP]/@value">hitMe1</set>

</configs>

 

 

Link to comment
Share on other sites

 

The good news is that its valid xpath. What exactly isn't working? What's your mod-let folder structure?

 

the same as everybody else. The mod is suppose to change starting look. Even removing all other files and just leaving the mod info, an the folder with the entities file. and then placing a vanilla item into the code, it still doesnt change out the starting loot.

 

its just a starting loot change mod. I would reference somebody elses, but i couldnt find any in the forums that were current with xpath.

 

folder structure = mods>modlet folder>mod info + mod folder>files

Link to comment
Share on other sites

 

This makes sense, and sorry for the delay. That was why I was asking about the structure of the files.

 

i wish i was right. I reviewed the fl and all are saved as .xml. and still not working. I can see where boot says it is reading them. but when you log into the game it still gives the vanilla starting loot. I have even tried deleting the blocks and loot files and replacing the item with a vanilla one, and it still ignores the swapped loot.

 

 

I am having the same problem with several other peoples mods, where the vanilla files are simply not being overwritten at bootup, even though the boot files says that it read the modlet.

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...