Jump to content

need Help: Modded Loot.xml -> XmlException: 'item' is expected Line X, position Y


metalfront

Recommended Posts

Hey Folks,

 

i hope you can help me. It's kinda confusing... I keep getting the error message below on startup of my server:

 

2019-03-24T17:12:33 37.294 ERR Failed loading and parsing XML (loot.xml):

XmlException: 'item' is expected Line 20, position 6.

2019-03-24T17:12:33 37.316 ERR XML loader: Patching 'loot.xml' from mod 'Zombie specific Loot' failed

NullReferenceException: Object reference not set to an instance of an object

 

What i wanted to do:

My goal is creating zombie loot related to their appearance, pretty similar to what Deceptive Pastry (--> Restored Zombie Loot) did in his/her mod.

 

What i did:

I started by creating just one new lootcontainer for the cowboy (zombieBoe) and one new lootgroup called "cowboyStuff". Here comes the Mod-Code for loot.xml.

 

<configs>

<append xpath="/lootcontainers">
	<!-- Zombie Cowboy Lootgroup -->
	<lootgroup name="cowboyStuff">
		<item group="cowboyHatAll" prob="0.10">
		<item group="weaponsHuntingRifle+ammo" prob="0.10"/>
		<item group="weaponsMagnum+ammo" prob="0.05"/>
		<item name="meleeToolHuntingKnife" prob="0.15"/>
		<item name="ammo762mmBulletFMJSteel" count="5,25" prob="0.03"/>
		<item name="ammo44MagnumBulletSteel" count="5,17" prob="0.03"/>
		<item name="ammo762mmBulletFMJ" count="5,25" prob="0.10"/>
		<item name="ammo44MagnumBullet" count="5,17" prob="0.10"/>
		<item name="drugHerbalAntibiotics" prob="0.05"/>
		<item name="drugPainkillers" prob="0.02"/>
		<item name="cowboyBoots" prob="0.15"/>
		<item name="leatherDuster" prob="0.05"/>
		<item name="leatherDusterBlack" prob="0.05"/>
		<item name="leatherPoncho" prob="0.02"/>
	</lootgroup>
	<!-- Zombie Cowboy Loot Container -->
	<lootcontainer id="201" count="1,2" size="5,10" destroy_on_close="false" sound_open="UseActions/open_backpack" sound_close="UseActions/close_backpack" open_time="1" loot_quality_template="baseTemplate">
		<item group="cannedfood" count="1" prob="15"/>
		<item group="treasureMaps" count="1" prob="5"/>
		<item group="questChallenge" count="1" prob="2"/>
		<item group="cowboyStuff" count="1" prob="50"/>
		<item name="casinoCoin" count="200,410" prob="8"/>
		<item name="oldCash" count="50,200" prob="10"/>
		<item name="drinkJarBeer" count="1" prob="10"/>
	</lootcontainer>

</append>

</configs>

 

The error occurs, whether i use A) this mod or B) insert the code into the game's loot.xml. In case B) i inserted the lootgroup right after the last lootgroup of the orignal file. The new lootcontainer was added at the end of file... However. It's the same error with pointing to the position where the code says </lootgroup> for closing the new cowboyStuff-lootgroup.

 

I also replaced my mod with the one by Deceptive Pastry and when i started the server, no errors occured. So, what did i do wrong?

 

 

Besides, I also changed entityclasses.xml and added the following lines right after the EntityLootContainerRegular entry:

<entity_class name="EntityLootContainerCowboy" extends="EntityLootContainerRegular">
<property name="LootListOnDeath" value="201"/>
</entity_class>

Link to comment
Share on other sites

You have a few syntax errors ....

 

JaxTeller718 (Ravenhearst Team) https://7daystodie.com/forums/showthread.php?94906-JaxTeller718-Modlet-Collection&p=876199&viewfull=1#post876199

 

Theres is a zombie specific loot modlet listed.... that may help you with the Xpath parts ...and point you in the right direction :)

 

For adding a new lootcontainer use something like this 116 being the last id in tfp code

 

<insertAfter xpath="/lootcontainers/lootcontainer[@id='116']">
<!-- Zombie Cowboy Loot Container -->
	<lootcontainer id="201" count="1,2" size="5,10" destroy_on_close="false" sound_open="UseActions/open_backpack" sound_close="UseActions/close_backpack" open_time="1" loot_quality_template="baseTemplate">
		<item group="cannedfood" count="1" prob="15"/>
		<item group="treasureMaps" count="1" prob="5"/>
		<item group="questChallenge" count="1" prob="2"/>
		<item group="cowboyStuff" count="1" prob="50"/>
		<item name="casinoCoin" count="200,410" prob="8"/>
		<item name="oldCash" count="50,200" prob="10"/>
		<item name="drinkJarBeer" count="1" prob="10"/>
	</lootcontainer>
</insertAfter>

Link to comment
Share on other sites

Thanks for your reply!

Today i tried to follow your hints. First i brought the server version back to vanilla. Then i created the .xml files inside a Mods-Folder. Just to give you better insight:

 

7DTD\Mods\Zombie specific Loot\

- Localization.txt

- Mod-Info.xml

 

7DTD\Mods\Zombie specific Loot\Config\

- entityclasses.xml

- loot.xml

 

