Jump to content

XPath Modding Explanation Thread


sphereii

Recommended Posts

In an attempt to lower melee damage with decreasing stamina, I adapted a part of the game code, but it doesn't seem to work. This is what I tried:

<append xpath="/buffs/buff[@name='buffStatusCheck01']/effect_group">
	<passive_effect name="EntityDamage" operation="perc_add" value="-.05" tags="melee">
		<requirement name="StatComparePercModMaxToMax" stat="Stamina" operation="LT" value="0.9"/>
	</passive_effect>
	<passive_effect name="EntityDamage" operation="perc_add" value="-.06" tags="melee">
		<requirement name="StatComparePercModMaxToMax" stat="Stamina" operation="LT" value="0.8"/>
	</passive_effect>
	<passive_effect name="EntityDamage" operation="perc_add" value="-.07" tags="melee">
		<requirement name="StatComparePercModMaxToMax" stat="Stamina" operation="LT" value="0.7"/>
	</passive_effect>
	<passive_effect name="EntityDamage" operation="perc_add" value="-.08" tags="melee">
		<requirement name="StatComparePercModMaxToMax" stat="Stamina" operation="LT" value="0.6"/>
	</passive_effect>
	<passive_effect name="EntityDamage" operation="perc_add" value="-.09" tags="melee">
		<requirement name="StatComparePercModMaxToMax" stat="Stamina" operation="LT" value="0.5"/>
	</passive_effect>
	<passive_effect name="EntityDamage" operation="perc_add" value="-.1" tags="melee">
		<requirement name="StatComparePercModMaxToMax" stat="Stamina" operation="LT" value="0.4"/>
	</passive_effect>
	<passive_effect name="EntityDamage" operation="perc_add" value="-.1" tags="melee">
		<requirement name="StatComparePercModMaxToMax" stat="Stamina" operation="LT" value="0.3"/>
	</passive_effect>
	<passive_effect name="EntityDamage" operation="perc_add" value="-.1" tags="melee">
		<requirement name="StatComparePercModMaxToMax" stat="Stamina" operation="LT" value="0.2"/>
	</passive_effect>
	<passive_effect name="EntityDamage" operation="perc_add" value="-.1" tags="melee">
		<requirement name="StatComparePercModMaxToMax" stat="Stamina" operation="LT" value="0.1"/>
	</passive_effect>
</append>

The part is used in "Being at low health increases the chance of getting hit by a critical effect" in the buff.xml, but here nothing happens. I tried to set the penalty to -.9 for all for testing purposes, but still no effect. Does anyone have an idea why, or can offer a solution that works as intended?

Link to comment
Share on other sites

  • 3 weeks later...
On 8/3/2023 at 2:00 AM, JaxTeller718 said:

How would i go about adding a zombie to each entitygroup. Say I wanted to add zombieSpecialScreamer to every scout group?

 

    <!-- To add to an existing group, spread it over multiple lines -->
    <csv xpath="/entitygroups/entitygroup[@name='ZombiesAll']/text()" delim="\n" op="add" >
        zombieFatHawaiian2, .3
        zombieFatHawaiian3, .3
        zombieFatHawaiian4, .3
        zombieFatHawaiian5, .3
    </csv>
Link to comment
Share on other sites

Thanks so much Sphereii and everyone else. Thanks BFT2020 for pointing me over here. I was able to get my vultures mod to work again. I played it safe by doing a remove/add but wondering if it can be simplified.

	<csv xpath="/entitygroups/entitygroup[@name='EnemyAnimalsDesert']/text()" delim="\n" op="remove" >
		animalZombieVulture*
		none*
	</csv>
	<csv xpath="/entitygroups/entitygroup[@name='EnemyAnimalsDesert']/text()" delim="\n" op="add" >none, 40</csv>
	<csv xpath="/entitygroups/entitygroup[@name='EnemyAnimalsWasteland']/text()" delim="\n" op="remove" >
		animalZombieVulture*
		none*
	</csv>
	<csv xpath="/entitygroups/entitygroup[@name='EnemyAnimalsWasteland']/text()" delim="\n" op="add" >none, 60</csv>
	<csv xpath="/entitygroups/entitygroup[@name='ZombiesWastelandNightNoBears']/text()" delim="\n" op="remove" >animalZombieVulture*</csv>
	<csv xpath="/entitygroups/entitygroup[@name='ZombiesWastelandNight2']/text()" delim="\n" op="remove" >animalZombieVulture*</csv>

 

