• If you have a mod, tool or prefab, please use the Resources section. Click Mods at the top of the forums.

Xpath Help

EpicSpire

New member
i'm trying to make a small mod that replaces the screamer with a horde. so instead of summoning a screamer, if just get a horde as if she called them. i know how to editt he xml to do this, but i do not know how to make the xpath command to do it via a modlet. The modlette is meant to be used in a pure burnt forest biome and i'd like the horde to only consist of zombieBurnt and zombieSteveCrawler, but i want it to spawn in more than 1 of each and i don't know how to do that either. 

the main issue i have is the /set or /append coding. 

if i want to change: 
    <entitygroup name="ZombieScouts">
        <entity name="zombieScreamer"/>
    </entitygroup>

to

    <entitygroup name="ZombieScouts">
        <entity name="zombieBurnt" />
        <entity name="zombieSteveCrawler" />
    </entitygroup>

do i use /set or /append

and how do i make it so it spawns more than 1 of each? perferably based on GameStage

 
I'm new to this myself, but I will try to help the best I can.

If I'm not mistaken, your code should be something like this:

<config>
<remove xpath="entitygroups/entitygroup[@name='ZombieScouts']"/entity[@name='zombieScreamer']/>
<append xpath="entitygroups/entitygroup[@name='ZombieScouts']">
<entity name="zombieBurnt"/>
<entity name="zombieSteveCrawler"/>
</append>
</config>


If I am correct, and have read your post correctly, the code I have provided will remove the Screamer Zombie from the group "ZombieScouts", then add the Burnt Zombie, and Zombie Crawler Steve to that group.

As far as how to adjust how many zombies spawn I have no idea how to do that.
Please let me know if you figure that part out, and if my code helped you.

 
i can make the scout spawn a horde.. but since they were spawned by the scout spawning system.. they will all be scouts.

the screamer does not have the ability to summon more zombies.. the scout class gives it that ability.

so if your scout command calls in 6 crawlers.. all 6 of them will call in their own screamer horde if their alert goes off... lol

 
EpicSpire said:
the scout class gives it that ability.
That is seriously good to know!

But to answer your question, I believe that piece is part of the .dll or hardcorded or whatever, and not modifiable through xml. At least, specifically changing what the "scout" does.

 
Last edited by a moderator:
I don't wanna create other stupid topics, so I post my question here

1. How to add tiered="false" to all effect_group's inside all items that have melee, gun or armor in their name.

as example

<effect_group name="meleeToolAxeT1IronFireaxe">

to

<effect_group name="meleeToolAxeT1IronFireaxe" tiered="false">




doesn't work
<append xpath="//item[contains(@name,'melee') or contains(@name,'gun') or contains(@name,'armor')]/effect_group">tiered='false'</append>


2. How to change each RepairTools property to XX, if Material property is YY?

As example, I have 500 machine guns and all of them has property name="Material" value="MMachineGunParts" and I wanna change RepairTools property to gunMGT1AK47Parts for all items that have such material

Code:
<property name="Material" value="MMachineGunParts"/>
<property name="RepairTools" value="resourceRepairKit"/>

to

<property name="Material" value="MMachineGunParts"/>
<property name="RepairTools" value="gunMGT1AK47Parts"/>
 
Last edited by a moderator:
How to add tiered="false"
<append xpath="//item[contains(@name,'melee') or contains(@name,'gun') or contains(@name,'armor')]/effect_group">tiered='false'</append>


Example used online (https://7daystodie.gamepedia.com/XPath_Explained)

<setattribute xpath="/items/item[@name='meleeBoneShiv']" name="author">sphereii</setattribute>



So in your case:

Code:
<setattribute xpath="//item[contains(@name,'melee') or contains(@name,'gun') or contains(@name,'armor')]/effect_group" name="tiered">false</setattribute>
 
Last edited by a moderator:
2. How to change each RepairTools property to XX, if Material property is YY?
Perhaps something like this would work?

Code:
<remove xpath="/items/item[ add machine gun identifier here?]/property[@name='RepairTools']"/>
<insertAfter xpath="items/item[ add machine gun identifier here?]/property[@value='MMachineGunParts']">
	<property name="RepairTools" value="gunMGT1AK47Parts"/></insertAfter>
 
<append xpath="//item[contains(@name,'melee') or contains(@name,'gun') or contains(@name,'armor')]/effect_group">tiered='false'</append>


Example used online (https://7daystodie.gamepedia.com/XPath_Explained)

<setattribute xpath="/items/item[@name='meleeBoneShiv']" name="author">sphereii</setattribute>



So in your case:

<setattribute xpath="//item[contains(@name,'melee') or contains(@name,'gun') or contains(@name,'armor')]/effect_group" name="tiered">false</setattribute>

tiered isn't a nameScreenshot_1.png

 
That is correct. In the code I provided, the name="tiered" is just referring to the name of the attribute you are adding, which is tiered. with the result turning to

tiered="false" as within the line of code.
Thanks! Also I'm confused how to remove the values I want, because these lines removes all Tags and property tags that I don't want to remove

Screenshot_1.png

Edit: I got it, as example

Code:
<removeattribute xpath="//@tags">perkMiner69r</removeattribute>
 
Last edited by a moderator:
What values did you want removed?
All tags="perkGunslinger,9mmGun" (as example) and ,9mmGun and perkGunslinger (as example) from all Tags

removeattribute removes all tags, remove doesn't work because of the game says that I need removeattribute

 
Last edited by a moderator:
@CrazyAluminum hmmm... This one I wasn't sure if it was possible. I had used the "set" xpath to redo each item specifically... but that is a lot of a work.

Ideas:

1.) take out the removeattribute commands, I don't believe that is how that specific xpath works.

2.) with the remove command, also specify if the tag has that attribute you want removed?

Something like this (not sure if I am coding this correctly when it comes to "adding conditions":

/property[@name='tags'][contains(@value,',9mmGun')]/@value>

Also 3.) Modifying the progression system and the tags that utilize them is a PAIN! they are interconnected in many ways possibly included within the .dll. Sometimes just renaming them through localization and moving benefits around does the trick.

 
@CrazyAluminum hmmm... This one I wasn't sure if it was possible. I had used the "set" xpath to redo each item specifically... but that is a lot of a work.

Ideas:

1.) take out the removeattribute commands, I don't believe that is how that specific xpath works.

2.) with the remove command, also specify if the tag has that attribute you want removed?

Something like this (not sure if I am coding this correctly when it comes to "adding conditions":

/property[@name='tags'][contains(@value,',9mmGun')]/@value>

Also 3.) Modifying the progression system and the tags that utilize them is a PAIN! they are interconnected in many ways possibly included within the .dll. Sometimes just renaming them through localization and moving benefits around does the trick.
Do you check it yourself? I can't get this to work

Screenshot_1.png

 
Last edited by a moderator:
Back
Top