Jump to content

Help modding entitygroups.xml xpath A21


Recommended Posts

Hi!

 

I'm new to this forum, and to be honest i just made an account to ask for help because this issue is starting to drive me mad.

I did my search on this forum and i apologize if this issue was already asked/solved, but in that case i didn't came across it.

I never modded in my life, and i started with this game because i like zombies, i like video games and since i'm Fullstack web dev (a junior one, but still...)

the subject got my interest.

 

So, on to the problem:

I'm trying to modify the entitygroups.xml (and please do correct me if this is not the place where i should work my code), my goal in this case is to remove all "special" zombies: feral, radiated, "animal zombies", "not normal zombies" (wight, "pukers", etc).

While i was checking the entitygroups.xml from the game i came across the commentary on the code that they change the structure as of A21, now every entitygroup tag inside doesn't have nested a entity tag with it's zombieName but instead just the zombieName followed by its probabilty of appearance (these separated by a comma).

I managed to select said text with the following xpath selector:

 

xpath="/entitygroups/entitygroup[text()='animalZombieBear']/text()"

 

Despite the fact i selected the right node (supposedly), i can't make any of the commands work, i tried: add, append, set, setattribute, remove.

And i know i selected the node correctly because, for example, if try to remove the text the console outputs this:

 

EXC XML. RemoveByXPath (/no_bears_zombies/remove, line 7 at pos 3): Matched node type (Text, line 631 at pos 39) can not be removed

 

My guess is either i'm not selecting correctly or i'm not using the proper command for the task i want to do.

Any help is appreciated, i digged through documentation about how xml works, how xpath works, i even went to w3schools site.

 

 

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

  • ElectricaL changed the title to Help modding entitygroups.xml xpath A21

You need to use the CSV method to do this.

f.i.
I want to replace snakes by chickens and I used this syntax.
 

    <csv xpath="/entitygroups/entitygroup[@name='EnemyAnimalsDesert']/text()" delim="," op="remove">animalSnake</csv>
    <csv xpath="/entitygroups/entitygroup[@name='EnemyAnimalsDesert']/text()" delim="," op="add">animalChicken, 10</csv>


Etc. for the other biomes.
It seems to be working but gives some strange problems at 22:00 when night falls and the snakes starts roaming. 😞
But this should be the method to use.
 

Link to comment
Share on other sites

11 hours ago, janneman63 said:

You need to use the CSV method to do this.

f.i.
I want to replace snakes by chickens and I used this syntax.
 

    <csv xpath="/entitygroups/entitygroup[@name='EnemyAnimalsDesert']/text()" delim="," op="remove">animalSnake</csv>
    <csv xpath="/entitygroups/entitygroup[@name='EnemyAnimalsDesert']/text()" delim="," op="add">animalChicken, 10</csv>


Etc. for the other biomes.
It seems to be working but gives some strange problems at 22:00 when night falls and the snakes starts roaming. 😞
But this should be the method to use.
 

 

Love you man, thanks a lot!

Seems a good start point to develop from, if i were to solve that spawn-clock issue i'll reach you.

See ya!

Link to comment
Share on other sites

I did solve the 22:00 issue. I'm on another computer right now so I can't look up the code right away but it had to do with the fact that "add" places the new entry as last.
In the forest there are only two values animalSnake and none.  Above each block of XML it is written that none can not be first.. So this was the problem.

I removed animalSnake and added animalChicken which became last in the list an none became first.. 
I solved it to remove both animalSnake and none and added them in the right order so none is not first.
All seems to be working fine.

I will add the code here below when I'm on my main computer with the mod files.
There are errors in my first posts f.i. delim must be "\n" and not ",".

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

As promised my more or less final code.

entitygroups.xml
 

<?xml version="1.0" encoding="UTF-8"?>
<!--
    Below the original XML code

	<entitygroup name="EnemyAnimalsDesert">
		animalCoyote, 30
		animalZombieVulture, 20
		animalSnake, 10
		none, 40
	</entitygroup>

    <entitygroup name="EnemyAnimalsForest">
		animalSnake, 20
		none, 80
	</entitygroup>

	<entitygroup name="EnemyAnimalsWasteland" >
		animalSnake, 20
		animalZombieVulture, 30
		animalZombieDog, 30
		animalZombieBear, 20
	</entitygroup>

    <entitygroup name="SnakeGroup">animalSnake</entitygroup>
    <entitygroup name="animalSnake">animalSnake</entitygroup>