My real problem is conditionals. Getting the usual unhelpful invalid token.

	<csv xpath="/entitygroups/entitygroup[not contains(@name, 'zombieSpider*')and contains(text(), 'zombieSpider*'))]" delim="\n" op="remove" >zombieSpider*</csv>
	<csv xpath="/entitygroups/entitygroup[contains(@name, 'horde')and contains(text(), 'zombieSpider*'))]" delim="\n" op="remove" >zombieSpider*</csv>
	<csv xpath="/entitygroups/entitygroup[contains(@name, 'horde')and contains(text(), 'animalZombieDog*'))]" delim="\n" op="remove" >animalZombieDog*</csv>
	<csv xpath="/entitygroups/entitygroup[contains(@name, 'horde')and contains(text(), 'zombieSteveCrawler*'))]" delim="\n" op="remove" >zombieSteveCrawler*</csv>
	<csv xpath="/entitygroups/entitygroup[contains(@name, 'horde')and contains(text(), 'animalZombieVulture*'))]" delim="\n" op="remove" >animalZombieVulture*</csv>

I'm sure it is something simple I'm missing. the goal here is to remove the selected zeds from any horde and in addition I want to remove spiders from everything except their base entry and POI groups.

 

I changed it to this (among many other failed attempts)

<!--	<csv xpath="/entitygroups/entitygroup[not contains(@name, 'zombieSpider*')]/text()" delim="\n" op="remove" >zombieSpider*</csv> -->
	<csv xpath="/entitygroups/entitygroup[contains(@name, 'horde')]/text()" delim="\n" op="remove">zombieSpider*</csv>
	<csv xpath="/entitygroups/entitygroup[contains(@name, 'horde')]/text()" delim="\n" op="remove">animalZombieDog*</csv>
	<csv xpath="/entitygroups/entitygroup[contains(@name, 'horde')]/text()" delim="\n" op="remove">animalZombieDog*</csv>
	<csv xpath="/entitygroups/entitygroup[contains(@name, 'horde')]/text()" delim="\n" op="remove">animalZombieVulture*</csv>

and the error log gives me

2023-08-05T10:20:38 35.314 WRN XML patch for "entitygroups.xml" from mod "Krougal_HordeNoDogNoSpider" did not apply: <csv xpath="/entitygroups/entitygroup[contains(@name, 'horde')]/text()" delim="\n" op="remove"  (line 3 at pos 3)
2023-08-05T10:20:38 35.315 WRN XML patch for "entitygroups.xml" from mod "Krougal_HordeNoDogNoSpider" did not apply: <csv xpath="/entitygroups/entitygroup[contains(@name, 'horde')]/text()" delim="\n" op="remove"  (line 4 at pos 3)
2023-08-05T10:20:38 35.316 WRN XML patch for "entitygroups.xml" from mod "Krougal_HordeNoDogNoSpider" did not apply: <csv xpath="/entitygroups/entitygroup[contains(@name, 'horde')]/text()" delim="\n" op="remove"  (line 5 at pos 3)
2023-08-05T10:20:38 35.317 WRN XML patch for "entitygroups.xml" from mod "Krougal_HordeNoDogNoSpider" did not apply: <csv xpath="/entitygroups/entitygroup[contains(@name, 'horde')]/text()" delim="\n" op="remove"  (line 6 at pos 3)

as opposed to the commented out line, which gave me invalid token.

 

OH FFS! So it is Horde not horde! I had a few other little issues, and I had a couple other tiny errors. Working code  in a minute when I fix 1 issue on the

spider line.

 

	<csv xpath="/entitygroups/entitygroup[not(contains(@name, 'zombieSpider*'))]/text()" delim="\n" op="remove" >zombieSpider*</csv>
	<csv xpath="/entitygroups/entitygroup[contains(@name, 'Horde')]/text()" delim="\n" op="remove">zombieSpider*</csv>
	<csv xpath="/entitygroups/entitygroup[contains(@name, 'Horde')]/text()" delim="\n" op="remove">animalZombieDog*</csv>
	<csv xpath="/entitygroups/entitygroup[contains(@name, 'Horde')]/text()" delim="\n" op="remove">animalZombieDog*</csv>
	<csv xpath="/entitygroups/entitygroup[contains(@name, 'Horde')]/text()" delim="\n" op="remove">animalZombieVulture*</csv>

 

FFS(again) always check your output, because even though it stopped erroring (mostly) the group name filter is not working on any of them. 

I am really at a loss.

 

So mostly got it. The secret sauce seems to be you still need "@name="

