SandyBeaches Posted November 27, 2018 Share Posted November 27, 2018 Just did a quick bit of digging through the code to see what is implemented. In XmlPatcher, the following functions (and their inputs) are called: case "set": return _targetFile.SetByXPath(attribute, _patchElement, _patchName) > 0; case "setattribute": return _targetFile.SetAttributeByXPath(attribute, _patchElement, _patchName) > 0; case "append": return _targetFile.AppendByXPath(attribute, _patchElement, _patchName) > 0; case "prepend": return _targetFile.PrependByXPath(attribute, _patchElement, _patchName) > 0; case "insertBefore": return _targetFile.InsertBeforeByXPath(attribute, _patchElement, _patchName) > 0; case "insertAfter": return _targetFile.InsertAfterByXPath(attribute, _patchElement, _patchName) > 0; case "remove": return _targetFile.RemoveByXPath(attribute, _patchName) > 0; hope that clears things up! Link to comment Share on other sites More sharing options...
Jugginator Posted November 27, 2018 Share Posted November 27, 2018 So I am diving into this, I'm not all that familiar with XML, but I have been learning Python for a bit. Figured this was way cooler and easier than writing a script to edit stuff. Took my first stab at removing the radiated vultures until the Null Exception is fixed, how did I do? Won't have a chance to test it for a bit. <config> <set xpath="/entitygroups/entity[@name=animalZombieVultureRadiated]/property[@name=prob=]/@value">0.00</set> </config> Link to comment Share on other sites More sharing options...
Buggi Posted November 27, 2018 Share Posted November 27, 2018 Use this @Jugginator: <set xpath="/entitygroups/entitygroup/entity[@name=animalZombieVultureRadiated]/@prob">0.00</set> 1 Link to comment Share on other sites More sharing options...
Jugginator Posted November 27, 2018 Share Posted November 27, 2018 Use this @Jugginator: <set xpath="/entitygroups/entitygroup/entity[@name=animalZombieVultureRadiated]/@prob">0.00</set> Thank you! I was close anyway haha. I see how that goes. Good thing too, going to do horde nigth tomorrow. Link to comment Share on other sites More sharing options...
Deceptive Pastry Posted November 27, 2018 Share Posted November 27, 2018 Do node specifiers have any sort of conditions such as greater/less than, or greater/less than or equal to? Eg. [@value=>=60] Link to comment Share on other sites More sharing options...
sphereii Posted November 27, 2018 Author Share Posted November 27, 2018 Do node specifiers have any sort of conditions such as greater/less than, or greater/less than or equal to? Eg. [@value=>=60] Yes you can, but you'll need to escape them See below: the change willonly happen if the stage is greater than 23 and less than 153. <append xpath='/gamestages/spawner[@name="BloodMoonHorde"]/gamestage[ @stage > 23 and @stage < 153]' > <spawn group="ZombiesNight" num="10" maxAlive="8"/> </append> Link to comment Share on other sites More sharing options...
The-Walking-Dad Posted November 27, 2018 Share Posted November 27, 2018 I forgot what a... joy... modding could be. What's wrong with this? The game tells me something starts with an illegal character. <7DTDmod> <set xpath="/recipes/recipe[@name=foodMeatStew]/ingredient[@name=foodRawMeat]/@count">5</set> </7DTDmod> I am trying to work my way through this thread, full of helpful stuff but there's so much more advanced than the level I'm at... any help appreciated, and I'll keep hammering away at my round hole with my square peg Link to comment Share on other sites More sharing options...
SurvivalUK Posted November 27, 2018 Share Posted November 27, 2018 Can anyone help, i'm trying to reduce the number of opened lootable items but it is not liking the ends-with? Thanks 2018-11-27T21:21:34 12.869 ERR XML loader: Patching 'blockplaceholders.xml' from mod 'Better Balance Mod' failed 2018-11-27T21:21:34 12.869 EXC function ends-with not found <!-- Reduce 'opened' lootable items --> <set xpath="/blockplaceholders/*/block[ends-with(@name, 'Open')]/@prob">.8</set> <set xpath="/blockplaceholders/*/block[ends-with(@name, 'Closed')]/@prob">.2</set> Link to comment Share on other sites More sharing options...
SurvivalUK Posted November 27, 2018 Share Posted November 27, 2018 I forgot what a... joy... modding could be. What's wrong with this? The game tells me something starts with an illegal character. <7DTDmod> <set xpath="/recipes/recipe[@name=foodMeatStew]/ingredient[@name=foodRawMeat]/@count">5</set> </7DTDmod> I am trying to work my way through this thread, full of helpful stuff but there's so much more advanced than the level I'm at... any help appreciated, and I'll keep hammering away at my round hole with my square peg Looked fine and a quick test it worked for me chaning the count to "1". You are adding it to recipes.xml? \mods\modname\config\recipes.xml Link to comment Share on other sites More sharing options...
The-Walking-Dad Posted November 27, 2018 Share Posted November 27, 2018 Looked fine and a quick test it worked for me chaning the count to "1". You are adding it to recipes.xml? \mods\modname\config\recipes.xml I am. I'll have another look tomorrow in case I've done something stupid, but that text there was copy/pasted directly from the recipes.xml file in Mods/7DTDmod/config Link to comment Share on other sites More sharing options...
Ricowan Posted November 28, 2018 Share Posted November 28, 2018 What's wrong with this? The game tells me something starts with an illegal character. <7DTDmod> <set xpath="/recipes/recipe[@name=foodMeatStew]/ingredient[@name=foodRawMeat]/@count">5</set> </7DTDmod> I don't know if the game engine is using a standard XML document model, but normally element names can't start with a number. The have to start with a letter or an underscore. So, "7DTDmod" isn't a legal element name. Link to comment Share on other sites More sharing options...
SurvivalUK Posted November 28, 2018 Share Posted November 28, 2018 I don't know if the game engine is using a standard XML document model, but normally element names can't start with a number. The have to start with a letter or an underscore. So, "7DTDmod" isn't a legal element name. That would explain why when I pasted the <set path...> line into my existing modded files which have a <Better...> element name it worked. Link to comment Share on other sites More sharing options...
sphereii Posted November 28, 2018 Author Share Posted November 28, 2018 I don't know if the game engine is using a standard XML document model, but normally element names can't start with a number. The have to start with a letter or an underscore. So, "7DTDmod" isn't a legal element name. Good eye. I think that's the issue here. The root node can really nearly anything, other than numbers. Link to comment Share on other sites More sharing options...
yosomith Posted November 28, 2018 Share Posted November 28, 2018 Looking to change up the progression of the game, basically what I want to do is change when certain levels of perks become available. Example from: Perception 1 level requirement - 1 2 level requirement - 1 3 level requirement - 1 4 level requirement - 20 5 level requirement - 30 6 level requirement - 40 7 level requirement - 50 etc. Example to: Perception 1 level requirement - 1 2 level requirement - 5 3 level requirement - 10 4 level requirement - 15 5 level requirement - 20 etc. I did similar things to this with a16 but since a17 has moved to xpath I don't really know how to do a whole lot. Link to comment Share on other sites More sharing options...
sphereii Posted November 28, 2018 Author Share Posted November 28, 2018 Can anyone help, i'm trying to reduce the number of opened lootable items but it is not liking the ends-with? Thanks 2018-11-27T21:21:34 12.869 ERR XML loader: Patching 'blockplaceholders.xml' from mod 'Better Balance Mod' failed 2018-11-27T21:21:34 12.869 EXC function ends-with not found <!-- Reduce 'opened' lootable items --> <set xpath="/blockplaceholders/*/block[ends-with(@name, 'Open')]/@prob">.8</set> <set xpath="/blockplaceholders/*/block[ends-with(@name, 'Closed')]/@prob">.2</set> This sounds like a bug in the implementation. I'll report it. Until then, would contains() give you enough uniqueness to make your changes? - - - Updated - - - Looking to change up the progression of the game, basically what I want to do is change when certain levels of perks become available. Example from: Perception 1 level requirement - 1 2 level requirement - 1 3 level requirement - 1 4 level requirement - 20 5 level requirement - 30 6 level requirement - 40 7 level requirement - 50 etc. Example to: Perception 1 level requirement - 1 2 level requirement - 5 3 level requirement - 10 4 level requirement - 15 5 level requirement - 20 etc. I did similar things to this with a16 but since a17 has moved to xpath I don't really know how to do a whole lot. If you show us the XML you want to change, then we can show you how to reference it. Link to comment Share on other sites More sharing options...
yosomith Posted November 28, 2018 Share Posted November 28, 2018 Sorry, didn't think the actual xml was required. I want to change this: <attribute name="attPerception" name_key="attPerceptionName" desc_key="attPerceptionDesc" icon="ui_game_symbol_stealth"> <level_requirements level="1"><requirement name="PlayerLevel" target="self" operation="GTE" value="1" desc_key="reqGenericLevel01"/></level_requirements> <level_requirements level="2"><requirement name="PlayerLevel" target="self" operation="GTE" value="1" desc_key="reqGenericLevel02"/></level_requirements> <level_requirements level="3"><requirement name="PlayerLevel" target="self" operation="GTE" value="1" desc_key="reqGenericLevel03"/></level_requirements> <level_requirements level="4"><requirement name="PlayerLevel" target="self" operation="GTE" value="20" desc_key="reqGenericLevel04"/></level_requirements> <level_requirements level="5"><requirement name="PlayerLevel" target="self" operation="GTE" value="30" desc_key="reqGenericLevel05"/></level_requirements> <level_requirements level="6"><requirement name="PlayerLevel" target="self" operation="GTE" value="40" desc_key="reqGenericLevel06"/></level_requirements> <level_requirements level="7"><requirement name="PlayerLevel" target="self" operation="GTE" value="50" desc_key="reqGenericLevel07"/></level_requirements> <level_requirements level="8"><requirement name="PlayerLevel" target="self" operation="GTE" value="60" desc_key="reqGenericLevel08"/></level_requirements> <level_requirements level="9"><requirement name="PlayerLevel" target="self" operation="GTE" value="80" desc_key="reqGenericLevel09"/></level_requirements> <level_requirements level="10"><requirement name="PlayerLevel" target="self" operation="GTE" value="100" desc_key="reqGenericLevel10"/></level_requirements> To this: <attribute name="attPerception" name_key="attPerceptionName" desc_key="attPerceptionDesc" icon="ui_game_symbol_stealth"> <level_requirements level="1"><requirement name="PlayerLevel" target="self" operation="GTE" value="1" desc_key="reqGenericLevel01"/></level_requirements> <level_requirements level="2"><requirement name="PlayerLevel" target="self" operation="GTE" value="5" desc_key="reqGenericLevel02"/></level_requirements> <level_requirements level="3"><requirement name="PlayerLevel" target="self" operation="GTE" value="10" desc_key="reqGenericLevel03"/></level_requirements> <level_requirements level="4"><requirement name="PlayerLevel" target="self" operation="GTE" value="15" desc_key="reqGenericLevel04"/></level_requirements> <level_requirements level="5"><requirement name="PlayerLevel" target="self" operation="GTE" value="20" desc_key="reqGenericLevel05"/></level_requirements> <level_requirements level="6"><requirement name="PlayerLevel" target="self" operation="GTE" value="25" desc_key="reqGenericLevel06"/></level_requirements> <level_requirements level="7"><requirement name="PlayerLevel" target="self" operation="GTE" value="30" desc_key="reqGenericLevel07"/></level_requirements> <level_requirements level="8"><requirement name="PlayerLevel" target="self" operation="GTE" value="35" desc_key="reqGenericLevel08"/></level_requirements> <level_requirements level="9"><requirement name="PlayerLevel" target="self" operation="GTE" value="40" desc_key="reqGenericLevel09"/></level_requirements> <level_requirements level="10"><requirement name="PlayerLevel" target="self" operation="GTE" value="45" desc_key="reqGenericLevel10"/></level_requirements> I suppose while I'm on this I take it adding additional levels to it would be easy as well? So what I mean is adding this to the end of the code: <level_requirements level="11"><requirement name="PlayerLevel" target="self" operation="GTE" value="50" desc_key="reqGenericLevel10"/></level_requirements> Link to comment Share on other sites More sharing options...
SurvivalUK Posted November 28, 2018 Share Posted November 28, 2018 (edited) Sorry, didn't think the actual xml was required. I want to change this: <snip> Here's the code from my level changes you could tweak; <!-- lower level requirements on progression --> <set xpath="/progression/attributes/attribute[starts-with(@name, 'att')]/level_requirements[@level='4']/requirement[@name='PlayerLevel' and @operation='GTE']/@value">8</set> <set xpath="/progression/attributes/attribute[starts-with(@name, 'att')]/level_requirements[@level='5']/requirement[@name='PlayerLevel' and @operation='GTE']/@value">16</set> <set xpath="/progression/attributes/attribute[starts-with(@name, 'att')]/level_requirements[@level='6']/requirement[@name='PlayerLevel' and @operation='GTE']/@value">24</set> <set xpath="/progression/attributes/attribute[starts-with(@name, 'att')]/level_requirements[@level='7']/requirement[@name='PlayerLevel' and @operation='GTE']/@value">32</set> <set xpath="/progression/attributes/attribute[starts-with(@name, 'att')]/level_requirements[@level='8']/requirement[@name='PlayerLevel' and @operation='GTE']/@value">40</set> <set xpath="/progression/attributes/attribute[starts-with(@name, 'att')]/level_requirements[@level='9']/requirement[@name='PlayerLevel' and @operation='GTE']/@value">50</set> <set xpath="/progression/attributes/attribute[starts-with(@name, 'att')]/level_requirements[@level='10']/requirement[@name='PlayerLevel' and @operation='GTE']/@value">60</set> Edited November 28, 2018 by SurvivalUK (see edit history) Link to comment Share on other sites More sharing options...
SurvivalUK Posted November 28, 2018 Share Posted November 28, 2018 This sounds like a bug in the implementation. I'll report it. Until then, would contains() give you enough uniqueness to make your changes? Thanks sphereii, in the end i extracted the names i wanted and added them line by line. I'll revisit if it turns out the end-with is bugged once fixed. Link to comment Share on other sites More sharing options...
yosomith Posted November 28, 2018 Share Posted November 28, 2018 Here's the code from my level changes you could tweak; <!-- lower level requirements on progression --> <set xpath="/progression/attributes/attribute[starts-with(@name, 'att')]/level_requirements[@level='4']/requirement[@name='PlayerLevel' and @operation='GTE']/@value">8</set> <set xpath="/progression/attributes/attribute[starts-with(@name, 'att')]/level_requirements[@level='5']/requirement[@name='PlayerLevel' and @operation='GTE']/@value">16</set> <set xpath="/progression/attributes/attribute[starts-with(@name, 'att')]/level_requirements[@level='6']/requirement[@name='PlayerLevel' and @operation='GTE']/@value">24</set> <set xpath="/progression/attributes/attribute[starts-with(@name, 'att')]/level_requirements[@level='7']/requirement[@name='PlayerLevel' and @operation='GTE']/@value">32</set> <set xpath="/progression/attributes/attribute[starts-with(@name, 'att')]/level_requirements[@level='8']/requirement[@name='PlayerLevel' and @operation='GTE']/@value">40</set> <set xpath="/progression/attributes/attribute[starts-with(@name, 'att')]/level_requirements[@level='9']/requirement[@name='PlayerLevel' and @operation='GTE']/@value">50</set> <set xpath="/progression/attributes/attribute[starts-with(@name, 'att')]/level_requirements[@level='10']/requirement[@name='PlayerLevel' and @operation='GTE']/@value">60</set> That sets me in the right direction, thanks Link to comment Share on other sites More sharing options...
GG2015 Posted November 28, 2018 Share Posted November 28, 2018 So I keep getting warnings and apply not set, could someone tell me what is wrong with this code? <configs> <set xpath="/entityclasses/entity_class[@name='DroppedLootContainer']/property[@name='TimeStayAfterDeath']/@value">1800</set> </configs> Trying to change from <entity_class name="DroppedLootContainer"> <!-- used after a container block is destroyed --> <property name="Mesh" value="LootContainers/backpack_droppedPrefab"/> <property name="ModelType" value="Custom"/> <property name="Prefab" value="Backpack"/> <property name="Class" value="EntityLootContainer"/> <property name="Parent" value="Backpack"/> <property name="TimeStayAfterDeath" value="60"/> <property name="IsEnemyEntity" value="false"/> <property name="LootListOnDeath" value="4"/> <!-- used to determine container X/Y size --> <property name="Faction" value="none"/> </entity_class> To this. <entity_class name="DroppedLootContainer"> <!-- used after a container block is destroyed --> <property name="Mesh" value="LootContainers/backpack_droppedPrefab"/> <property name="ModelType" value="Custom"/> <property name="Prefab" value="Backpack"/> <property name="Class" value="EntityLootContainer"/> <property name="Parent" value="Backpack"/> <property name="TimeStayAfterDeath" value="1800"/> <property name="IsEnemyEntity" value="false"/> <property name="LootListOnDeath" value="4"/> <!-- used to determine container X/Y size --> <property name="Faction" value="none"/> </entity_class> Link to comment Share on other sites More sharing options...
SurvivalUK Posted November 28, 2018 Share Posted November 28, 2018 So I keep getting warnings and apply not set, could someone tell me what is wrong with this code? <configs> <set xpath="/entityclasses/entity_class[@name='DroppedLootContainer']/property[@name='TimeStayAfterDeath']/@value">1800</set> </configs> You missed the underscore from the entity_classes. From my mod; <!-- Loot and player bag remain for longer --> <set xpath="/entity_classes/entity_class[@name='Backpack']/property[@name='TimeStayAfterDeath']/@value">3600</set> <set xpath="/entity_classes/entity_class[@name='DroppedLootContainer']/property[@name='TimeStayAfterDeath']/@value">240</set> <set xpath="/entity_classes/entity_class[@name='EntityLootContainerRegular']/property[@name='TimeStayAfterDeath']/@value">1200</set> <set xpath="/entity_classes/entity_class[@name='EntityLootContainerStrong']/property[@name='TimeStayAfterDeath']/@value">1200</set> <set xpath="/entity_classes/entity_class[@name='EntityLootContainerBoss']/property[@name='TimeStayAfterDeath']/@value">1200</set> <set xpath="/entity_classes/entity_class[@name='EntityLootContainerBandit']/property[@name='TimeStayAfterDeath']/@value">1200</set> Link to comment Share on other sites More sharing options...
GG2015 Posted November 28, 2018 Share Posted November 28, 2018 ah ok, thanks! Link to comment Share on other sites More sharing options...
dcsobral Posted November 28, 2018 Share Posted November 28, 2018 What's the XPath version supported? Link to comment Share on other sites More sharing options...
The-Walking-Dad Posted November 28, 2018 Share Posted November 28, 2018 I don't know if the game engine is using a standard XML document model, but normally element names can't start with a number. The have to start with a letter or an underscore. So, "7DTDmod" isn't a legal element name. Ha ha! How typical of me. Thank you for that. Link to comment Share on other sites More sharing options...
ragnarock77 Posted November 28, 2018 Share Posted November 28, 2018 What's the XPath version supported? 1.0. Apparently Microsoft did not implement newer versions into the .net framework. 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