Frekton Posted March 7, 2019 Share Posted March 7, 2019 Having a hard time figuring the correct syntax to access the "drop event" so that i can change the value of count. <drop event="Harvest" name="resourceIronFragment" count="49" tag="oreWoodHarvest"/> Link to comment Share on other sites More sharing options...
Ragsy 2145 Posted March 7, 2019 Share Posted March 7, 2019 Hopefully this helps using xpath append its the easiest way to understand xpath syntax The easiest way to make a value change is to first copy the whole block name in this case that way you have all the information in front of you for this block name in blocks.xml terrOreIron <block name="terrOreIron"> <property name="Material" value="Mmetal"/> <property name="MaxDamage" value="1000" /> <property name="Shape" value="Terrain"/> <property name="Mesh" value="terrain"/> <property name="Texture" value="33"/> <property name="ImposterExclude" value="true"/> <drop event="Harvest" name="resourceIronFragment" count="49" tag="oreWoodHarvest"/> <drop event="Harvest" name="resourceRockSmall" count="16" tag="oreWoodHarvest"/> <drop event="Destroy" count="0"/> <drop event="Fall" name="resourceIronFragment" count="39" prob="0.5" stick_chance="0"/> <property name="CanMobsSpawnOn" value="true"/> <property name="FilterTags" value="fterrain"/> <property name="SortOrder1" value="d0l0"/> <property name="SortOrder2" value="0050"/> <property name="DisplayType" value="blockTerrain" /> </block> To change (append) a new value we can specify the blocks xml as root (beginning of path) <append xpath="/blocks" > and then the block name <append xpath="/blocks/block[@name='terrOreIron']"> Then the part you need to alter can be added by referencing the code above in this case you want to change the line <drop event="Harvest" name="resourceIronFragment" count="49" tag="oreWoodHarvest"/> Final code then for a simple append would be <configs> <append xpath="/blocks/block[@name='terrOreIron']"> <drop event="Harvest" name="resourceIronFragment" count="1000" tag="oreWoodHarvest"/> </append> </configs> There is a tutorial on xpath by Sphereii here https://7daystodie.com/forums/showthread.php?93816-XPath-Modding-Explanation-Thread and a video tutorial here https://7daystodie.com/forums/showthread.php?99518-Video-Tutorial-XPath-Modding-in-A17-for-Beginners Link to comment Share on other sites More sharing options...
Frekton Posted March 7, 2019 Author Share Posted March 7, 2019 TY! I was trying to change the 'count' value by using this but I could not get it to work. Could not get it to recognize the "drop" property. <set xpath="/blocks/block[@name='terrOreIron'] Link to comment Share on other sites More sharing options...
Frekton Posted March 7, 2019 Author Share Posted March 7, 2019 Unfortunately this does not work either. It is giving me NRE error. <append xpath="/blocks"> <block name="terrOreIron"> <drop event="Harvest" name="resourceIronFragment" count="1000" tag="oreWoodHarvest"/> </append> It is looking for the </block> before </append> to close the block. But that tells the system to add a block where i want to change a value to a property in an existing block, should i not use <set xpath="/blocks/block[@name=terrOreIron] ? Link to comment Share on other sites More sharing options...
Ragsy 2145 Posted March 7, 2019 Share Posted March 7, 2019 Thats the beaty of xpath there are different ways of doing things you can use 'set' but its much harder to get the syntax right. for example my vehicle code to set camera positions to simulate a first person mode like you get in Debug mode <set xpath="/vehicles/vehicle[@name='vehicleBicycle']/property[@name='cameraDistance' and @value='3, 4.5']/@value">-0.35, -1.55</set> <set xpath="/vehicles/vehicle[@name='vehicleBicycle']/property[@name='cameraTurnRate' and @value='.2, .35']/@value">0.09, 0.25</set> Link to comment Share on other sites More sharing options...
Frekton Posted March 7, 2019 Author Share Posted March 7, 2019 Yeah that's the problem I'm having, I can't figure out the syntax. I guess I'll keep trying Link to comment Share on other sites More sharing options...
Ragsy 2145 Posted March 7, 2019 Share Posted March 7, 2019 Yeah that's the problem I'm having, I can't figure out the syntax. I guess I'll keep trying In order to change values using append sometimes you have to first remove the block and then append it back in to change values , with set its like you are experiencing very difficult to get syntax right first time .. I spotted my own mistake in the append code i gave you and have altered the original post so as not to mislead anyone <configs> <append xpath="/blocks/block[@name='terrOreIron']"> <drop event="Harvest" name="resourceIronFragment" count="1000" tag="oreWoodHarvest"/> </append> </configs> Link to comment Share on other sites More sharing options...
Ragsy 2145 Posted March 7, 2019 Share Posted March 7, 2019 I ran the game up and used exportcurrentconfigs in the F1 console to see if this worked and it does in the blocks.xml there is this message about the modlet applying the change to the element. <drop event="Harvest" name="resourceIronFragment" count="1000" tag="oreWoodHarvest"><!--Element appended by: "Zorecount"--></drop> Link to comment Share on other sites More sharing options...
DukeW74 Posted March 7, 2019 Share Posted March 7, 2019 This is untested but should work, assuming you are trying to change the Harvest amount of iron from an iron node, its set at 100 <set xpath="/blocks/block[@name='terrOreIron']/drop[@event='Harvest'][@name='resourceIronFragment']/@count">100</set> Link to comment Share on other sites More sharing options...
Frekton Posted March 7, 2019 Author Share Posted March 7, 2019 I ran the game up and used exportcurrentconfigs in the F1 console to see if this worked and it does in the blocks.xml there is this message about the modlet applying the change to the element. <drop event="Harvest" name="resourceIronFragment" count="1000" tag="oreWoodHarvest"><!--Element appended by: "Zorecount"--></drop> This did add a new line to the block i was trying to edit, but in reality if i wanted to lower the count it wouldn't work. Thank you for trying to help. - - - Updated - - - This is untested but should work, assuming you are trying to change the Harvest amount of iron from an iron node, its set at 100 <set xpath="/blocks/block[@name='terrOreIron']/drop[@event='Harvest'][@name='resourceIronFragment']/@count">100</set> Lol that's that the trick , I hate it when it's so simple. I was doing @value">10/set> instead of /@count">10</set Link to comment Share on other sites More sharing options...
Ragsy 2145 Posted March 7, 2019 Share Posted March 7, 2019 This is untested but should work, assuming you are trying to change the Harvest amount of iron from an iron node, its set at 100 <set xpath="/blocks/block[@name='terrOreIron']/drop[@event='Harvest'][@name='resourceIronFragment']/@count">100</set> Does work DukeW74. Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.