Additionally I tried to clean up the code, so here we are:

 

entityxlasses.xml

<configs>	
<set xpath="/entity_classes/entity_class/property[@name='LootDropProb']/@value">0.25</set>

<append xpath="/entity_classes/entity_class[@name='zombieOldTimer']">
	<property name="LootDropEntityClass" value="EntityLootContainerCowboy"/>
</append>

<append xpath="/entity_classes">
	<entity_class name="EntityLootContainerCowboy" extends="EntityLootContainerRegular">
		<property name="TimeStayAfterDeath" value="600"/>
		<property name="LootListOnDeath" value="201"/>
	</entity_class>
</append>
</configs>

 

loot.xml

<configs>

<append xpath="/lootcontainers">
	<!-- Zombie Cowboy Lootgroup -->
	<lootgroup name="cowboyStuff">
		<item group="cowboyHatAll" prob="0.15">
		<item group="weaponsHuntingRifle+ammo" prob="0.1"/>
		<item group="weaponsMagnum+ammo" prob="0.05"/>
		<item name="meleeToolHuntingKnife" prob="0.14"/>
		<item name="ammo762mmBulletFMJSteel" count="5,25" prob="0.03"/>
		<item name="ammo44MagnumBulletSteel" count="5,17" prob="0.03"/>
		<item name="ammo762mmBulletFMJ" count="5,25" prob="0.1"/>
		<item name="ammo44MagnumBullet" count="5,17" prob="0.1"/>
		<item name="drugHerbalAntibiotics"/>
		<item name="drugPainkillers" prob="0.02"/>
		<item name="leatherPoncho" prob="0.02"/>
		<item name="leatherDuster" prob="0.05"/>
		<item name="leatherDusterBlack" prob="0.04"/>
		<item name="cowboyBoots"/>
	</lootgroup>
	<!-- Zombie Cowboy Loot Container -->
	<lootcontainer id="201" count="1,2" size="5,10" destroy_on_close="false" sound_open="UseActions/open_backpack" sound_close="UseActions/close_backpack" open_time="1" loot_quality_template="baseTemplate">
		<item group="cannedfood" count="1" prob="0.10"/>
		<item group="treasureMaps" count="1" prob="0.05"/>
		<item group="questChallenge" count="1" prob="0.02"/>
		<item group="cowboyStuff" count="1" prob="0.5"/>
		<item name="casinoCoin" count="200,410" prob="0.08"/>
		<item name="oldCash" count="50,200" prob="0.1"/>
		<item name="drinkJarBeer" count="1"/>
	</lootcontainer>

</append>

</configs>

 

Again, i get the error message below:

2019-03-25T21:31:53 33.641 ERR Failed loading and parsing XML (loot.xml):

XmlException: 'item' is expected Line 20, position 6.

2019-03-25T21:31:53 33.663 ERR XML loader: Patching 'loot.xml' from mod 'Zombie specific Loot' failed

NullReferenceException: Object reference not set to an instance of an object

 

So, there's still the quesion left: What's wrong here?

It's weird, because the code by Deceptive Pastry (see below) works fine. He also added the code via "append". Other than JaxTeller718, he also added new lootgroups, what's exactly what i wanna do, too. Still, i don't see the difference between the code below and what i did.

 

<configs>

<append xpath="/lootcontainers">
	<lootgroup name="lumberjacks" count="1">
		<item name="meleeToolFireaxeIron" prob="1"/>
		<item group="rareTools" prob="0.5"/>
		<item name="drinkJarGrainAlcohol"/>
		<item name="resourceForgedIron" count="1,4" prob="0.01272"/> <!-- together 0.5% -->
		<item name="resourceForgedSteel" count="1,4" prob="0.00848"/>
		<item name="gunCompoundBow" prob="0.015"/>
		<item group="weaponsHuntingRifle+ammo" prob="0.01"/>
		<item group="paintMagazines" prob="0.12"/>
	</lootgroup>
	<lootgroup name="ZombieUtilityWorker">
<!-- snip -->
	</lootgroup>

	<!-- EntityLootContainer_zombie -->
	<lootcontainer id="200" ... >
       <!-- snip -->
    </append>

</configs>

Link to comment
Share on other sites

A quick look at code for loot.xml where the error is thrown

 

<item group="cowboyHatAll" prob="0.15">

 

vs

 

<item group="weaponsHuntingRifle+ammo" prob="0.1"/>

 

Needs a /

 

There are different ways to add things in with Xpath ... append and insertAfter both work KhaineGB suggested for one of my modlets to use insertAfter but Append does same job.

 

I can append and the new code is added at the end of the node, insertAfter means I can place the code in the node between other things for continuity.

 

This was in first post you posted when i said you had syntax errors , many a time I have done same mistake it's easy to miss a / or a " or ] ;)

 

Hopefully the rest will work as desired

Link to comment
Share on other sites

<item group="cowboyHatAll" prob="0.15">

 

[...]

 

Needs a /

 

This was in first post you posted when i said you had syntax errors , many a time I have done same mistake it's easy to miss a / or a " or ] ;)

 

 

Thank you VERY much!!

Now the game starts without complaining. It was just the missing /...

Thanks, for teaching me to have an eye on these :-)

 

 

PROBLEM SOLVED!

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...