Jump to content

Xpath Help


EpicSpire

Recommended Posts

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

Link to comment
Share on other sites

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.

 

Link to comment
Share on other sites

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

Link to comment
Share on other sites

  • 2 weeks later...

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

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

to

<property name="Material" value="MMachineGunParts"/>
<property name="RepairTools" value="gunMGT1AK47Parts"/>

 

Link to comment
Share on other sites

1 hour ago, CrazyAluminum said:

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:

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

 

Link to comment
Share on other sites

1 hour ago, CrazyAluminum said:

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

Perhaps something like this would work?

<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>

 

Link to comment
Share on other sites

53 minutes ago, Riles said:

<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.thumb.png.a4a39ccf15c5e9cbdec6b59f47447c60.png

Link to comment
Share on other sites

21 minutes ago, Riles said:

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

<removeattribute xpath="//@tags">perkMiner69r</removeattribute>

 

Link to comment
Share on other sites

@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.

 

 

Link to comment
Share on other sites

10 hours ago, Riles said:

@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

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...