Jump to content

Errors With Modifying the Loot from Zombies


Distinct Soul

Recommended Posts

I'm trying to essentially completely change the loot that zombies drop; but despite trying a lot of different things, while playing I'll get this error that says:

EXC ArgumentNullException: Value cannot be null.

Parameter name: Name cannot be null

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

 

When leaving the world, the console will then just spam "Object reference not set to an instance of an object", however, only when I get the error in-game.

Here is what is shown in the logs: https://imgur.com/a/9uUsvhM

 

As the loot.xml I've created is quite big, I'll shorten the list of items within the lootgroups while hopefully retaining all that is important to spot the problem.

 

<config>
  
	<insertBefore xpath="lootcontainers/lootprobtemplates/lootprobtemplate[@name='veryLow']">
      <lootprobtemplate name="extremeLow">
        <loot level="1,999999" prob=".02" />
      </lootprobtemplate>
    </insertBefore>

	<remove xpath="/lootcontainers/lootgroup[@name='groupZpackReg01']" ></remove>
    <remove xpath="/lootcontainers/lootgroup[@name='groupZpackReg']/item[@group='groupAmmoMedium']" ></remove>

    <insertBefore xpath="/lootcontainers/lootgroup[@name='groupZpackReg']">
      <lootgroup name="prioritySkillMags">
        <item name="harvestingToolsSkillMagazine" count="1" />
      </lootgroup>
      
      <lootgroup name="groupWoodOrStone">
        <item name="resourceWood" count="24,75" loot_prob_template="medHigh" force_prob="true" />
        <item name="resourceRockSmall" count="24,75" loot_prob_template="med" force_prob="true" />
      </lootgroup>
      
      <lootgroup name="groupZpackReg01">
        <item group="prioritySkillMags" loot_prob_template="medHigh" force_prob="true" />
      </lootgroup>
      <lootgroup name="groupZpackReg02">
        <item group="groupMedicalCustomS" loot_prob_template="medLow" force_prob="true" />
      </lootgroup>
      <lootgroup name="groupZpackReg03">
        <item name="resourceSpring" count="1,2" loot_prob_template="medHigh" />
        <item group="groupRareToolsTiered" loot_prob_template="extremeLow" />
      </lootgroup>
    </insertBefore>

    <append xpath="/lootcontainers/lootgroup[@name='groupZpackReg']">
      <item group="groupWoodOrStone" count="1" force_prob="true" />
      <item group="groupZpackReg01" count="1" />
      <item group="groupZpackReg02" loot_prob_template="medHigh" />
      <item group="groupZpackReg03" loot_prob_template="low" />
    </append>

    <insertBefore xpath="/lootcontainers/lootgroup[@name='groupZpackStrong']">
      <lootgroup name="groupZpackStrong01">
	      <item name="resourceElectricParts" count="1,3" loot_prob_template="medLow" />
      </lootgroup>
      <lootgroup name="groupZpackStrong02">
        <item name="resourceScrapLead" count="349,540" loot_prob_template="medLow" />
      </lootgroup>
      <lootgroup name="groupZpackStrong03">
        <item name="drugSteroids" count="1" loot_prob_template="low" />
      </lootgroup>
    </insertBefore>

    <append xpath="/lootcontainers/lootgroup[@name='groupZpackStrong']">
      <item group="skillMagazines" loot_prob_template="med" force_prob="true" />
      <item group="groupZpackStrong01" count="1" />
      <item group="groupZpackStrong02" loot_prob_template="med" />
      <item group="groupZpackStrong03" loot_prob_template="low" />
    </append>

    <insertBefore xpath="/lootcontainers/lootgroup[@name='groupZpackBoss']">
      <lootgroup name="groupForgeAddons">
        <item name="toolBellows" count="1" loot_prob_template="medHigh" />
      </lootgroup>
      
      <lootgroup name="groupZpackBoss01">
        <item name="resourceForgedSteel" count="7,12" loot_prob_template="high" force_prob="true" />
      </lootgroup>
      <lootgroup name="groupZpackBoss02">
        <item group="groupMedicalUncommon" />
      </lootgroup>
      <lootgroup name="groupZpackBoss03">
        <item group="groupForgeAddons" loot_prob_template="med" />
      </lootgroup>
    </insertBefore>
  
    <append xpath="/lootcontainers/lootgroup[@name='groupZpackBoss']">
      <item group="groupAmmoLarge" count="1" loot_prob_template="high" force_prob="true" />
      <item group="groupZpackBoss01" count="1" />
      <item group="groupZpackBoss02" loot_prob_template="medHigh" />
      <item group="groupZpackBoss03" loot_prob_template="medLow" />
    </append>