I am still trying to get the "not" to work though. Also condensed the 4 Horde entries into 1.

	<csv xpath="/entitygroups/entitygroup[@name=not'(contains(@name, 'zombieSpider*'))']/text()" delim="\n" op="remove" >zombieSpider*</csv>
	<csv xpath="/entitygroups/entitygroup[@name='contains(@name, 'Horde')']/text()" delim="\n" op="remove">
		zombieSpider*
		animalZombieDog*
		zombieSteveCrawler*
		animalZombieVulture*
	</csv>

 

Results are still very inconsistent. It also logs the modified tag repeatedly on the same line. I'm thinking I need to delete the configsdump between runs? I do fully shutdown and restart the game between edits. Very frustrating.

 

Ok, it looks like I figured it out. More or less, there are a couple groups that still have zombieSpider that should not. Namely the biome groups.

	<csv xpath="/entitygroups/entitygroup[contains(@name, 'Horde')]/text()" delim="\n" op="remove">
		zombieSpider*
		animalZombieDog*
		animalSteveCrawler*
		animalZombieVulture*
	</csv>
	<csv xpath="/entitygroups/entitygroup[not(contains(@name, 'zombieSpider*'))]/text()" delim="\n" op="remove" >zombieSpider*</csv> -->

Oh, FF! So I had forgotten the close comment (-->) at the end of the spider line (I moved it to last so it didn't prevent the rest of the script working) so it was erroring and not applying at all, I just missed it somehow. Fixing that, I am back to it is removing everything, which of course throws errors from spawning.xml because of the empty groups (which I don't want those groups emptied).

 

Well @%$# me! It was the *. Originally I was trying to do it with a setxpath and a wildcard for the groupname and I forgot to remove it with the contains.

Now the next issue is it is touching every stinking group and leaving a comment, even though it is benign it irks me. I need to make a tighter filter.

    <csv xpath="/entitygroups/entitygroup[not(contains(@name, 'zombieSpider'))and contains(text(), 'zombieSpider' )]/text()" delim="\n" op="remove" >zombieSpider*</csv>
 

<csv xpath="/entitygroups/entitygroup[not(contains(@name, 'zombieSpider'))and contains(text(), 'zombieSpider' )]/text()" delim="\n" op="remove" >zombieSpider*</csv>

And now it does exactly what I want. So it looks for all groups that have zombieSpiders of any subtype or quantity as long as the groupname doesn't include zombieSpider. This is important, otherwise we have to edit the spawning.xml to remove the mob entirely, which if that is your intent is fine, but I wanted to keep the base entity and the POI groups intact (I like the POIs enough that I want to experience them as intended, but an excess of certain mobs annoy me and spiders really annoy me) I will leave all this in case it helps someone else. If I was feeling brave I could remove the zombieSpider from the horde entry and this should take care of it as well.

 

 

Edited by Krougal (see edit history)
Link to comment
Share on other sites

On 8/9/2023 at 7:43 PM, Iceburg71 said:

with the csv xpath, is there a "modify" command or just add and remove.  all I want to do is modify a current value from "animalChicken, 15" to "animalChicken, 6"

 

how can I do that?  either with or without using csv commands???

