Dimpy Posted July 10, 2018 Share Posted July 10, 2018 Hey, I've been trying to use an adapted version of the Tutorial mod to make small stones into a tool, but I think I have been getting the syntax wrong. Can anyone help fix this code? <configs> <!-- This tells SDX to add to the items.xml --> <config name="items"> <!-- This tells SDX to add the following item to the bottom of the item list --> <set xpath= "/items/item[@name=rockSmall]"> <property name="Meshfile" value="Items/Crafting/rock_smallPrefab"/> <property name="Material" value="stone"/> <property name="HoldType" value="40"/> <property name="Stacknumber" value="5000"/> <!-- STK resource --> <property name="RepairAmount" value="300"/> <property name="Weight" value="5"/> <property name="EconomicValue" value="5"/> <property name="EconomicBundleSize" value="50"/> <property class="Action0"> <property name="Class" value="Melee"/> <property name="Delay" value="1.1"/> <property name="Range" value="2.5"/> <property name="DamageEntity" value="5"/> <property name="DamageBlock" value="15"/> <property name="Sphere" value="0.1"/> <property name="Block_range" value="2.5"/> <property name="Sound_start" value="swoosh"/> <property name="Stamina_usage" value="2.7"/> <property name="DamageBonus.head" value="3.5"/> <property name="DamageBonus.glass" value="0.42"/> <property name="DamageBonus.wood" value="0.6"/> <property name="DamageBonus.earth" value="0.3083"/> <property name="DamageBonus.stone" value="0.625"/> <property name="DamageBonus.metal" value="0.4167"/> <property name="DamageBonus.organic" value="1.3"/> <property name="ToolCategory.harvestingTools" value="1" param1="1"/> <property name="ToolCategory.Butcher" value="0.5" param1="3.5"/> <property name="Sound_harvesting" value="open_animal" param1="organic" /> <property name="ActionExp" value="0.5"/> </property> <property class="Action1"> <!-- right click --> <property name="Class" value="ThrowAway"/> <property name="Delay" value="1.2"/> <property name="Throw_strength_default" value="8"/> <property name="Throw_strength_max" value="25"/> <property name="Max_strain_time" value="1.5"/> <property name="Sound_start" value="swoosh"/> </property> <property name="ThrowableDecoy" value="true"/> <property name="DropScale" value="3"/> <property name="Group" value="Resources"/> <property name="CraftingIngredientTime" value="0.5"/> </set> </config> </configs> Link to comment Share on other sites More sharing options...
sphereii Posted July 10, 2018 Share Posted July 10, 2018 Hey, I've been trying to use an adapted version of the Tutorial mod to make small stones into a tool, but I think I have been getting the syntax wrong. Can anyone help fix this code? <configs> <!-- This tells SDX to add to the items.xml --> <config name="items"> <!-- This tells SDX to add the following item to the bottom of the item list --> <set xpath= "/items/item[@name=rockSmall]"> <property name="Meshfile" value="Items/Crafting/rock_smallPrefab"/> <property name="Material" value="stone"/> <property name="HoldType" value="40"/> <property name="Stacknumber" value="5000"/> <!-- STK resource --> <property name="RepairAmount" value="300"/> <property name="Weight" value="5"/> <property name="EconomicValue" value="5"/> <property name="EconomicBundleSize" value="50"/> <property class="Action0"> <property name="Class" value="Melee"/> <property name="Delay" value="1.1"/> <property name="Range" value="2.5"/> <property name="DamageEntity" value="5"/> <property name="DamageBlock" value="15"/> <property name="Sphere" value="0.1"/> <property name="Block_range" value="2.5"/> <property name="Sound_start" value="swoosh"/> <property name="Stamina_usage" value="2.7"/> <property name="DamageBonus.head" value="3.5"/> <property name="DamageBonus.glass" value="0.42"/> <property name="DamageBonus.wood" value="0.6"/> <property name="DamageBonus.earth" value="0.3083"/> <property name="DamageBonus.stone" value="0.625"/> <property name="DamageBonus.metal" value="0.4167"/> <property name="DamageBonus.organic" value="1.3"/> <property name="ToolCategory.harvestingTools" value="1" param1="1"/> <property name="ToolCategory.Butcher" value="0.5" param1="3.5"/> <property name="Sound_harvesting" value="open_animal" param1="organic" /> <property name="ActionExp" value="0.5"/> </property> <property class="Action1"> <!-- right click --> <property name="Class" value="ThrowAway"/> <property name="Delay" value="1.2"/> <property name="Throw_strength_default" value="8"/> <property name="Throw_strength_max" value="25"/> <property name="Max_strain_time" value="1.5"/> <property name="Sound_start" value="swoosh"/> </property> <property name="ThrowableDecoy" value="true"/> <property name="DropScale" value="3"/> <property name="Group" value="Resources"/> <property name="CraftingIngredientTime" value="0.5"/> </set> </config> </configs> The SDX <set> allows you to change individual attributes that already exists. It's a single line. <set xpath="/items/item/[@name='rockSmall']/property[@name='HoldType']/@value">40</set> To add new attributes and properties, you'll wand to use <append> <append xpath="/items/item/[@name='rockSmall']"> <property name="ThrowableDecoy" value="true"/> <property name="DropScale" value="3"/> <property name="CraftingIngredientTime" value="0.5"/> </append> By the looks of it, to change the smallrock to a weapon, you'll need a combination of <set> to change existing values, and <append> to add new lines. It'd look similar to this, with more <set> to change all the other non-existing values. <set xpath="/items/item/[@name='rockSmall']/property[@name='HoldType']/@value">40</set> <append xpath="/items/item/[@name='rockSmall']"> <property name="ThrowableDecoy" value="true"/> <property name="DropScale" value="3"/> <property name="CraftingIngredientTime" value="0.5"/> </append> Another way you can do it, is by removing the small rock, using the <remove> xpath command. Then <append> an entirely new item with the same name. <remove xpath="/items/item/[@name='rockSmall']" /> <append xpath="/items" > <item name="smallRock" > <all other values> </item> </append> Link to comment Share on other sites More sharing options...
Dimpy Posted July 11, 2018 Author Share Posted July 11, 2018 Yeah, I didn't realize that set was single line only. I tried the remove and append strategy, but I got an error in the build menu that said: Apply mod config patch: Primative building Applying patch: SDX0.7.1/Targets\7DaysToDie\Mods\Dimpy's Mod\Config\stoneTool2.xml... ERROR: Expression must evaluate to a node-set. EVENT: Run sub task: Run Xml Patcher mod scripts WARN: No assembly from BuildAndRunPatchModsTask Here is my new code: <configs> <config name = "items"> <remove xpath="/items/item/[@name='rockSmall']" /> <append xpath="/items" > <item id="190" name="rockSmall"> <!-- scrap material --> <property name="Meshfile" value="Items/Crafting/rock_smallPrefab"/> <property name="Material" value="stone"/> <property name="HoldType" value="40"/> <property name="Stacknumber" value="5000"/> <!-- STK resource --> <property name="RepairAmount" value="300"/> <property name="Weight" value="5"/> <property name="EconomicValue" value="5"/> <property name="EconomicBundleSize" value="50"/> <property class="Action0"> <property name="Class" value="Melee"/> <property name="Delay" value="1.1"/> <property name="Range" value="2.5"/> <property name="DamageEntity" value="5"/> <property name="DamageBlock" value="15"/> <property name="Sphere" value="0.1"/> <property name="Block_range" value="2.5"/> <property name="Sound_start" value="swoosh"/> <property name="Stamina_usage" value="2.7"/> <property name="DamageBonus.head" value="3.5"/> <property name="DamageBonus.glass" value="0.42"/> <property name="DamageBonus.wood" value="0.6"/> <property name="DamageBonus.earth" value="0.3083"/> <property name="DamageBonus.stone" value="0.625"/> <property name="DamageBonus.metal" value="0.4167"/> <property name="DamageBonus.organic" value="1.3"/> <property name="ToolCategory.harvestingTools" value="1" param1="1"/> <property name="ToolCategory.Butcher" value="0.5" param1="3.5"/> <property name="Sound_harvesting" value="open_animal" param1="organic" /> <property name="ActionExp" value="0.5"/> </property> <property class="Action1"> <!-- right click --> <property name="Class" value="ThrowAway"/> <property name="Delay" value="1.2"/> <property name="Throw_strength_default" value="8"/> <property name="Throw_strength_max" value="25"/> <property name="Max_strain_time" value="1.5"/> <property name="Sound_start" value="swoosh"/> </property> <property name="ThrowableDecoy" value="true"/> <property name="DropScale" value="3"/> <property name="Group" value="Resources"/> <property name="CraftingIngredientTime" value="0.5"/> </item> </append> </config> </configs> Link to comment Share on other sites More sharing options...
sphereii Posted July 11, 2018 Share Posted July 11, 2018 try: <remove xpath="/items/item[@name='rockSmall']" /> Notice the missing slash between the item and [ Link to comment Share on other sites More sharing options...
Alloc Posted July 11, 2018 Share Posted July 11, 2018 Think the last / is wrong in the remove, AFAIK it should be "/items/item[@name=rockSmall]". Also, set does allow multiple elements to be set, but it will always replace the whole element's contents with whatever you have which might not always be desired. In this case I'm pretty sure though that using a single set-statement (with your XPATH value) should work instead of remove+append. /EDIT: Oh heh, should've refreshed before replying in a tab that was open for quite some time now Link to comment Share on other sites More sharing options...
Dimpy Posted July 11, 2018 Author Share Posted July 11, 2018 Okay, I removed the backslash, and now the stone has disappeared from the creative menu, rather than being the vanilla stone. Am I missing values in the append code that are needed for it to appear there? Link to comment Share on other sites More sharing options...
Dimpy Posted July 11, 2018 Author Share Posted July 11, 2018 Also the crafting menu is broken. Link to comment Share on other sites More sharing options...
sphereii Posted July 12, 2018 Share Posted July 12, 2018 Also the crafting menu is broken. Sounds like something broke your XML. Do you have your output_log.txt, or your items.xml? We can help you troubleshoot it. Link to comment Share on other sites More sharing options...
DUST2DEATH Posted July 12, 2018 Share Posted July 12, 2018 Sounds like something broke your XML. Do you have your output_log.txt, or your items.xml? We can help you troubleshoot it. maybe 0.7.2 needed? Link to comment Share on other sites More sharing options...
Dimpy Posted July 12, 2018 Author Share Posted July 12, 2018 Here's the log [ATTACH]24704[/ATTACH][ATTACH]24704[/ATTACH]output log.txt Link to comment Share on other sites More sharing options...
Dimpy Posted July 12, 2018 Author Share Posted July 12, 2018 So I just did a build with the katana mod instead an it's fine, no issues. Link to comment Share on other sites More sharing options...
Dimpy Posted July 12, 2018 Author Share Posted July 12, 2018 I just pasted the original XML data of the small stone into the mod and it also works fine. I'm guessing it has to do with the settings. Can anyone see problems with the settings I had in the code I posted preveiosly? Mod with vanilla stone settings that works: <configs> <config name = "items"> <remove xpath="/items/item[@name='rockSmall']" /> <append xpath="/items" > <item id="190" name="rockSmall"> <!-- scrap material --> <property name="Meshfile" value="Items/Crafting/rock_smallPrefab"/> <property name="Material" value="stone"/> <property name="HoldType" value="40"/> <property name="Stacknumber" value="6000"/> <!-- STK resource --> <property name="RepairAmount" value="300"/> <property name="Weight" value="5"/> <property name="EconomicValue" value="5"/> <property name="EconomicBundleSize" value="50"/> <property class="Action0"> <!-- AttackAction --> <property name="Class" value="ThrowAway"/> <property name="Delay" value="1.2"/> <property name="Throw_strength_default" value="8"/> <property name="Throw_strength_max" value="25"/> <property name="Max_strain_time" value="1.5"/> <property name="Sound_start" value="swoosh"/> </property> <property name="ThrowableDecoy" value="true"/> <property name="DropScale" value="3"/> <property name="Group" value="Resources"/> <property name="CraftingIngredientTime" value="0.5"/> </item> </append> </config> </configs> Link to comment Share on other sites More sharing options...
sphereii Posted July 12, 2018 Share Posted July 12, 2018 Thanks for the logs. Everything looks fine there. Would you mind starting the game, then sending us the 7DaysToDie_Data/output_log.txt? Link to comment Share on other sites More sharing options...
Dimpy Posted July 12, 2018 Author Share Posted July 12, 2018 Here it is. This is the version without the stoneTool config. [ATTACH]24705[/ATTACH]output_log.txt Link to comment Share on other sites More sharing options...
sphereii Posted July 12, 2018 Share Posted July 12, 2018 Here it is. This is the version without the stoneTool config. [ATTACH]24705[/ATTACH] Thank you for your patience! It can be frustrating starting out. I didn't see anything in the log. Could you repeat the test, and start a game with it, then repost the log? Also, if you could post your items.xml, that would help too. Link to comment Share on other sites More sharing options...
Dimpy Posted July 12, 2018 Author Share Posted July 12, 2018 Here's one with the stoneTool config, which is the problematic one. I redacted some parts of the file paths in my text editor. [ATTACH]24706[/ATTACH]output_log.txt Link to comment Share on other sites More sharing options...
Dimpy Posted July 12, 2018 Author Share Posted July 12, 2018 I tried to upload the items.xml, but the forums would let me, saying it was an invalid file. I don't think there will be anything of interest there since I didn't touch the file at all. Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.