-->

<NoSnakes>
 
    <csv xpath="/entitygroups/entitygroup[@name='EnemyAnimalsDesert']/text()" delim="\n" op="remove">animalSnake, 10</csv>
    <csv xpath="/entitygroups/entitygroup[@name='EnemyAnimalsDesert']/text()" delim="\n" op="add">animalChicken, 10</csv>

    <csv xpath="/entitygroups/entitygroup[@name='EnemyAnimalsWasteland']/text()" delim="\n" op="remove">animalSnake, 20</csv>
    <csv xpath="/entitygroups/entitygroup[@name='EnemyAnimalsWasteland']/text()" delim="\n" op="add">animalChicken, 20</csv>

    <!-- Forest is different, there are only 2 values and the add places the new value at the bottom. -->
    <!-- none can not be the first value so we need to remove both and add them in the right sequence, none last. -->
    <csv xpath="/entitygroups/entitygroup[@name='EnemyAnimalsForest']/text()" delim="\n" op="remove">animalSnake, 20</csv>
    <csv xpath="/entitygroups/entitygroup[@name='EnemyAnimalsForest']/text()" delim="\n" op="remove">none, 80</csv>
    <csv xpath="/entitygroups/entitygroup[@name='EnemyAnimalsForest']/text()" delim="\n" op="add" >
    animalChicken, 20
    none, 80
    </csv>

<!-- Still having problems with these values.. 
    <set xpath="/entitygroups/entitygroup[@name='SnakeGroup']/text()">animalChicken</set>
    <set xpath="/entitygroups/entitygroup[@name='animalSnake']/text()">animalChicken</set>
-->

</NoSnakes>


It's still a work in progress but I think it's working.
I didn't encounter anymore snakes and found a sleeper chicken on two places where I am certain that there is a sleeper snake.

But there are more files that I have changed:

blocks.xml
 

<NoSnakes>
    <set xpath="/blocks/block[@name='sleeperSnakeAnimal']/property[@name='Extends']/@value">sleeperBoarAnimal</set>
    <set xpath="/blocks/block[@name='sleeperSnakeAnimal']/property[@name='Model']/@value">Entities/Animals/CHICKEN/sleeperPose/idleSleepChickenPrefab</set>
    <set xpath="/blocks/block[@name='sleeperSnakeAnimal']/property[@name='SpawnGroup']/@value">ChickenGroup</set>
    
    <set xpath="/blocks/block[@name='infestedSleeperSnakeAnimal']/property[@name='Extends']/@value">sleeperBoarAnimal</set>
    <set xpath="/blocks/block[@name='infestedSleeperSnakeAnimal']/property[@name='Model']/@value">Entities/Animals/CHICKEN/sleeperPose/idleSleepChickenPrefab</set>
    <set xpath="/blocks/block[@name='infestedSleeperSnakeAnimal']/property[@name='SpawnGroup']/@value">ChickenGroup</set>
    <remove xpath="/blocks/block[@name='infestedSleeperSnakeAnimal']/property[@name='CustomIcon']"/>
    <remove xpath="/blocks/block[@name='infestedSleeperSnakeAnimal']/property[@name='CustomIconTint']"/>
</NoSnakes>


gameevents.xml
 

<NoSnakes>
    <set xpath="/gameevents/action_sequence[variable/@name='zombiename' and variable/@value='animalSnake']/variable[@name='zombiename']/@value">animalChicken</set>
    <set xpath="/gameevents/action_sequence[variable/@name='alertsound' and variable/@value='snakealert']/variable[@name='alertsound']/@value">chickenpain</set>
</NoSnakes>


And the last file is gamestages.xml
 

<NoSnakes>
<set xpath="/gamestages/group[@name='animalSnake']/spawner[@name='animalSnake']/@name">animalChicken</set>
<set xpath="/gamestages/spawner[@name='animalSnake']/gamestage/spawn[@group='animalSnake']/@group">animalChicken</set>
</NoSnakes>

 

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