[#modding] [#bugs] adding a group with a custom NPC to CommonOddEncounters does not work

Issue #5772 resolved
David Nicholson created an issue

Hi,

I think this might be a bug, and not an issue with how I’ve written my mod, but I'd be happy to find out otherwise.

I’m sure you all have plenty of bigger fish to fry but thought you might want to know about this.

I'm attaching what I think is a minimum reproducible example as a zip.

Here’s steps to reproduce:

  • I add an NPC to ObjectBlueprints.xml

    • I am literally copying and pasting the way Arconauts are declared in the source, and just changing values for tags, so I think this should be right?
    • but this is the part that's probably most likely to be causing the issue, I think
  • I then add a PopulationTables.xml file with a new CommonOddEncouter group

    • again I am literally copying the "TrashAndArconaut" group and just changing the object from "Arconaut" to the NPC I added to ObjectBlueprints.xml
    • I make sure to “load=merge” where necessary
  • in-game I run a wish to confirm I can instantiate the added NPC, that dialogue works, etc.

The bug is that I never encounter the “TrashAndNPC” group that I have added.

To get some positive evidence that this is a bug, I did the following:

  • copy the “TrashAndNPC” group, but change it back to Arconauts
  • increase the number of Arconauts to ten so I can be sure I’ve encountered the group that I’ve added
  • increase the weight to 90 so it is more frequent
  • make the same changes to my “TrashAndNPC” group

After making these changes and wandering around underground for a while, I find that:

  • I do often encounter the “TrashAndTenArconauts” group that I added
  • I do not encounter the “TrashAndTenNPCs” group that I added

Minimum reproducible example attached as a zip.

Thanks for developing Qud, great game

--David

Comments (4)

  1. Armithaig

    Just a little oopsie in your second blueprint in ObjectBlueprints.xml

    <object Name="nqaldavood_Scholar" Inherits="nqaldavood_BaseScholar">
      <part Name="Render" DisplayName="Learned Scholar">
      <part Name="Rummager" />
    </object>
    

    The first part’s missing its self-closing /

    If you open up your player log after starting the game, it’ll display an error like this, which’s very helpful when debugging your mod

    MODERROR [Test] - System.Xml.XmlException: The 'part' start tag on line 43 position 4 does not match the end tag of 'object'.
    

  2. David Nicholson reporter

    Confirmed that resolves it, thank you @Armithaig !

    I should have known it would be just an xml typo – I have now installed a formatter (which would’ve been smart).

    And it’s very helpful to know about the log, much appreciated.

  3. Log in to comment