Swiftpaw Posted November 30, 2018 Share Posted November 30, 2018 Is there a way to remove/set/insertafter/etc ALL matching lines? For example, if I wanted to remove all of the AITasks and AITargets from say the animalWolf entity_class, I tried: <remove xpath="/entity_classes/entity_class[@name='animalWolf']/property[starts-with(@name, 'AITa')]"/> However, this is failing to remove all the entries. I also played a bit with it and found this didn't work either: <remove xpath="/entity_classes/entity_class[@name='animalWolf']/property[@name='AITask-*']"/> <remove xpath="/entity_classes/entity_class[@name='animalWolf']/property[@name='AITarget-*']"/> When I specify every single line, it works fine: <remove xpath="/entity_classes/entity_class[@name='animalWolf']/property[@name='AITask-2']"/> <remove xpath="/entity_classes/entity_class[@name='animalWolf']/property[@name='AITask-3']"/> <remove xpath="/entity_classes/entity_class[@name='animalWolf']/property[@name='AITask-4']"/> <remove xpath="/entity_classes/entity_class[@name='animalWolf']/property[@name='AITask-5']"/> <remove xpath="/entity_classes/entity_class[@name='animalWolf']/property[@name='AITask-6']"/> <remove xpath="/entity_classes/entity_class[@name='animalWolf']/property[@name='AITask-7']"/> <remove xpath="/entity_classes/entity_class[@name='animalWolf']/property[@name='AITask-8']"/> <remove xpath="/entity_classes/entity_class[@name='animalWolf']/property[@name='AITarget-1']"/> <remove xpath="/entity_classes/entity_class[@name='animalWolf']/property[@name='AITarget-2']"/> <remove xpath="/entity_classes/entity_class[@name='animalWolf']/property[@name='AITarget-3']"/> <remove xpath="/entity_classes/entity_class[@name='animalWolf']/property[@name='AITarget-4']"/> I assume the issue is only one of the entries is being removed, so I'd have to do the following to do the same thing with starts-with: <remove xpath="/entity_classes/entity_class[@name='animalWolf']/property[starts-with(@name, 'AITa')]"/> <remove xpath="/entity_classes/entity_class[@name='animalWolf']/property[starts-with(@name, 'AITa')]"/> <remove xpath="/entity_classes/entity_class[@name='animalWolf']/property[starts-with(@name, 'AITa')]"/> <remove xpath="/entity_classes/entity_class[@name='animalWolf']/property[starts-with(@name, 'AITa')]"/> <remove xpath="/entity_classes/entity_class[@name='animalWolf']/property[starts-with(@name, 'AITa')]"/> <remove xpath="/entity_classes/entity_class[@name='animalWolf']/property[starts-with(@name, 'AITa')]"/> <remove xpath="/entity_classes/entity_class[@name='animalWolf']/property[starts-with(@name, 'AITa')]"/> <remove xpath="/entity_classes/entity_class[@name='animalWolf']/property[starts-with(@name, 'AITa')]"/> <remove xpath="/entity_classes/entity_class[@name='animalWolf']/property[starts-with(@name, 'AITa')]"/> <remove xpath="/entity_classes/entity_class[@name='animalWolf']/property[starts-with(@name, 'AITa')]"/> <remove xpath="/entity_classes/entity_class[@name='animalWolf']/property[starts-with(@name, 'AITa')]"/> <remove xpath="/entity_classes/entity_class[@name='animalWolf']/property[starts-with(@name, 'AITa')]"/> Any way to prevent such repetition? I searched this thread and didn't find any examples of manipulating multiple instances with a single xpath line. Thanks in advance! - - - Updated - - - Xpath gets applied when the game and worlds load. Seeing what the final XML looks like can help figure out when things don't go right. However, it'll only be useful if your changes were not fatal to the XML parsing. Oh it gives you the final modified xml file, that is indeed useful! Should you edit your original 1st post to add that suggestion? Either way thanks for the explanation! :3 Link to comment Share on other sites More sharing options...
sphereii Posted November 30, 2018 Author Share Posted November 30, 2018 Is there a way to remove/set/insertafter/etc ALL matching lines? For example, if I wanted to remove all of the AITasks and AITargets from say the animalWolf entity_class, I tried: <remove xpath="/entity_classes/entity_class[@name='animalWolf']/property[starts-with(@name, 'AITa')]"/> However, this is failing to remove all the entries. I also played a bit with it and found this didn't work either: <remove xpath="/entity_classes/entity_class[@name='animalWolf']/property[@name='AITask-*']"/> <remove xpath="/entity_classes/entity_class[@name='animalWolf']/property[@name='AITarget-*']"/> When I specify every single line, it works fine: <remove xpath="/entity_classes/entity_class[@name='animalWolf']/property[@name='AITask-2']"/> <remove xpath="/entity_classes/entity_class[@name='animalWolf']/property[@name='AITask-3']"/> <remove xpath="/entity_classes/entity_class[@name='animalWolf']/property[@name='AITask-4']"/> <remove xpath="/entity_classes/entity_class[@name='animalWolf']/property[@name='AITask-5']"/> <remove xpath="/entity_classes/entity_class[@name='animalWolf']/property[@name='AITask-6']"/> <remove xpath="/entity_classes/entity_class[@name='animalWolf']/property[@name='AITask-7']"/> <remove xpath="/entity_classes/entity_class[@name='animalWolf']/property[@name='AITask-8']"/> <remove xpath="/entity_classes/entity_class[@name='animalWolf']/property[@name='AITarget-1']"/> <remove xpath="/entity_classes/entity_class[@name='animalWolf']/property[@name='AITarget-2']"/> <remove xpath="/entity_classes/entity_class[@name='animalWolf']/property[@name='AITarget-3']"/> <remove xpath="/entity_classes/entity_class[@name='animalWolf']/property[@name='AITarget-4']"/> I assume the issue is only one of the entries is being removed, so I'd have to do the following to do the same thing with starts-with: <remove xpath="/entity_classes/entity_class[@name='animalWolf']/property[starts-with(@name, 'AITa')]"/> <remove xpath="/entity_classes/entity_class[@name='animalWolf']/property[starts-with(@name, 'AITa')]"/> <remove xpath="/entity_classes/entity_class[@name='animalWolf']/property[starts-with(@name, 'AITa')]"/> <remove xpath="/entity_classes/entity_class[@name='animalWolf']/property[starts-with(@name, 'AITa')]"/> <remove xpath="/entity_classes/entity_class[@name='animalWolf']/property[starts-with(@name, 'AITa')]"/> <remove xpath="/entity_classes/entity_class[@name='animalWolf']/property[starts-with(@name, 'AITa')]"/> <remove xpath="/entity_classes/entity_class[@name='animalWolf']/property[starts-with(@name, 'AITa')]"/> <remove xpath="/entity_classes/entity_class[@name='animalWolf']/property[starts-with(@name, 'AITa')]"/> <remove xpath="/entity_classes/entity_class[@name='animalWolf']/property[starts-with(@name, 'AITa')]"/> <remove xpath="/entity_classes/entity_class[@name='animalWolf']/property[starts-with(@name, 'AITa')]"/> <remove xpath="/entity_classes/entity_class[@name='animalWolf']/property[starts-with(@name, 'AITa')]"/> <remove xpath="/entity_classes/entity_class[@name='animalWolf']/property[starts-with(@name, 'AITa')]"/> Any way to prevent such repetition? I searched this thread and didn't find any examples of manipulating multiple instances with a single xpath line. Thanks in advance! - - - Updated - - - Oh it gives you the final modified xml file, that is indeed useful! Should you edit your original 1st post to add that suggestion? Either way thanks for the explanation! :3 What about /property[contains(@name, 'AITa')] ? Link to comment Share on other sites More sharing options...
Swiftpaw Posted November 30, 2018 Share Posted November 30, 2018 What about /property[contains(@name, 'AITa')] ? Yep, same thing, it's correctly matching it, just only removing the first instance it encounters before stopping. <!--Element removed by: "Friendly Animals"--> <property name="AITask-2" value="BreakBlock" /> <property name="AITask-3" value="Territorial" /> <property name="AITask-4" value="ApproachAndAttackTarget" param1="EntityAnimalStag,40,EntityPlayer,15,EntityZombie,30" /> <property name="AITask-5" value="ApproachSpot" /> <property name="AITask-6" value="Look" /> <property name="AITask-7" value="Wander" /> <property name="AITask-8" value="" /> <property name="AITarget-1" value="SetAsTargetIfHurt" /> <property name="AITarget-2" value="BlockingTargetTask" /> <property name="AITarget-3" value="SetNearestEntityAsTarget" param1="EntityPlayer,8,EntityAnimalStag,0,EntityZombie,0" /> <property name="AITarget-4" value="" /> Searched around on the net but couldn't find a solution for manipulating multiple nodes using a single xpath command. Oh well, for now I'll just have to have multiple entries! Link to comment Share on other sites More sharing options...
zicky Posted November 30, 2018 Share Posted November 30, 2018 I want to increase the number of eggs that drop, but I keep getting errors with my xpath. I want to change this <!-- birds nest--> <lootcontainer id="25" count="1,3" size="4,3" sound_open="UseActions/open_garbage" sound_close="UseActions/close_garbage" loot_quality_template="baseTemplate"> <item name="foodEgg" count="1" prob="0.25"/> <item name="resourceFeather" count="4,8" prob="0.75"/> </lootcontainer> to <!-- birds nest--> <lootcontainer id="25" count="1,3" size="4,3" sound_open="UseActions/open_garbage" sound_close="UseActions/close_garbage" loot_quality_template="baseTemplate"> <item name="foodEgg" count="1,2" prob="0.30"/> <item name="resourceFeather" count="4,8" prob="0.75"/> </lootcontainer> Here is my xml: <configs> <set xpath="/lootcontainers/lootcontainer[@id=25]/[@loot_quality_template=baseTemplate]/[@name=foodEgg]/count">1,2</set> <set xpath="/lootcontainers/lootcontainer[@id=25]/[@loot_quality_template=baseTemplate]/[@name=foodEgg]/prob">0.30</set> </configs> Can you tell me what I'm doing wrong here? Link to comment Share on other sites More sharing options...
RevenantWit Posted November 30, 2018 Share Posted November 30, 2018 I want to increase the number of eggs that drop, but I keep getting errors with my xpath. I want to change this <!-- birds nest--> <lootcontainer id="25" count="1,3" size="4,3" sound_open="UseActions/open_garbage" sound_close="UseActions/close_garbage" loot_quality_template="baseTemplate"> <item name="foodEgg" count="1" prob="0.25"/> <item name="resourceFeather" count="4,8" prob="0.75"/> </lootcontainer> to <!-- birds nest--> <lootcontainer id="25" count="1,3" size="4,3" sound_open="UseActions/open_garbage" sound_close="UseActions/close_garbage" loot_quality_template="baseTemplate"> <item name="foodEgg" count="1,2" prob="0.30"/> <item name="resourceFeather" count="4,8" prob="0.75"/> </lootcontainer> Here is my xml: <configs> <set xpath="/lootcontainers/lootcontainer[@id=25]/[@loot_quality_template=baseTemplate]/[@name=foodEgg]/count">1,2</set> <set xpath="/lootcontainers/lootcontainer[@id=25]/[@loot_quality_template=baseTemplate]/[@name=foodEgg]/prob">0.30</set> </configs> Can you tell me what I'm doing wrong here? Untested but you might try <set xpath="/lootcontainers/lootcontainer[@id='25']/item[@name='foodEgg']/@count">1,2</set> <set xpath="/lootcontainers/lootcontainer[@id='25']/item[@name='foodEgg']/@prob">0.30</set> Link to comment Share on other sites More sharing options...
sphereii Posted November 30, 2018 Author Share Posted November 30, 2018 I want to increase the number of eggs that drop, but I keep getting errors with my xpath. I want to change this <!-- birds nest--> <lootcontainer id="25" count="1,3" size="4,3" sound_open="UseActions/open_garbage" sound_close="UseActions/close_garbage" loot_quality_template="baseTemplate"> <item name="foodEgg" count="1" prob="0.25"/> <item name="resourceFeather" count="4,8" prob="0.75"/> </lootcontainer> to <!-- birds nest--> <lootcontainer id="25" count="1,3" size="4,3" sound_open="UseActions/open_garbage" sound_close="UseActions/close_garbage" loot_quality_template="baseTemplate"> <item name="foodEgg" count="1,2" prob="0.30"/> <item name="resourceFeather" count="4,8" prob="0.75"/> </lootcontainer> Here is my xml: <configs> <set xpath="/lootcontainers/lootcontainer[@id=25]/[@loot_quality_template=baseTemplate]/[@name=foodEgg]/count">1,2</set> <set xpath="/lootcontainers/lootcontainer[@id=25]/[@loot_quality_template=baseTemplate]/[@name=foodEgg]/prob">0.30</set> </configs> Can you tell me what I'm doing wrong here? You are close. I don't think you need to evaluate the loot_quality_template at all, and you were missing the /item/, which takes it inside each loot container to the change you want. <configs> <set xpath="/lootcontainers/lootcontainer[@id='25' ]/item[@name='foodEgg']/@count">1,2</set> <set xpath="/lootcontainers/lootcontainer[@id='25' ]/item[@name='foodEgg']/@prob">0.3</set> </configs> [/COdE] Link to comment Share on other sites More sharing options...
zicky Posted November 30, 2018 Share Posted November 30, 2018 That worked. Thank you. Link to comment Share on other sites More sharing options...
Swiftpaw Posted November 30, 2018 Share Posted November 30, 2018 Searched around on the net but couldn't find a solution for manipulating multiple nodes using a single xpath command. Oh well, for now I'll just have to have multiple entries! "Append" works for multiple nodes, like this works: <append xpath="/entity_classes/entity_class[starts-with(@name, 'zombie')]"> So it seems to be at just, or at least, the "remove" command that doesn't work with multiple nodes. Link to comment Share on other sites More sharing options...
Deceptive Pastry Posted November 30, 2018 Share Posted November 30, 2018 (edited) Can you use more than two 'or' conditions? eg. [@name=zombieJoeFeral' or @name='zombieBoeFeral' or @name='zombieYoFeral] I'm thinking this would be the most efficient because I can't just use startswith + endswith as there are a bunch of Ferals with different health. Edit: And I don't think I can just use [@name=HealthMax][@value=X] because that is in the effect_group and this needs to be placed outside the effect group. Edited November 30, 2018 by Deceptive Pastry (see edit history) Link to comment Share on other sites More sharing options...
SandyBeaches Posted November 30, 2018 Share Posted November 30, 2018 Yes, and you can mix them with ands as well. Link to comment Share on other sites More sharing options...
Deceptive Pastry Posted November 30, 2018 Share Posted November 30, 2018 (edited) Actually...is there a way to search for something in the effect_group to determine location, but place it one node back by returning to the parent node? Such as use "/entity_classes/entity_class/effect_group/passive_effect[@name=HealthMax][@value=225]" to locate the proper location <effect_group name="Base Effects"> <passive_effect name="HealthMax" operation="base_set" value="225"/> <passive_effect name="HealthMax" operation="perc_set" value="1"/> <!-- Zombie HP scale --> </effect_group> But place the new line as such [color="#DAA520"]<property name="DismemberMultiplierHead" value=".15"/>[/color] <effect_group name="Base Effects"> <passive_effect name="HealthMax" operation="base_set" value="225"/> <passive_effect name="HealthMax" operation="perc_set" value="1"/> <!-- Zombie HP scale --> </effect_group> Would something like this work? <append xpath="/entity_classes/entity_class/effect_group/passive_effect[@name='HealthMax'][@value='225']/../.."> <property name="DismemberMultiplierHead" value=".15"/> </append> Edited November 30, 2018 by Deceptive Pastry (see edit history) Link to comment Share on other sites More sharing options...
Deceptive Pastry Posted November 30, 2018 Share Posted November 30, 2018 Nm, I just decided to test it myself and it works . At least that info is there if someone is looking for it. Link to comment Share on other sites More sharing options...
METALmurderer Posted December 2, 2018 Share Posted December 2, 2018 (edited) Nm, I just decided to test it myself and it works . At least that info is there if someone is looking for it. SandyBeaches did comment right after your question, unless it was just 2 ppl posting at once. And ty, cuz this is half of what I came here for --- So I'm trying to increase the stack sizes on feathers and Arrows/Bolts NOT including flaming/exploding I copy pasted the drinkJar from one of the earlier posts as ref, and confirmed it works for the drinkJar items but not the ammo. I even copy/pasted the drinkJar and changed it to the ammoArrow/ammoCrossbow and Flaming/Exploding. Is it because ammoArrowFlaming/ammoCrossbowBoltExploding extend another item instead of being a parent item themselves? And if so, how would I fix it, with an <append> to those specific ones adding their own stack size variable? <set xpath="/items/item[@name='resourceFeather']/property[@name='Stacknumber']/@value">500</set> <set xpath="/items/item[starts-with(@name, 'ammoArrow') and not(contains(@name, 'Flaming'))]/property[@name='Stacknumber']/@value">500</set> <set xpath="/items/item[starts-with(@name, 'ammoCross') and not(contains(@name, 'Exploding'))]/property[@name='Stacknumber']/@value">500</set> <set xpath="/items/item[starts-with(@name, 'drinkJar') and not(contains(@name, 'Empty'))]/property[@name='Stacknumber']/@value">64</set> Edited December 2, 2018 by METALmurderer Adding other reason why I cam here (see edit history) Link to comment Share on other sites More sharing options...
sphereii Posted December 2, 2018 Author Share Posted December 2, 2018 SandyBeaches did comment right after your question, unless it was just 2 ppl posting at once. And ty, cuz this is half of what I came here for --- So I'm trying to increase the stack sizes on feathers and Arrows/Bolts NOT including flaming/exploding I copy pasted the drinkJar from one of the earlier posts as ref, and confirmed it works for the drinkJar items but not the ammo. I even copy/pasted the drinkJar and changed it to the ammoArrow/ammoCrossbow and Flaming/Exploding. Is it because ammoArrowFlaming/ammoCrossbowBoltExploding extend another item instead of being a parent item themselves? And if so, how would I fix it, with an <append> to those specific ones adding their own stack size variable? <set xpath="/items/item[@name='resourceFeather']/property[@name='Stacknumber']/@value">500</set> <set xpath="/items/item[starts-with(@name, 'ammoArrow') and not(contains(@name, 'Flaming'))]/property[@name='Stacknumber']/@value">500</set> <set xpath="/items/item[starts-with(@name, 'ammoCross') and not(contains(@name, 'Exploding'))]/property[@name='Stacknumber']/@value">500</set> <set xpath="/items/item[starts-with(@name, 'drinkJar') and not(contains(@name, 'Empty'))]/property[@name='Stacknumber']/@value">64</set> If an extended item does not have stacknumber, then you'd have to do an append to it, rather than doing a set. <append xpath="//" > <property name="Stacknumber" value="6" /> </append> Link to comment Share on other sites More sharing options...
METALmurderer Posted December 2, 2018 Share Posted December 2, 2018 (edited) If an extended item does not have stacknumber, then you'd have to do an append to it, rather than doing a set. <append xpath="//" > <property name="Stacknumber" value="6" /> </append> Thx sphereii I'll see about appending a stack number in the append section (the sets are beneath the appends for that specific reason) --- Ok so the whole thing currently looks like this <configs> <append xpath="/items"> <!-- snip --> </append> <append xpath="/items/item[@name='ammoArrowFlaming' or @name='ammoCrossbowBoltExploding']/property[@name='Stacknumber']/@value">250</append> <set xpath="/items/item[@name='resourceCement' or @name='resourceConcreteMix']/property[@name='Stacknumber']/@value">6000</set> <set xpath="/items/item[@name='resourceFeather']/property[@name='Stacknumber']/@value">500</set> <set xpath="/items/item[starts-with(@name, 'ammoArrow') and not(contains(@name, 'Flaming'))]/property[@name='Stacknumber']/@value">500</set> <set xpath="/items/item[starts-with(@name, 'ammoCross') and not(contains(@name, 'Exploding'))]/property[@name='Stacknumber']/@value">500</set> </configs> I have also tried separating into 2 separate <append>(s) but I get the same result, but there are no parsing errors and the other parts of the mod work just fine <append xpath="/items/item[@name='ammoArrowFlaming']/property[@name='Stacknumber']/@value">250</append> <append xpath="/items/item[@name='ammoCrossbowBoltExploding']/property[@name='Stacknumber']/@value">250</append> Edited December 2, 2018 by METALmurderer Updating (see edit history) Link to comment Share on other sites More sharing options...
Swiftpaw Posted December 2, 2018 Share Posted December 2, 2018 Thx sphereii I'll see about appending a stack number in the append section (the sets are beneath the appends for that specific reason) --- Ok so the whole thing currently looks like this <configs> <append xpath="/items"> <!-- snip --> </append> <append xpath="/items/item[@name='ammoArrowFlaming' or @name='ammoCrossbowBoltExploding']/property[@name='Stacknumber']/@value">250</append> <set xpath="/items/item[@name='resourceCement' or @name='resourceConcreteMix']/property[@name='Stacknumber']/@value">6000</set> <set xpath="/items/item[@name='resourceFeather']/property[@name='Stacknumber']/@value">500</set> <set xpath="/items/item[starts-with(@name, 'ammoArrow') and not(contains(@name, 'Flaming'))]/property[@name='Stacknumber']/@value">500</set> <set xpath="/items/item[starts-with(@name, 'ammoCross') and not(contains(@name, 'Exploding'))]/property[@name='Stacknumber']/@value">500</set> </configs> I have also tried separating into 2 separate <append>(s) but I get the same result, but there are no parsing errors and the other parts of the mod work just fine <append xpath="/items/item[@name='ammoArrowFlaming']/property[@name='Stacknumber']/@value">250</append> <append xpath="/items/item[@name='ammoCrossbowBoltExploding']/property[@name='Stacknumber']/@value">250</append> Use exportcurrentconfigs in the console to export how all the xml files look after they've been modified by your xpath. Can help to debug! Can you post the before and after of what code you're trying to modify, from what to what? Link to comment Share on other sites More sharing options...
NerdScurvy Posted December 2, 2018 Share Posted December 2, 2018 Is there a way to set a value to an empty string? Throws a null exception when I try the xpath set. Have worked around it by removing the tag and adding it back. <configs> <!-- Remove chainsaw and auger looping sounds --> <remove xpath="/items/item[@name='meleeToolChainsaw']/property[@class='Action0']/property[@name='Sound_start']"/> <remove xpath="/items/item[@name='meleeToolChainsaw']/property[@class='Action0']/property[@name='Sound_repeat']"/> <remove xpath="/items/item[@name='meleeToolChainsaw']/property[@class='Action0']/property[@name='Sound_end']"/> <append xpath="/items/item[@name='meleeToolChainsaw']/property[@class='Action0']"> <property name="Sound_start" value=""/> </append> <remove xpath="/items/item[@name='meleeToolAuger']/property[@class='Action0']/property[@name='Sound_start']"/> <remove xpath="/items/item[@name='meleeToolAuger']/property[@class='Action0']/property[@name='Sound_repeat']"/> <remove xpath="/items/item[@name='meleeToolAuger']/property[@class='Action0']/property[@name='Sound_end']"/> <append xpath="/items/item[@name='meleeToolAuger']/property[@class='Action0']"> <property name="Sound_start" value=""/> </append> </configs> Link to comment Share on other sites More sharing options...
METALmurderer Posted December 2, 2018 Share Posted December 2, 2018 Use exportcurrentconfigs in the console to export how all the xml files look after they've been modified by your xpath. Can help to debug! Can you post the before and after of what code you're trying to modify, from what to what? Pastebin complained my file was too big, so I'll separate it STABLE LAUNCH (but limiting stack size on Flaming Arrow & Exploding Xbow not working): items.xml from my mod test folder: https://pastebin.com/Ybrhajdr items.xml from exportcurrentconfigs (starting from last vanilla item): https://pastebin.com/6jj1qcSM changed item from items.xml from exportcurrentconfigs: https://pastebin.com/gq8nTy4Y If I change the items.xml in the mod test folder to: <configs> <!-- LAZY COPY/PASTE TEMPLATES --> <!-- <property name="" value=""/> --> <append xpath="/items"> <!-- snip --> </append> <append xpath="/items/item[@name='ammoArrowFlaming']><property name="Stacknumber" value="250"/></append> <append xpath="/items/item[@name='ammoCrossbowBoltExploding']><property name="Stacknumber" value="250"/></append> <set xpath="/items/item[@name='resourceCement' or @name='resourceConcreteMix']/property[@name='Stacknumber']/@value">6000</set> <set xpath="/items/item[@name='resourceFeather']/property[@name='Stacknumber']/@value">500</set> <set xpath="/items/item[starts-with(@name, 'ammoArrow') and not(contains(@name, 'Flaming'))]/property[@name='Stacknumber']/@value">500</set> <set xpath="/items/item[starts-with(@name, 'ammoCross') and not(contains(@name, 'Exploding'))]/property[@name='Stacknumber']/@value">500</set> </configs> I get the error in console: ERR Failed loading and parsing XML (items.xml) XmlException: attribute values cannot contain '<' Line 95, position 55. ERR XML Loader. Patching 'items.xml' from mod 'test' failed. NullReferenceException: Object reference not set to an instance of an Object. Sorry for slow response, I keep trying and learning new ways to not do what I want. Link to comment Share on other sites More sharing options...
METALmurderer Posted December 2, 2018 Share Posted December 2, 2018 Is there a way to set a value to an empty string? Throws a null exception when I try the xpath set. Have worked around it by removing the tag and adding it back. <configs> <!-- Remove chainsaw and auger looping sounds --> <remove xpath="/items/item[@name='meleeToolChainsaw']/property[@class='Action0']/property[@name='Sound_start']"/> <remove xpath="/items/item[@name='meleeToolChainsaw']/property[@class='Action0']/property[@name='Sound_repeat']"/> <remove xpath="/items/item[@name='meleeToolChainsaw']/property[@class='Action0']/property[@name='Sound_end']"/> <append xpath="/items/item[@name='meleeToolChainsaw']/property[@class='Action0']"> <property name="Sound_start" value=""/> </append> <remove xpath="/items/item[@name='meleeToolAuger']/property[@class='Action0']/property[@name='Sound_start']"/> <remove xpath="/items/item[@name='meleeToolAuger']/property[@class='Action0']/property[@name='Sound_repeat']"/> <remove xpath="/items/item[@name='meleeToolAuger']/property[@class='Action0']/property[@name='Sound_end']"/> <append xpath="/items/item[@name='meleeToolAuger']/property[@class='Action0']"> <property name="Sound_start" value=""/> </append> </configs> Not sure how to do it with XPath but are you trying to fix the looping idle sound or just make them silent? If just trying to fix the idle bug you can comment out the idle sounds on each (tested on local files and on a server's XML but not local in b199 and it was a temp fix for the looping when not equipped but), still plays the sound when using them. Link to comment Share on other sites More sharing options...
Chump Posted December 2, 2018 Share Posted December 2, 2018 Is there a way to set a value to an empty string? Throws a null exception when I try the xpath set. Have worked around it by removing the tag and adding it back. Since we just got setattribute, I'm hoping that there will be a removeattribute in the near future. I was afraid that omitting the value would cause an exception in the current implementation. Link to comment Share on other sites More sharing options...
Deceptive Pastry Posted December 2, 2018 Share Posted December 2, 2018 (edited) @METALmurderer Looks like you're missing quotes at the end of your first append tags. The error messages are helpful for locating mistakes, in this case "cannot contain '<' Line 95, position 55." Not sure what you're using to edit but Notepad++ shows line numbers on the left side. <append xpath="/items/item[@name='ammoArrowFlaming'][color="#EE82EE"]"[/color]><property name="Stacknumber" value="250"/></append> <append xpath="/items/item[@name='ammoCrossbowBoltExploding'][color="#EE82EE"]"[/color]><property name="Stacknumber" value="250"/></append> Also thank you much Swiftpaw for the exportcurrentconfigs command. I was just wondering earlier today how to view the post-change XMLs. Edited December 2, 2018 by Deceptive Pastry (see edit history) Link to comment Share on other sites More sharing options...
METALmurderer Posted December 2, 2018 Share Posted December 2, 2018 @METALmurderer Looks like you're missing quotes at the end of your first append tags. The error messages are helpful for locating mistakes, in this case "cannot contain '<' Line 95, position 55." Not sure what you're using to edit but Notepad++ shows line numbers on the left side. <append xpath="/items/item[@name='ammoArrowFlaming'][color="#EE82EE"]"[/color]><property name="Stacknumber" value="250"/></append> <append xpath="/items/item[@name='ammoCrossbowBoltExploding'][color="#EE82EE"]"[/color]><property name="Stacknumber" value="250"/></append> Also thank you much Swiftpaw for the exportcurrentconfigs command. I was just wondering earlier today how to view the post-change XMLs. Thanks, I suppose I was just staring at the code too long to miss something that simple... Link to comment Share on other sites More sharing options...
Lord Neophyte Posted December 2, 2018 Share Posted December 2, 2018 is there a way to "replace" an old mesh from a tool with a new only per xpath ? So maybe i have made a new steel pickaxe model and will use it as a replace for the vanilla one possible to change : <property name="Meshfile" value="Items/Tools/pickaxe_steelPrefab"/> to <property name="Meshfile" value="#@modfolder:Resources/meleeToolPickaxeSteel.unity3d?meleeToolPickaxeSteel"/> only ? via modlet ? Link to comment Share on other sites More sharing options...
sphereii Posted December 2, 2018 Author Share Posted December 2, 2018 is there a way to "replace" an old mesh from a tool with a new only per xpath ? So maybe i have made a new steel pickaxe model and will use it as a replace for the vanilla one possible to change : <property name="Meshfile" value="Items/Tools/pickaxe_steelPrefab"/> to <property name="Meshfile" value="#@modfolder:Resources/meleeToolPickaxeSteel.unity3d?meleeToolPickaxeSteel"/> only ? via modlet ? Yup, using <set <set xpath="items/item[@name='toolsPickAxe']/property[@name='Meshfile']/@value">#@modfolder:Resouces/meleeToolPickaxeSteel.unity3d?meleeToolPickaxeSteel</set> that's assuming you have a Mods/YourFolder/Resources/meleeToolPickAxeSteel.unity3d exists. Link to comment Share on other sites More sharing options...
dragonslayer770 Posted December 2, 2018 Share Posted December 2, 2018 hay guy what would the xpath code be to remove the HUDLeftStatBars? Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now