The entitygroups.xml is different from the other xml files in A21 in that the csv method has to be used to make modifications beyond simple append or remove. I know it was a jumbled mess as I edited it every time I checked back here since I figured it out myself before I ever got any help (sometimes that's just the way it is) but that was pretty much me struggling to figure out how to port my mod from A20. Anyway, here is a clearer example:

<Krougal>

	<csv xpath="/entitygroups/entitygroup[@name='EnemyAnimalsDesert']/text()" delim="\n" op="remove" >
		animalZombieVulture*
		none*
	</csv>
	<csv xpath="/entitygroups/entitygroup[@name='EnemyAnimalsDesert']/text()" delim="\n" op="add" >none, 40</csv>
	<csv xpath="/entitygroups/entitygroup[@name='EnemyAnimalsWasteland']/text()" delim="\n" op="remove" >
		animalZombieVulture*
		none*
	</csv>
	<csv xpath="/entitygroups/entitygroup[@name='EnemyAnimalsWasteland']/text()" delim="\n" op="add" >none, 60</csv>
	<csv xpath="/entitygroups/entitygroup[@name='ZombiesWastelandNightNoBears']/text()" delim="\n" op="remove" >animalZombieVulture*</csv>
	<csv xpath="/entitygroups/entitygroup[@name='ZombiesWastelandNight2']/text()" delim="\n" op="remove" >animalZombieVulture*</csv>

</Krougal>

 

And another:

<Krougal>

	<csv xpath="/entitygroups/entitygroup[contains(@name, 'Horde')]/text()" delim="\n" op="remove">
		zombieSpider*
		animalZombieDog*
		animalSteveCrawler*
		animalZombieVulture*
	</csv>
	<csv xpath="/entitygroups/entitygroup[not(contains(@name, 'zombieSpider'))and contains(text(), 'zombieSpider' )]/text()" delim="\n" op="remove" >zombieSpider*</csv>
	
</Krougal>

Depending exactly how you want to accomplish it, there are different ways for you to filter it, but I think that is a pretty good mix of a few ways to skin that cat chicken.

 

Link to comment
Share on other sites

I'm being dumb again and got stuck .

trying to use insertafter to add lines when drinking a bottle of murkywater,

Using this basic line, but it's not working

<insertAfter xpath="/items/item[@name='drinkJarRiverWater']/effect_group[@tiered='false']">

probably because the orginal line <effect_group tiered="false" name="Drink Tier 0"> has the extra name="Drink Tier 0"

How should I get the path right here?

Link to comment
Share on other sites

  • 3 weeks later...

Hello I am trying to learn how to make small changes to make a harder game for me and my brothers but i cant for the life of me figure out how to remove specific quest rewards using xpath specifically all the weapons ,ammo ,armor basically anything that gives a complete item that can be crafted. I have pretty much no experience with this just started learning last night so any help would be greatly appreciated

 

Edit for progress. so i stopped receiving errors but i got a yellow console message saying that the changes didnt load this is the code i tried

<remove xpath="//lootgroup[@name='groupQuestAmmo']"/> 

 

Edit 2: i managed to get it to remove the stuff i wanted except when they are included in a reward choice that can be different things for example

<reward type="LootItem" id="groupQuestAmmo,groupQuestResources,groupQuestMods,groupQuestT1SkillMagazineBundle"

it doesnt remove them from these lines that can be different rewards each time.

 

 

Edited by pyro557
Made progress on making it work (see edit history)
Link to comment
Share on other sites

21 hours ago, pyro557 said:

Hello I am trying to learn how to make small changes to make a harder game for me and my brothers but i cant for the life of me figure out how to remove specific quest rewards using xpath specifically all the weapons ,ammo ,armor basically anything that gives a complete item that can be crafted. I have pretty much no experience with this just started learning last night so any help would be greatly appreciated

 

Edit for progress. so i stopped receiving errors but i got a yellow console message saying that the changes didnt load this is the code i tried

<remove xpath="//lootgroup[@name='groupQuestAmmo']"/> 

 

Edit 2: i managed to get it to remove the stuff i wanted except when they are included in a reward choice that can be different things for example

<reward type="LootItem" id="groupQuestAmmo,groupQuestResources,groupQuestMods,groupQuestT1SkillMagazineBundle"

it doesnt remove them from these lines that can be different rewards each time.

 

 

 

If you are removing the entire item, you need to do something like:

 

Remove from the quests file

<remove xpath="//reward[@id='groupQuestTools']">

 

This would remove every reward in each quest that has this id.

 

For the second example, try using this (quest file again)


 

<csv xpath="//reward[@id='groupQuestAmmo,groupQuestResources,groupQuestMods,groupQuestT1SkillMagazineBundle']/@value" delim="," op="remove">

groupQuestMods

groupQuestT1SkillMagazineBundle

</csv>

 

This should (if I done it right) remove the QuestMods and QuestT1SkillMagazineBundle from those lines.  You can adjust want you want to remove.

 

Link to comment
Share on other sites

4 hours ago, BFT2020 said:

 

If you are removing the entire item, you need to do something like:

 

Remove from the quests file

<remove xpath="//reward[@id='groupQuestTools']">

 

This would remove every reward in each quest that has this id.

 

For the second example, try using this (quest file again)


 

<csv xpath="//reward[@id='groupQuestAmmo,groupQuestResources,groupQuestMods,groupQuestT1SkillMagazineBundle']/@value" delim="," op="remove">

groupQuestMods

groupQuestT1SkillMagazineBundle

</csv>

 

This should (if I done it right) remove the QuestMods and QuestT1SkillMagazineBundle from those lines.  You can adjust want you want to remove.

 

Thank you this will help alot i got it working but in a very round about and time consuming way lol with this i can shorten it a whole bunch

Link to comment
Share on other sites

Hello again I am trying to add gas to the resource pool for quests using the following  code but i get a yellow console message that says it didnt get applied and I am unsure what to change to fix it. Thank you in advance for any help you guys give.

 

<append xpath="/loot/lootgroup[@name='groupQuestResources']">
    <item name="ammoGasCan" count="200"/>
    </append>

 

 

Edit: I got it to work after looking at several examples and taking apart a couple mods i use ty for all the help you gave me

Edited by pyro557
Fixed (see edit history)
Link to comment
Share on other sites

  • 3 weeks later...

Hi there, 

If lets say I want to create a mod which overwrites the items.xml base file with the following. 

For example, for the Claw Hammer, in order to repair it, besides the repair kit, I wish to add in an additional say forged iron. When I do the mod, do I simply do the following:

<append xpath="/items/<item name="meleeToolRepairT1ClawHammer">
        <property name="RepairTools" value="resourceRepairKit, resourceForgedIron"/>
</append>

Or would I need to copy the entire Claw Hammer item name and its properties and amend from there?

Also, if i'm trying to introduce more than 1 resource required to repair an item, would the above line work? 

Thanks!
 

Link to comment
Share on other sites

8 hours ago, Euzio said:

Hi there, 

If lets say I want to create a mod which overwrites the items.xml base file with the following. 

For example, for the Claw Hammer, in order to repair it, besides the repair kit, I wish to add in an additional say forged iron. When I do the mod, do I simply do the following:

<append xpath="/items/<item name="meleeToolRepairT1ClawHammer">
        <property name="RepairTools" value="resourceRepairKit, resourceForgedIron"/>
</append>

Or would I need to copy the entire Claw Hammer item name and its properties and amend from there?

Also, if i'm trying to introduce more than 1 resource required to repair an item, would the above line work? 

Thanks!
 

 

Some feedback (some critical but not going to be insulting):

 

You got some fundamental issues with your coding above, so you need to learn a bit more about the basics so you can get the coding correct

 

  • Pathing
    • when you do the pathing so the program knows where to apply the new code, it needs to be in this format  xpath="/node/node/node/node" 
    • So using your example above, it should be
      xpath="/items/item[@name='meleeToolRepairT1ClawHammer']"

       

  • Using the right command
    • Based on what you stated, you want to add another resource to RepairTools.  However, based on your command, you are adding another property line of RepairTools instead of replacing the existing one.
    • In this case, you would be better to use set or setattritibute.
    • <set xpath="/items/item[@name='meleeToolRepairT1ClawHammer']/property[@name='RepairTools']/@value">resourceRepairKit,resourceForgedIron</set>

       

    • This is telling the program to go to this location and change the variable value to the values you have between the > and </

Will this work?  I don't think so but you can try.  I believe it was tried before, but never gotten to work (adding more items).  This is why you have to have a repair kit which is composed of multiple items.  This is also why on the items that only require basic resources (T0), they only use one resource to repair.

 

Now blocks use more items to repair, but they are structured differently (example below is from auto turrets)

 

    <property class="RepairItems">
        <property name="resourceForgedIron" value="12"/>
        <property name="resourceMechanicalParts" value="2"/>
        <property name="resourceElectricParts" value="2"/>
    </property>

 

Notice that the repair property is a class.  You could try to setup the item to use the class itself, but I don't think that works with items.  Never tried it before myself.  In addition, since it is tied to the class, you will need another repair tool to repair your repair tool (assuming that class would work with items in the first place).  This is tied to the repair action from repair tools:

 

    <property class="Action1"> <!-- UseAction -->
        <property name="Class" value="Repair"/>
        <property name="Delay" value=".64"/> <!-- Repair actions still need the delay amount -->
        <property name="Repair_amount" value="400"/>
        <property name="Upgrade_hit_offset" value="-2"/>
        <property name="Sound_start" value="repair_block"/>
        <property name="Allowed_upgrade_items" value="resourceWood,resourceClayLump,resourceSnowBall,resourceScrapIron,resourceForgedIron,resourceForgedSteel,resourceConcreteMix,resourceCobblestones,ironDoorBlockVariantHelper,ironDoorDoubleBlockVariantHelper,vaultDoor01,vaultDoor01Double,ironHatchBlockVariantHelper,vaultHatch01,cellarDoorDoubleIron,cellarDoorDoubleSteel,shuttersIronBlockVariantHelper,shuttersSteelBlockVariantHelper,resourceYuccaFibers,resourceCloth,resourceScrapPolymers,resourceNail"/>
        <property name="UsePowerAttackAnimation" value="false"/>
    </property>

 

There is a mod out there (not sure when it was last updated) where the mod creator make different types of repair kits for different equipment.

 

Link to comment
Share on other sites

  • 3 weeks later...

Can anyone help me?
Totally noob here (at least in 7dtd modding)
I believe my mod did load properly, but I get the yellow message that the line didn't do anything
The log warning is this
 

2023-10-16T18:34:14 74.700 WRN XML patch for "spawning.xml" from mod "ProjectGyropilot" did not apply: <set xpath="/spawning/biome/spawn/respawndelay"  (line 3 at pos 6)
2023-10-16T18:34:14 74.700 WRN XML patch for "spawning.xml" from mod "ProjectGyropilot" did not apply: <set xpath="/spawning/biome/spawn/maxcount"  (line 5 at pos 6)
2023-10-16T18:34:14 74.700 WRN XML patch for "spawning.xml" from mod "ProjectGyropilot" did not apply: <set xpath="/spawning/biome/spawn/time"  (line 7 at pos 6)



And my mod is like this

<config>

    <!--Sets zombies in all biomes to never respawn-->

    <set xpath="/spawning/biome/spawn/respawndelay">999</set>

    <!--Multiply biomes spawn numbers-->

    <set xpath="/spawning/biome/spawn/maxcount">3 * number(/spawning/biome/spawn/@maxcount)</set>

    <!--Sets zombies to spawn any time of the day-->

    <set xpath="/spawning/biome/spawn/time">any</set>

</config>


Why didn't any of those lines work?

Link to comment
Share on other sites

25 minutes ago, Gyropilot said:

Why didn't any of those lines work?

 

Pathing is incorrect.

 

For example, your first line should be 

 

<set xpath="/spawning/biome/spawn/@respawndelay">999</set>

 

the @respawndelay at the end tells the code which values in the spawning/biome/spawn nodes to change.

Link to comment
Share on other sites

29 minutes ago, Gyropilot said:

Can anyone help me?
Totally noob here (at least in 7dtd modding)
I believe my mod did load properly, but I get the yellow message that the line didn't do anything
The log warning is this
 

2023-10-16T18:34:14 74.700 WRN XML patch for "spawning.xml" from mod "ProjectGyropilot" did not apply: <set xpath="/spawning/biome/spawn/respawndelay"  (line 3 at pos 6)
2023-10-16T18:34:14 74.700 WRN XML patch for "spawning.xml" from mod "ProjectGyropilot" did not apply: <set xpath="/spawning/biome/spawn/maxcount"  (line 5 at pos 6)
2023-10-16T18:34:14 74.700 WRN XML patch for "spawning.xml" from mod "ProjectGyropilot" did not apply: <set xpath="/spawning/biome/spawn/time"  (line 7 at pos 6)



And my mod is like this

<config>

    <!--Sets zombies in all biomes to never respawn-->

    <set xpath="/spawning/biome/spawn/respawndelay">999</set>

    <!--Multiply biomes spawn numbers-->

    <set xpath="/spawning/biome/spawn/maxcount">3 * number(/spawning/biome/spawn/@maxcount)</set>

    <!--Sets zombies to spawn any time of the day-->

    <set xpath="/spawning/biome/spawn/time">any</set>

</config>


Why didn't any of those lines work?

 

Adding on to what @BFT2020 said, you can't do calculations in XML. Whatever is put in the text between the XML tags is inserted verbatim.

 

So, even if you fixed the path to the maxcount attribute, its value would still be wrong. If you used this XML:

<set xpath="/spawning/biome/spawn/@maxcount">3 * number(/spawning/biome/spawn/@maxcount)</set>

...the end result would be this:

<!-- Only doing one biome for brevity -->
<biome name="burnt_forest">
    <spawn maxcount="3 * number(/spawning/biome/spawn/@maxcount)" respawndelay="2.8" time="Day" entitygroup="ZombiesBurntForest" />
    <spawn maxcount="3 * number(/spawning/biome/spawn/@maxcount)" respawndelay="3.2" time="Night" entitygroup="ZombiesNight" />

    <spawn maxcount="3 * number(/spawning/biome/spawn/@maxcount)" respawndelay="0.25" time="Day" entitygroup="ZombiesAll" tags="commercial,industrial" notags="downtown" />
    <spawn maxcount="3 * number(/spawning/biome/spawn/@maxcount)" respawndelay="0.15" time="Night" entitygroup="ZombiesNight" tags="commercial,industrial" notags="downtown" />

    <spawn maxcount="3 * number(/spawning/biome/spawn/@maxcount)" respawndelay="0.15" time="Day" entitygroup="ZombiesDowntown" tags="downtown" />
    <spawn maxcount="3 * number(/spawning/biome/spawn/@maxcount)" respawndelay="0.1" time="Night" entitygroup="ZombiesDowntown" tags="downtown" />

    <spawn maxcount="3 * number(/spawning/biome/spawn/@maxcount)" respawndelay="1" time="Any" entitygroup="WildGameForest" spawnDeadChance="0" />
    <spawn maxcount="3 * number(/spawning/biome/spawn/@maxcount)" respawndelay="1.1" time="Night" entitygroup="EnemyAnimalsBurntForest" spawnDeadChance="0" />
</biome>

 

And, the game would now crash with red errors because the string "3 * number(/spawning/biome/spawn/@maxcount)" can't be parsed as a number.

 

Instead, what you have to do is use XPath to select each value of the "maxcount" attribute, and replace them with literal values:

<set xpath="/spawning/biome/spawn[@maxcount='1']/@maxcount">3</set>
<set xpath="/spawning/biome/spawn[@maxcount='2']/@maxcount">6</set>
<set xpath="/spawning/biome/spawn[@maxcount='3']/@maxcount">9</set>
<set xpath="/spawning/biome/spawn[@maxcount='4']/@maxcount">12</set>

 

Link to comment
Share on other sites

Thanks! It works!
I mean, no warning or error popped up after I made those changes
I also had to remove the 3rd line because it complained about me using "any" for some reason. Capitalization perhaps?
And your suggestion is very clever and handy. I'll do just that

Edit: Definitively works! So many zombies
My idea is that zombies will permanently die and you will "conquer territory"

Edited by Gyropilot (see edit history)
Link to comment
Share on other sites

  • 2 weeks later...

Hello everyone
Since you guys were so helpful last time, I have another question

So what I want to do is, for the sake of organization and safety, to group a bunch of properties in a single one, because I will make a lot of entities, and they will have different set of pieces of code. Then I would still have a lot of entities, but each of them would carry much less cluttering info
For instance, for each mesh there's like dozens of lines or so of related properties like RigidBody, dismembering, scale and such
Then if I want to make, let's say a Feral variant of each of those characters, a lot more properties will add to the entity
I'm aware I can Extend, but it doesn't help enough. If each of those characters can have a female set of voices, then a different set of weapons... You see?
Is there a way to groups properties to distribute more neatly?

Edited by Gyropilot (see edit history)
Link to comment
Share on other sites

  • 2 months later...

I have an xpath question... the file I am trying to append into is ui_display.xml and in this xml is a subsection <item_display></item_display> with another section called character display or something like that. The issue is I need my append to jump into the <item_display></item_display> subsection and I cannot grasp from the tutorials here how exactly to do that. Most of this makes sense to me but either I missed something or there was no specific note to append into a specific subsection.

 

I have tried using <append xpath="/ui_display"><item_display><item_display_info display_type="MyType" displaygroup="MyGroup"><display_entry name="myStuff"/></item_display_info></item_display></append> which I am guessing worked to enter my data at the end of ui_display because no errors or warnings showed in the F1 load log. Unfortunately, it doesn't work in game. My item's stat sheet is blank.

 

I know I have to append ui_display.xml and I know it needs be in the <item_display></item_display> subsection. I just dont know how to write it in xpath.

 

I also tried a couple other ways but cause both yellow and red errors in the log so no point detailing those attempts. Any help would be appreciated!

Edited by ghowriter (see edit history)
Link to comment
Share on other sites

  • 2 weeks later...

I tried making a vehicle mod that causes vultures to get shocked when getting too close.

Unfortunately, i am completely unable to make it trigger the buff and i really don't know what i'm doing wrong.

Please help, i don't know if it just refuses to work because the trigger is wrong (i've been trying various triggers, the one shown is just a test) or i'm just dumb, idk. Maybe even the requirement is giving trouble?

