danielspoa Posted November 23, 2018 Share Posted November 23, 2018 hey just came to say this is an amazing topic! Thank you for the help! Link to comment Share on other sites More sharing options...
wolverine576 Posted November 23, 2018 Share Posted November 23, 2018 Khaine did a recipe one, if you need a sample... https://7daystodie.com/forums/showthread.php?95256-Return-of-the-Wood-Log-and-Iron-Spikes-modlet!&p=877958#post877958 Added his Modlet to my researching read. Exciting when things actually work lol Link to comment Share on other sites More sharing options...
JaxTeller718 Posted November 23, 2018 Share Posted November 23, 2018 Running into a slight headache. Anyone know WHY im getting that extra </item> tag at the end of this code? <lootcontainer id="36" count="0,2" size="4,3" sound_open="UseActions/open_suitcase" sound_close="UseActions/close_suitcase" loot_quality_template="baseTemplate"> <item name="drinkJarBoiledWater" count="1" prob="0.15"><!--Attribute "count" replaced by: "JaxTeller718_LessWaterInLoot"--></item> <item group="cannedfood" prob="0.5" /> <item group="junk" /> <item name="meleeToolFlashlight02" prob="0.1" /> <item group="medicine" prob="0.1" /> <item group="weaponsBasicGuns+ammo" prob="0.03" /> <item group="weaponsMelee" prob="0.03" /> <item group="ammo" /> </lootcontainer> here is the xpath im using for that <set xpath="/lootcontainers/lootcontainer[@id='36']/item[@name='drinkJarBoiledWater']/@count">1</set> Link to comment Share on other sites More sharing options...
wolverine576 Posted November 23, 2018 Share Posted November 23, 2018 (edited) How do i add an item to a lootgroup? I want to add the fuellog to loot group Tools, i came up with this <config> <set xpath="/lootgroups/lootgroup[@name='tools']/item[@name='fuellog']/@count">1</set> </config> Edited November 23, 2018 by wolverine576 (see edit history) Link to comment Share on other sites More sharing options...
Guppycur Posted November 23, 2018 Share Posted November 23, 2018 (edited) Running into a slight headache. Anyone know WHY im getting that extra </item> tag at the end of this code? <lootcontainer id="36" count="0,2" size="4,3" sound_open="UseActions/open_suitcase" sound_close="UseActions/close_suitcase" loot_quality_template="baseTemplate"> <item name="drinkJarBoiledWater" count="1" prob="0.15"><!--Attribute "count" replaced by: "JaxTeller718_LessWaterInLoot"--></item> <item group="cannedfood" prob="0.5" /> <item group="junk" /> <item name="meleeToolFlashlight02" prob="0.1" /> <item group="medicine" prob="0.1" /> <item group="weaponsBasicGuns+ammo" prob="0.03" /> <item group="weaponsMelee" prob="0.03" /> <item group="ammo" /> </lootcontainer> here is the xpath im using for that <set xpath="/lootcontainers/lootcontainer[@id='36']/item[@name='drinkJarBoiledWater']/@count">1</set> Compare it to these two examples: <set xpath="/lootcontainers/lootcontainer[@id='62']/@size">7,6</set> <set xpath="/items/item/property[@class='Action0']/property[@name='Magazine_items'][@value='9mmBullet']/@value">9mmBullet,NoAmmo</set> I'm guessing the /item, either needs to be removed or named @item, but I don't really know this stuff yet. Edited November 23, 2018 by Guppycur (see edit history) Link to comment Share on other sites More sharing options...
Guppycur Posted November 23, 2018 Share Posted November 23, 2018 Yeh. Removed. Link to comment Share on other sites More sharing options...
sphereii Posted November 23, 2018 Author Share Posted November 23, 2018 Running into a slight headache. Anyone know WHY im getting that extra </item> tag at the end of this code? <lootcontainer id="36" count="0,2" size="4,3" sound_open="UseActions/open_suitcase" sound_close="UseActions/close_suitcase" loot_quality_template="baseTemplate"> <item name="drinkJarBoiledWater" count="1" prob="0.15"><!--Attribute "count" replaced by: "JaxTeller718_LessWaterInLoot"--></item> <item group="cannedfood" prob="0.5" /> <item group="junk" /> <item name="meleeToolFlashlight02" prob="0.1" /> <item group="medicine" prob="0.1" /> <item group="weaponsBasicGuns+ammo" prob="0.03" /> <item group="weaponsMelee" prob="0.03" /> <item group="ammo" /> </lootcontainer> here is the xpath im using for that <set xpath="/lootcontainers/lootcontainer[@id='36']/item[@name='drinkJarBoiledWater']/@count">1</set> That is valid XML, although it may look a bit weird. The modding hooks inserts that comment after each change. <item name="drinkJarBoiledWater" count="10" prob="0.15" /> is the same as <item name="drinkJarBoiledWater" count="10" prob="0.15" > </item> Just on a single line xml node, a short cut can be used. If it's causing a parsing error, than that is a bug. But otherwise, I'd expect that line to be functionally the same as the others. - - - Updated - - - How do i add an item to a lootgroup? I want to add the fuellog to loot group Tools, i came up with this <config> <set xpath="/lootgroups/lootgroup[@name='tools']/item[@name='fuellog']/@count">1</set> </config> If you want to add a new line, it'd be append <config> <append xpath="/lootgroups/lootgroup[@name='tools']"> <item name="fuellog"' count="1" /> </append> </config> Link to comment Share on other sites More sharing options...
wolverine576 Posted November 23, 2018 Share Posted November 23, 2018 Is this right to add fuellog to multiple groups? <config> <append xpath="/lootgroups/lootgroup[@name='tools']"> <item name="fuellog"' count="1" /> <append xpath="/lootgroups/lootgroup[@name='junk']"> <item name="fuellog"' count="1" /> </append> </config> Link to comment Share on other sites More sharing options...
sphereii Posted November 23, 2018 Author Share Posted November 23, 2018 Is this right to add fuellog to multiple groups? <config> <append xpath="/lootgroups/lootgroup[@name='tools']"> <item name="fuellog"' count="1" /> <append xpath="/lootgroups/lootgroup[@name='junk']"> <item name="fuellog"' count="1" /> </append> </config> Close. You'd need to </append> the first one, before you start working on a different xpath command. Link to comment Share on other sites More sharing options...
wolverine576 Posted November 23, 2018 Share Posted November 23, 2018 So each new addition needs closed? <config> <append xpath="/lootgroups/lootgroup[@name='tools']"> <item name="fuellog"' count="1" /> </append> <append xpath="/lootgroups/lootgroup[@name='junk']"> <item name="fuellog"' count="1" /> </append> </config> Link to comment Share on other sites More sharing options...
sphereii Posted November 23, 2018 Author Share Posted November 23, 2018 So each new addition needs closed? <config> <append xpath="/lootgroups/lootgroup[@name='tools']"> <item name="fuellog"' count="1" /> </append> <append xpath="/lootgroups/lootgroup[@name='junk']"> <item name="fuellog"' count="1" /> </append> </config> Yup! The append looks good. I think your xpath may be a bit off. xpath="/lootcontainers/lootgroup[@name=tools]" may be more accurate, since the loogroup is under the <lootcontainers> node. Link to comment Share on other sites More sharing options...
wolverine576 Posted November 23, 2018 Share Posted November 23, 2018 Yup! The append looks good. I think your xpath may be a bit off. xpath="/lootcontainers/lootgroup[@name=tools]" may be more accurate, since the loogroup is under the <lootcontainers> node. Now im confusd. Containers and groups are in different sections? Add the item to the group, and it goes into the containers? Link to comment Share on other sites More sharing options...
wolverine576 Posted November 23, 2018 Share Posted November 23, 2018 getting error in loot 2018-11-23T10:06:17 34.678 ERR Failed loading and parsing XML (loot.xml): 2018-11-23T10:06:17 34.679 EXC Unexpected token. Name is required here. Line 3, position 29. XmlException: Unexpected token. Name is required here. Line 3, position 29. at Mono.Xml2.XmlTextReader.ReadAttributes (Boolean isXmlDecl) [0x00000] in <filename unknown>:0 at Mono.Xml2.XmlTextReader.ReadStartTag () [0x00000] in <filename unknown>:0 at Mono.Xml2.XmlTextReader.ReadContent () [0x00000] in <filename unknown>:0 at Mono.Xml2.XmlTextReader.Read () [0x00000] in <filename unknown>:0 at System.Xml.XmlTextReader.Read () [0x00000] in <filename unknown>:0 at System.Xml.XmlDocument.ReadNodeCore (System.Xml.XmlReader reader) [0x00000] in <filename unknown>:0 at System.Xml.XmlDocument.ReadNodeCore (System.Xml.XmlReader reader) [0x00000] in <filename unknown>:0 at System.Xml.XmlDocument.ReadNodeCore (System.Xml.XmlReader reader) [0x00000] in <filename unknown>:0 at System.Xml.XmlDocument.ReadNode (System.Xml.XmlReader reader) [0x00000] in <filename unknown>:0 at System.Xml.XmlDocument.Load (System.Xml.XmlReader xmlReader) [0x00000] in <filename unknown>:0 at System.Xml.XmlDocument.LoadXml (System.String xml) [0x00000] in <filename unknown>:0 at XmlFile.toXml (System.String _data, System.String _filename) [0x00000] in <filename unknown>:0 UnityEngine.DebugLogHandler:Internal_LogException(Exception, Object) UnityEngine.DebugLogHandler:LogException(Exception, Object) UnityEngine.Logger:LogException(Exception, Object) UnityEngine.Debug:LogException(Exception) Logger:masterLogException(Exception) Logger:Exception(Exception) Log:Exception(Exception) XmlFile:toXml(String, String) XmlFile:.ctor(String, String, String) XmlPatcher:LoadAndPatchConfig(String) <loadSingleXml>c__Iterator1:MoveNext() UnityEngine.SetupCoroutine:InvokeMoveNext(IEnumerator, IntPtr) (Filename: Line: -1) Link to comment Share on other sites More sharing options...
sphereii Posted November 23, 2018 Author Share Posted November 23, 2018 Now im confusd. Containers and groups are in different sections? Add the item to the group, and it goes into the containers? In loot.xml, the <lootcontainers> is the root XML node. Link to comment Share on other sites More sharing options...
sphereii Posted November 23, 2018 Author Share Posted November 23, 2018 getting error in loot 2018-11-23T10:06:17 34.678 ERR Failed loading and parsing XML (loot.xml): 2018-11-23T10:06:17 34.679 EXC Unexpected token. Name is required here. Line 3, position 29. XmlException: Unexpected token. Name is required here. Line 3, position 29. at Mono.Xml2.XmlTextReader.ReadAttributes (Boolean isXmlDecl) [0x00000] in <filename unknown>:0 at Mono.Xml2.XmlTextReader.ReadStartTag () [0x00000] in <filename unknown>:0 at Mono.Xml2.XmlTextReader.ReadContent () [0x00000] in <filename unknown>:0 at Mono.Xml2.XmlTextReader.Read () [0x00000] in <filename unknown>:0 at System.Xml.XmlTextReader.Read () [0x00000] in <filename unknown>:0 at System.Xml.XmlDocument.ReadNodeCore (System.Xml.XmlReader reader) [0x00000] in <filename unknown>:0 at System.Xml.XmlDocument.ReadNodeCore (System.Xml.XmlReader reader) [0x00000] in <filename unknown>:0 at System.Xml.XmlDocument.ReadNodeCore (System.Xml.XmlReader reader) [0x00000] in <filename unknown>:0 at System.Xml.XmlDocument.ReadNode (System.Xml.XmlReader reader) [0x00000] in <filename unknown>:0 at System.Xml.XmlDocument.Load (System.Xml.XmlReader xmlReader) [0x00000] in <filename unknown>:0 at System.Xml.XmlDocument.LoadXml (System.String xml) [0x00000] in <filename unknown>:0 at XmlFile.toXml (System.String _data, System.String _filename) [0x00000] in <filename unknown>:0 UnityEngine.DebugLogHandler:Internal_LogException(Exception, Object) UnityEngine.DebugLogHandler:LogException(Exception, Object) UnityEngine.Logger:LogException(Exception, Object) UnityEngine.Debug:LogException(Exception) Logger:masterLogException(Exception) Logger:Exception(Exception) Log:Exception(Exception) XmlFile:toXml(String, String) XmlFile:.ctor(String, String, String) XmlPatcher:LoadAndPatchConfig(String) <loadSingleXml>c__Iterator1:MoveNext() UnityEngine.SetupCoroutine:InvokeMoveNext(IEnumerator, IntPtr) (Filename: Line: -1) Can you post your full xml snippet? Link to comment Share on other sites More sharing options...
wolverine576 Posted November 23, 2018 Share Posted November 23, 2018 The full error or modlet? <config> <append xpath="/lootcontainers/lootgroup[@name='tools']"> <item name="fuellog"' count="1" /> </append> <append xpath="/lootcontainers/lootgroup[@name='junk']"> <item name="fuellog"' count="1" /> </append> </config> Link to comment Share on other sites More sharing options...
sphereii Posted November 23, 2018 Author Share Posted November 23, 2018 The full error or modlet? <config> <append xpath="/lootcontainers/lootgroup[@name='tools']"> <item name="fuellog"' count="1" /> </append> <append xpath="/lootcontainers/lootgroup[@name='junk']"> <item name="fuellog"' count="1" /> </append> </config> Found it, I think. You have an extra ' after "fuellog". Link to comment Share on other sites More sharing options...
wolverine576 Posted November 23, 2018 Share Posted November 23, 2018 (edited) Now im getting error fuellog not found. Full error log heres my Items <configs> <append xpath="/items"> <item name="fuelLog"> <property name="Meshfile" value="Items/Misc/sackPrefab"/> <property name="DropMeshfile" value="Items/Misc/sack_droppedPrefab"/> <property name="Material" value="Mwood"/> <property name="HoldType" value="45"/> <property name="Stacknumber" value="50" /> <property name="Weight" value="5"/> <property name="SellableToTrader" value="true"/> <property name="EconomicValue" value="34"/> <property name="FuelValue" value="580" /> <property name="Group" value="Resources,Basics"/> <property name="CraftingSkillGroup" value="craftSkillScience"/> <property name="CraftingIngredientTime" value="0.25"/> </item> </append> </configs> recipes <configs> <append xpath="/recipes"> <recipe name="fuelLog" count="1"> <ingredient name="resourceWood" count="20"/> <ingredient name="resourceTallow" count="1" /> </recipe> </append> </configs> loot <config> <append xpath="/lootcontainers/lootgroup[@name='tools']"> <item name="fuellog" count="1" /> </append> <append xpath="/lootcontainers/lootgroup[@name='junk']"> <item name="fuellog" count="1" /> </append> </config> Ok i fixed it, i didnt have the 2nd L capitalized Edited November 23, 2018 by wolverine576 (see edit history) Link to comment Share on other sites More sharing options...
sphereii Posted November 23, 2018 Author Share Posted November 23, 2018 Now im getting error fuellog not found. Full error log heres my Items <configs> <append xpath="/items"> <item name="fuelLog"> <property name="Meshfile" value="Items/Misc/sackPrefab"/> <property name="DropMeshfile" value="Items/Misc/sack_droppedPrefab"/> <property name="Material" value="Mwood"/> <property name="HoldType" value="45"/> <property name="Stacknumber" value="50" /> <property name="Weight" value="5"/> <property name="SellableToTrader" value="true"/> <property name="EconomicValue" value="34"/> <property name="FuelValue" value="580" /> <property name="Group" value="Resources,Basics"/> <property name="CraftingSkillGroup" value="craftSkillScience"/> <property name="CraftingIngredientTime" value="0.25"/> </item> </append> </configs> recipes <configs> <append xpath="/recipes"> <recipe name="fuelLog" count="1"> <ingredient name="resourceWood" count="20"/> <ingredient name="resourceTallow" count="1" /> </recipe> </append> </configs> loot <config> <append xpath="/lootcontainers/lootgroup[@name='tools']"> <item name="fuellog" count="1" /> </append> <append xpath="/lootcontainers/lootgroup[@name='junk']"> <item name="fuellog" count="1" /> </append> </config> Ok i fixed it, i didnt have the 2nd L capitalized Case matters. Mind your "L" in log. Make sure it's consistent. Link to comment Share on other sites More sharing options...
Dauthiatull Posted November 24, 2018 Share Posted November 24, 2018 ok Im reading it but I just dont get it can someone show me a way to add an xpath mod that will change this line in items.xml <!-- jar from cooking food <property name="Create_item" value="drinkJarEmpty"/> --> to this <property name="Create_item" value="drinkJarEmpty"/> Link to comment Share on other sites More sharing options...
CyrusBlaze Posted November 24, 2018 Share Posted November 24, 2018 Here is a snippet that I used to add it to various food types. I originally did it for each recipe individually, but you can chain some 'or' commands in the name section to add them all at once. <append xpath="/items/item[@name=foodBoiledMeat] /property[@class=Action0]"> <property name="Create_item" value="drinkJarEmpty"/> </append> Link to comment Share on other sites More sharing options...
Dauthiatull Posted November 24, 2018 Share Posted November 24, 2018 Here is a snippet that I used to add it to various food types. I originally did it for each recipe individually, but you can chain some 'or' commands in the name section to add them all at once. <append xpath="/items/item[@name=foodBoiledMeat] /property[@class=Action0]"> <property name="Create_item" value="drinkJarEmpty"/> </append> ok but could you tell me how to do that like I have no clue what Im doing LOL where do I put that what file name and how do I apply it to all items with that line Link to comment Share on other sites More sharing options...
wolverine576 Posted November 24, 2018 Share Posted November 24, 2018 (edited) ok but could you tell me how to do that like I have no clue what Im doing LOL where do I put that what file name and how do I apply it to all items with that line Be more specific. Where do you want the change? You'd probably have to use append to add the line of code to the drinks you want the jar back added to. Edited November 24, 2018 by wolverine576 (see edit history) Link to comment Share on other sites More sharing options...
Sythalin Posted November 24, 2018 Share Posted November 24, 2018 Noob question: Are you able to do a simple operation on a value? From everything I've seen has been hard replacements, but no arithmetic examples. For example: Value = 10, want to increase by 20% <set xpath="/something/somethingelse/@value">*1.2</set> Will this result in 12? Link to comment Share on other sites More sharing options...
sphereii Posted November 24, 2018 Author Share Posted November 24, 2018 Noob question: Are you able to do a simple operation on a value? From everything I've seen has been hard replacements, but no arithmetic examples. For example: Value = 10, want to increase by 20% <set xpath="/something/somethingelse/@value">*1.2</set> Will this result in 12? 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. 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