</config>

 

I believe it's the loot.xml from my modlet, as I've played without it, and I've never gotten the error before.

Other than this error, I also notice that I'm getting multiple crafting skill mags for whatever reason from the zombie drops, despite not putting a count on the groups lootgroup, making it seem more likely that it is my modlet - ignore the misaligned lines, they're fixed in the file.

Link to comment
Share on other sites

You can find the loot.xml that results from your xpath changes in your savegame in a directory called "ConfigsDump". By looking at this you can see whether everything was changed exactly as you expected it. Also by posting the changed code you make it easier for people here finding the mistake.

 

Pictures of logfiles are useless most of the time. For example if some of your lines could not be adapted to the original loot.xml this would be shown much earlier in the logfile. Please use pastebin for the logfile and link to that.

 

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

You removed groupZpackReg01 but not 02 and 03.  Then you added another 02 and 03 group in your code.


When you are appending to the groupZpackReg, this is how it is going to look like the following:

 

<lootgroup name="groupZpackReg" count="all">
    <item group="groupZpackReg01" count="2"/>
    <item group="groupZpackReg02" loot_prob_template="med" force_prob="true"/>
    <item group="groupZpackReg03" loot_prob_template="low" force_prob="true"/>
    <item group="groupWoodOrStone" count="1" force_prob="true" />
    <item group="groupZpackReg01" count="1" />
    <item group="groupZpackReg02" loot_prob_template="medHigh" />
    <item group="groupZpackReg03" loot_prob_template="low" />    
</lootgroup>

 

or it may look like:

 

<lootgroup name="groupZpackReg" count="all">
    <item group="groupZpackReg01" count="2"/>
    <item group="groupZpackReg02" loot_prob_template="med" force_prob="true"/>
    <item group="groupZpackReg03" loot_prob_template="low" force_prob="true"/>

</lootgroup>
    <item group="groupWoodOrStone" count="1" force_prob="true" />
    <item group="groupZpackReg01" count="1" />
    <item group="groupZpackReg02" loot_prob_template="medHigh" />
    <item group="groupZpackReg03" loot_prob_template="low" />  

  

I don't use append to add lines into groups, so not sure if you got the path correct there.

 

Rather than removing and replacing, I would do the following:
 

<set xpath="//lootgroup[@name='groupZpackReg']/item[@group='groupZpackReg01']/@count">1</set>

<set xpath="//lootgroup[@name='groupZpackReg']/item[@group='groupZpackReg02']/@loot_prob_template">medHigh</set>

 

Try these changes and see what happens.

 

Also some QoL tips

 

Use comments and break your file into sections, easier to find what you need to change or fix - This is what I do

<!-- Increases stock numbers of ammo and magazines to account for removing quest rewards  -->
<!-- Ammo increases  -->
	<set xpath="//trader_item_group/item[@group='groupAllAmmo']/@count">4,8</set>

<!--  magazines increase - generic  -->
	<set xpath="//trader_items/item[@group='skillMagazines']/@count">4,8</set>

<!-- Unique magazine stock increases  -->
	<set xpath="//trader_item_group[contains(@name,'skillMagazinesTrader')]/item/@count">2,6</set>	

 

Also remove can be shortened  /> at the end rather than ></remove>
 

