RimWorld

RimWorld

Giddy-Up 2
Harmonea Mar 24, 2023 @ 12:37am
Default constructor not found for Verse.PawnKindDef[]
Hi there,

I'm trying to patch a personal mod's pawnkind to use the CustomMounts property as directed in the github wiki. My patch is as follows:

<li Class="PatchOperationAddModExtension"> <xpath>Defs/PawnKindDef[defName="HS.Cavalry"]</xpath> <value> <li Class="GiddyUp.CustomMounts"> <mountChance>95</mountChance> <possibleMounts> <li> <key>Horse</key> <value>1</value> </li> </possibleMounts> </li> </value> </li>

Pardon me if I've missed something obvious, but I think my syntax is exactly like the example. I also tried the MayRequire example at the bottom of the wiki page, but it broke there as well.

By "broke" I mean when I start the game, I get this error:

Exception loading from System.Xml.XmlElement: System.MissingMethodException: Default constructor not found for type Verse.PawnKindDef[] at System.RuntimeType.CreateInstanceMono (System.Boolean nonPublic) [0x0007b] in <eae584ce26bc40229c1b1aa476bfa589>:0 at System.RuntimeType.CreateInstanceSlow (System.Boolean publicOnly, System.Boolean skipCheckThis, System.Boolean fillCache, System.Threading.StackCrawlMark& stackMark) [0x00009] in <eae584ce26bc40229c1b1aa476bfa589>:0 at System.RuntimeType.CreateInstanceDefaultCtor (System.Boolean publicOnly, System.Boolean skipCheckThis, System.Boolean fillCache, System.Threading.StackCrawlMark& stackMark) [0x00027] in <eae584ce26bc40229c1b1aa476bfa589>:0 at System.Activator.CreateInstance (System.Type type, System.Boolean nonPublic) [0x00020] in <eae584ce26bc40229c1b1aa476bfa589>:0 at System.Activator.CreateInstance (System.Type type) [0x00000] in <eae584ce26bc40229c1b1aa476bfa589>:0 at Verse.DirectXmlToObject.ObjectFromXml[T] (System.Xml.XmlNode xmlRoot, System.Boolean doPostLoad) [0x0040b] in <3f18ad3e53b3425f9e38babcac471e1f>:0 at Verse.DirectXmlToObject.ObjectFromXmlReflection[T] (System.Xml.XmlNode xmlRoot, System.Boolean doPostLoad) [0x00000] in <3f18ad3e53b3425f9e38babcac471e1f>:0 at Verse.DirectXmlToObject.ObjectFromXml[T] (System.Xml.XmlNode xmlRoot, System.Boolean doPostLoad) [0x007cc] in <3f18ad3e53b3425f9e38babcac471e1f>:0 (Filename: C:\buildslave\unity\build\Runtime/Export/Debug/Debug.bindings.h Line: 39)

And upon sending a max strength test raid, the HS.Cavalry pawns appear to have the same MountChance as the rest of the faction (quite low). Note the pawnkind IS spawning without errors, so I don't think there's an issue with the pawnkind def, which is about 80% copied from another mod anyway (hey, personal use only eh).

This is tested with a rather minmal mod list; only Medieval Overhaul (upon which my faction is dependent) and its dependencies.

I'm not sure if I've found a bug or I've done something wrong, but I'd appreciate any assistance.
< >
Showing 1-3 of 3 comments
Owlchemist  [developer] Mar 24, 2023 @ 1:03am 
Hi - your extension portion of the patch looks correct. But I think something is wrong with the general patch itself (nothing mod specific). Like the defName is wrong or something, I'm not sure without seeing the rest of the xml files involved.
Harmonea Mar 24, 2023 @ 2:44am 
I have no idea, all the defNames are correct -- copy-pasted to be completely sure -- but I couldn't ask for any more of your time for what's surely my error somewhere. Appreciate your quick response and thanks for your mod work.
Sinnamon Apr 4, 2023 @ 5:22am 
I think patching PawnKindDef doesn't really work very well... I could also be making mistakes, but
<li Class="PatchOperationAddModExtension"> <xpath>/Defs/PawnKindDef[defName = "DEFNAME"]</xpath> <value> <li Class="GiddyUp.CustomStats"> <speedModifier>1.4</speedModifier> <armorModifier>1.0</armorModifier> <useMetalArmor>true</useMetalArmor> </li> </value> </li>
doesn't seem to work...
It does work when I use the MayRequire instead though...

////////////////////////////////////////////////
EDIT
////////////////////////////////////////////////
sorry! I did not change PatchOperationFindMod part for the patch!!!
Last edited by Sinnamon; Apr 4, 2023 @ 5:25am
< >
Showing 1-3 of 3 comments
Per page: 1530 50