<configs>
	<append xpath="/item_modifiers">
	
		<item_modifier name="modVehicleAntiVulture" installable_tags="vehicle" modifier_tags="specialDamage" blocked_tags="noMods" type="attachment">
		<property name="Extends" value="modGeneralMaster"/>
		<property name="CreativeMode" value="Player"/>
		<property name="CustomIcon" value="modVehicleAntiVultureIcon"/>
		<property name="UnlockedBy" value="modVehicleAntiVultureSchematic"/>
		<property name="TraderStageTemplate" value="modsTier2"/>

		<effect_group>
		<triggered_effect trigger="onSelfEnteredGame" action="AddBuff" target="selfAOE" target_tags="vulture" range="35" buff="buffShocked">
		<requirement name="IsAttachedToEntity"/>
        </triggered_effect>
		</effect_group>
	</item_modifier>
	</append>
</configs>
Edited by Black_Wolf (see edit history)
Link to comment
Share on other sites

  • 3 weeks later...

Good day everyone, 

 

In A20 I was able to use the following code. 

 

<append xpath="/entitygroups/entitygroup[descendant::entity[@name='zombieSteve']]">
    TestZombie1
    TestZombie2
    TestZombie3
 </append>

 

But in A21 when I try to use it. I get the following error. 

 

2024-02-01T17:02:31 313.250 WRN XML patch for "entitygroups.xml" from mod "AGG" did not apply: <append xpath="/entitygroups/entitygroup[descendant::entity[@name='zombieSteve']]"  (line 3066 at pos 3)

 

