Caves of Qud

Caves of Qud

WM Extended Mutations [Stable Edition]
World Gen Errors
Encountered this exception during world generation:
Error making heroic: Aloe Fugues -> System.NullReferenceException: Object reference not set to an instance of an object at XRL.World.Parts.Mutation.SerpentineForm.Mutate (XRL.World.GameObject GO, System.Int32 Level) [0x00031] in C:\Program Files (x86)\Steam\steamapps\workshop\content\333640\2198787801\Mutations\Physical\SerpentineForm.cs:76 at XRL.World.Parts.Mutations.AddMutation (XRL.World.Parts.Mutation.BaseMutation NewMutation, System.Int32 Level, System.Boolean Sync) [0x00159] in XRL.World.Parts\Mutations.cs:483 at XRL.World.HeroMaker.MakeHero (XRL.World.GameObject BaseCreature, System.String[] AdditionalBaseTemplates, System.String[] AdditionalSpecializationTemplates, System.Int32 TierOverride, System.String SpecialType) [0x00725] in XRL.World\HeroMaker.cs:174

In SerpentineForm.cs, there are a few places that assume a creature has a Body, resulting in exceptions for creatures like Aloe Fugues above. I see examples on lines 76, 108, and 252.

For example, on line 76
BodyPart firstPart = ParentObject.GetPart<Body>().GetFirstPart(BodyPartType);
should handle the case when GetPart<Body>() returns null. You might do something like:
BodyPart firstPart = ParentObject.GetPart<Body>()?.GetFirstPart(BodyPartType); if (firstPart == null) { // handle null body
or
BodyPart firstPart; var body = ParentObject.GetPart<Body>(); if (body != null) { firstPart = GetFirstPart(BodyPartType)
< >
Showing 1-3 of 3 comments
Tyrir 1 Jan @ 6:46pm 
Also just noticed that on line 252 in SerpentineForm.cs,
BodyPart firstPart = this.ParentObject.GetPart<Body>()?.GetFirstPart(this.BodyPartType); SerpentileTail = GameObject.Create("Serpentine Tail"); if (firstPart == null || firstPart.Equipped != SerpentileTail) { firstPart.Equipped?.UnequipAndRemove(); firstPart.Equip(SerpentileTail, Forced: true); }

for the conditional, I think you meant `firstPart != null && firstPart.Equipped != SerpentineTail` ?
Winged_Monotone  [developer] 1 Jan @ 9:39pm 
thought I had caught everything, thanks I'll add these to the fixes for the next push
Last edited by Winged_Monotone; 1 Jan @ 9:39pm
Winged_Monotone  [developer] 1 Jan @ 9:43pm 
Originally posted by Tyrir:
Also just noticed that on line 252 in SerpentineForm.cs,
BodyPart firstPart = this.ParentObject.GetPart<Body>()?.GetFirstPart(this.BodyPartType); SerpentileTail = GameObject.Create("Serpentine Tail"); if (firstPart == null || firstPart.Equipped != SerpentileTail) { firstPart.Equipped?.UnequipAndRemove(); firstPart.Equip(SerpentileTail, Forced: true); }

for the conditional, I think you meant `firstPart != null && firstPart.Equipped != SerpentineTail` ?


Not sure what I am trying to do here actually lol, I am going through the process of removing all the FireEvents and swapping to HandleEvents and i must of overlooked this. I think I was trying to make some kind of catch for when the tail somehow magically gets unequipped.
< >
Showing 1-3 of 3 comments
Per page: 1530 50