Link to comment
Share on other sites

Was literally thinking about pastebin as I was writing the post; but somehow forgot about it once I finished, my bad. And omg, knowing about that is so helpful, and allowed me figure out the problems almost instantly! Thank you! However, now I'm getting a new error, and I've looked through the ConfigsDump; however, I'm still just as confused. It tells me exactly where the problem is; but I don't see what's wrong about it: https://pastebin.com/41478XSV

 

Error in-game:

ERR XML loader: Patching 'loot.xml' from mod 'Living_Wilderness' failed:

EXC XML.Patch (/config/remove, line 30 at pos 6): XPath evaluation failed: This is an unclosed string.

 

Here's the modified loot.xml, which I just noticed has an extra </lootcontainers> at the end, after I saw it in pastebin; but I don't understand what's creating it:

https://pastebin.com/3wsypu7P

 

Edit: somehow spent about 3 hours without updating the page, so I didn't see your post BFT2020 until I posted this one.

Edited by Distinct Soul
Response to missed post (see edit history)
Link to comment
Share on other sites

Ok, so thanks to all you two's help, there are no longer any problems with the loot.xml; but I apologise, because it turns out, the original error was actually being caused by my spawning.xml. I had assumed it was the loot.xml as it was the most recent one I had edited, and I haven't modified the spawning.xml in a while.

Here's the error again so you don't have to scroll back up:

EXC ArgumentNullException: Value cannot be null.

Parameter name: Name cannot be null

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

 

After some thorough testing, I have found that the error occurs when I change the respawndelay to less than one, more specifically, the error started appearing after changing the value of night time zombies in the pine forest that have the notags: "commercial,industrial,downtown" to less than 1. Of course, this makes no sense, because there are already values with a respawndelay of less than 1. I actually was first testing this on a21.0; but updated specifically to see if that fixed it; but still get the same error.

Link to comment
Share on other sites

4 hours ago, Distinct Soul said:

Ok, so thanks to all you two's help, there are no longer any problems with the loot.xml; but I apologise, because it turns out, the original error was actually being caused by my spawning.xml. I had assumed it was the loot.xml as it was the most recent one I had edited, and I haven't modified the spawning.xml in a while.

Here's the error again so you don't have to scroll back up:

EXC ArgumentNullException: Value cannot be null.

Parameter name: Name cannot be null

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

 

After some thorough testing, I have found that the error occurs when I change the respawndelay to less than one, more specifically, the error started appearing after changing the value of night time zombies in the pine forest that have the notags: "commercial,industrial,downtown" to less than 1. Of course, this makes no sense, because there are already values with a respawndelay of less than 1. I actually was first testing this on a21.0; but updated specifically to see if that fixed it; but still get the same error.

 

That should give you a different error message about being outside the range.  Null means it doesn't have a value there or the value is corrupted and not recognizable.  I will check later as I can't access the log files via my work laptop, but if it is tied to your spawning file, then the game is looking for a value for a variable and finding the correct one (or nothing at all)

Link to comment
Share on other sites

6 hours ago, Distinct Soul said:

Ok, so thanks to all you two's help, there are no longer any problems with the loot.xml; but I apologise, because it turns out, the original error was actually being caused by my spawning.xml. I had assumed it was the loot.xml as it was the most recent one I had edited, and I haven't modified the spawning.xml in a while.

Here's the error again so you don't have to scroll back up:

EXC ArgumentNullException: Value cannot be null.

Parameter name: Name cannot be null

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

 

After some thorough testing, I have found that the error occurs when I change the respawndelay to less than one, more specifically, the error started appearing after changing the value of night time zombies in the pine forest that have the notags: "commercial,industrial,downtown" to less than 1. Of course, this makes no sense, because there are already values with a respawndelay of less than 1. I actually was first testing this on a21.0; but updated specifically to see if that fixed it; but still get the same error.

 

Really need to see your entire game log to see what is happening at the beginning when it starts to load things into the game

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