I also was able to run the following code before

 

<append xpath="/entitygroups/entitygroup[descendant::entity[@name='zombieBoe' and @prob='.3']]">
    <entity name="TestZombie1" prob=".3"/>
    <entity name="TestZombie2" prob=".3"/>    
    <entity name="TestZombie2" prob=".3"/>                
 </append>

 

But I get the following error. 

 

2024-02-01T17:02:31 313.250 WRN XML patch for "entitygroups.xml" from mod "AGG" did not apply: <append xpath="/entitygroups/entitygroup[descendant::entity[@name='zombieSteve']]"  (line 3064 at pos 2)

 

Does anyone have a clue! 

 

Thanks from

 

Lost and Confused

Link to comment
Share on other sites

58 minutes ago, shcjohnson said:

Good day everyone, 

 

In A20 I was able to use the following code. 

 

<append xpath="/entitygroups/entitygroup[descendant::entity[@name='zombieSteve']]">
    TestZombie1
    TestZombie2
    TestZombie3
 </append>

 

But in A21 when I try to use it. I get the following error. 

 

2024-02-01T17:02:31 313.250 WRN XML patch for "entitygroups.xml" from mod "AGG" did not apply: <append xpath="/entitygroups/entitygroup[descendant::entity[@name='zombieSteve']]"  (line 3066 at pos 3)

 

