RimWorld

RimWorld

Giddy-Up 2
Harmonea 24. mar. 2023 kl. 0:37
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.
< >
Viser 1-3 af 3 kommentarer
Owlchemist  [udvikler] 24. mar. 2023 kl. 1:03 
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 24. mar. 2023 kl. 2:44 
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 4. apr. 2023 kl. 5:22 
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!!!
Sidst redigeret af Sinnamon; 4. apr. 2023 kl. 5:25
< >
Viser 1-3 af 3 kommentarer
Per side: 1530 50