I also was able to run the following code before

 

<append xpath="/entitygroups/entitygroup[descendant::entity[@name='zombieBoe' and @prob='.3']]">
    <entity name="TestZombie1" prob=".3"/>
    <entity name="TestZombie2" prob=".3"/>    
    <entity name="TestZombie2" prob=".3"/>                
 </append>

 

But I get the following error. 

 

2024-02-01T17:02:31 313.250 WRN XML patch for "entitygroups.xml" from mod "AGG" did not apply: <append xpath="/entitygroups/entitygroup[descendant::entity[@name='zombieSteve']]"  (line 3064 at pos 2)

 

Does anyone have a clue! 

 

Thanks from

 

Lost and Confused

 

You need to use the csv structure and not append.  Entity groups structured changed from A20 to A21.  Go back to page 28 in this thread and the new method is explained in more detail.

Link to comment
Share on other sites

  • 1 month later...

EDIT: After sleeping on it I figured it out this morning. I had put the entity in the node path, not the entity group :)

 

I am trying to exclude any "fresh" zombies from DarksZombies from appearing in random spawns:

 

<csv xpath="/entitygroups/entitygroup[@name='ZombiesAll']/text()" delim="\n" op="add" >
        zombieParasite
        zombieFatParasite
        zombieExperimentZ
        zombieArmy1
        zombieFreshFemale1
        zombieFreshFemale2
        zombieFreshFemale3
        zombieFreshFemale4
        zombieFreshFemale5
                zombieFreshMale1
                zombieFreshMale2    
                    zombieFreshFemale1Feral, .25
        zombieFreshFemale2Feral, .25
        zombieFreshFemale3Feral, .25
        zombieFreshFemale4Feral, .25
        zombieFreshFemale5Feral, .25
                zombieFreshMale1Feral, .25
        zombieFreshMale2Feral, .25
    </csv>

 

I've created a modlet, (which loads after DarkzZombiez) and tried the following lines of code:

 

<csv xpath="/entitygroup[contains(@name, 'zombie') or (contains(@name, 'Fresh'))]/text()" delim="\n" op="remove" >zombieFresh*</csv>
 

<csv xpath="//entitygroup[contains(@name, 'zombie') or (contains(@name, 'Fresh'))]/text()" delim="\n" op="remove" >zombieFresh*</csv>

 

<csv xpath="/entitygroups/entitygroup[contains(@name, 'zombie') or (contains(@name, 'Fresh'))]/text()" delim="\n" op="remove" >zombieFresh*</csv>

 

<csv xpath="//entitygroups/entitygroup[contains(@name, 'zombie') or (contains(@name, 'Fresh'))]/text()" delim="\n" op="remove" >zombieFresh*</csv>

 

...but I am still getting "fresh" zombie spawns in the wild.

 

If anyone sees the error in this I'd really appreciate it!

 

Had a sleep on it and discovered it in the morning. 

Edited by RippedWarrior (see edit history)
Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...