RimWorld

RimWorld

Misc. MAI
XXYY君 17 Jul, 2017 @ 3:21am
Error while activating MAI
I got an error while activating an enhanced MAI, after that, the MAI didn't appear and my resources were consumed. Below is the error log.

Error while creating AIPawnE.
Cannot cast from source type to destination type.
STACK:
at AIPawn.AIPawnGenerator.GeneratePawn (Verse.PawnGenerationRequest& request, Verse.Map map, Int32 tries) [0x00000] in <filename unknown>:0
at AIPawn.AIPawnGenerator.GeneratePawn (System.String kindDefName, RimWorld.Faction faction, Verse.Map map, Gender gender) [0x00000] in <filename unknown>:0
at AIPawn.Building_AIPawnCreator.CreateAIPawn (System.String pawnDefName, IntVec3 position, Verse.Map map, RimWorld.Faction faction, Gender gender) [0x00000] in <filename unknown>:0
at AIPawn.Building_AIPawnCreator.CreateAIPawn (System.String pawnDefName, IntVec3 position, Verse.Map map, Gender gender) [0x00000] in <filename unknown>:0
at AIPawn.Building_AIPawnCreator.Create () [0x00000] in <filename unknown>:0
at AIPawn.Building_AIPawnCreatorEnhanced.Create () [0x00000] in <filename unknown>:0
at AIPawn.Building_AIPawnCreator.Tick () [0x00000] in <filename unknown>:0
Verse.Log:Error(String)
AIPawn.Building_AIPawnCreator:Tick()
AIPawn.Building_AIPawnCreatorEnhanced:Tick()
Verse.TickList:Tick()
Verse.TickManager:DoSingleTick()
Verse.TickManager:TickManagerUpdate()
Verse.Game:UpdatePlay()
Verse.Root_Play:Update()
< >
Showing 1-15 of 15 comments
XXYY君 17 Jul, 2017 @ 5:17am 
After careful testing, I found out that this mod is not compatible with the Psychology mod. If I removed the Psychology mod, the MAI would spawn successfully.
whatthegeek 17 Jul, 2017 @ 4:36pm 
I have a very similar error. The MAI doesn't disappear, but when I go to activate it, it doesn't activate. The resources are consumed and the MAI just stays deactivated as though I hadn't installed a core. I never got an error message though. Out of curiosity, how did you figure out it was related to Psychology? I'm using that mod too, but I was actually able to activate one MAI w/ it turned on a couple of days ago.
XXYY君 17 Jul, 2017 @ 7:10pm 
Originally posted by whatthegeek:
I have a very similar error. The MAI doesn't disappear, but when I go to activate it, it doesn't activate. The resources are consumed and the MAI just stays deactivated as though I hadn't installed a core. I never got an error message though. Out of curiosity, how did you figure out it was related to Psychology? I'm using that mod too, but I was actually able to activate one MAI w/ it turned on a couple of days ago.
I tested several times - without Psychology, Psychology before Misc. MAI, and Psychology after Misc. MAI. The only one function normally is the one without Psychology.

Misc. MAI has a research dealing the socializing part of MAI which I didn't research at the moment I got the error. When a mod touches social part of the some thing, Psychology is supposed to involve. Also, I knew Psychology is buggy with EdB Prepare Carefully before(save presets/characters error), so I decided to test it.
XXYY君 17 Jul, 2017 @ 7:13pm 
There may have some other mod conflicts as well, but anyway, I fix the problem by removing Psychology.
whatthegeek 18 Jul, 2017 @ 6:30am 
Makes sense, thanks.

I tested some last night myself, and yea, Psychology is definitely causing the problem for me too. Based on this thread (I see you were already in there, don't know if you checked back in though) it sounds like it's going to be on MAI's dev to fix it https://steamhost.cn/steamcommunity_com/workshop/filedetails/discussion/959814527/2592234299556754031/?ctp=14
XXYY君 18 Jul, 2017 @ 7:07am 
Originally posted by whatthegeek:
Makes sense, thanks.

I tested some last night myself, and yea, Psychology is definitely causing the problem for me too. Based on this thread (I see you were already in there, don't know if you checked back in though) it sounds like it's going to be on MAI's dev to fix it https://steamhost.cn/steamcommunity_com/workshop/filedetails/discussion/959814527/2592234299556754031/?ctp=14

Looks like MAI is not vanilla-friendly regarding the pawn spawning... @Haplo_X1
Haplo_X1  [developer] 18 Jul, 2017 @ 9:13am 
Mai uses the AIPawn class that is a derivate of the Vanilla Pawn class. Still it's based on the Pawn class, just with a bit extra overhead. I have no idea what Psychologie does to prevent the creation though. Maybe a redirect of the base Pawn class? That is possible with Harmony. Just not what I would recommend if one is looking for compatibility.. And they tell me, my class is badly programmed...

Mai itself doesn't use a function detour (like Harmony).
It uses a recreation of the Pawn when the backstory doesn't fit.

But whatever. For now MAI just is not compatible with Psychology. Sorry.

Drood 7 Aug, 2017 @ 12:50pm 
or Therapy... cant remove psychology or therapy it breaks my game... so mai goes back in the box :(
XXYY君 7 Aug, 2017 @ 6:55pm 
Originally posted by Vinshero:
or Therapy... cant remove psychology or therapy it breaks my game... so mai goes back in the box :(
I use Therapy as well, and haven't found any issue with MAI. I think it's just Psychology causing problem.
Haplo_X1  [developer] 8 Aug, 2017 @ 12:12pm 
The problem is Psychology. It modifies the base Pawn class in a way that makes it incompatible with MAIs derivate AIPawn class for some reason. This is something that I can not fix. So as long as Psychology doesn't fix the way that the Pawn classes are modified to be incompatible, MAI and Psychology will remain incompatible.
Redstark Magnusson 19 Dec, 2018 @ 12:39pm 
Alright, got a similar issue in all but cause. Apparently the Stand-alone shield mod is causing my MAI's to not activate properly. I get a line at the very start of the error that says:

Error while creating AIPawn. Object reference not set to an instance of an object STACK: at Shield.Harmonypatches.ShieldPatchWearApparel (Verse.Pawn_EquipmentTracker,RimWorld.Apparel) <0x000a5> at (wrapper dynamic-method) RimWorld.Pawn_ApparelTracker.Wear_Patch3 (object,RimWorld.Apparel,bool) <0x00554> at AIPawn.AIPawnGenerator.GenerateBaseApparel (Verse.Pawn) <0x000ea> at AIPawn.AIPawnGenerator.GenerateAIPawn (Verse.PawnGenerationRequest&,Verse.Map,int) <0x00603> at AIPawn.AIPawnGenerator.GenerateAIPawn (string,RimWorld.Faction,Verse.Map,Verse.Gender) <0x00229> at AIPawn.Building_AIPawnCreator.CreateAIPawn (string,Verse.IntVec3,Verse.Map,RimWorld.Faction,Verse.Gender) <0x0006a> at AIPawn.Building_AIPawnCreator.CreateAIPawn (string,Verse.IntVec3,Verse.Map,Verse.Gender) <0x0005d> at AIPawn.Building_AIPawnCreator.Create () <0x0006e> at AIPawn.Building_AIPawnCreator.Tick () <0x00079>
Haplo_X1  [developer] 20 Dec, 2018 @ 12:07am 
This is more an issue with the shield mod. It has something added via Harmony that doesn't like something in MAI.. The only thing I could do is write an error catch for this, but not a fix..
Redstark Magnusson 20 Dec, 2018 @ 11:24am 
I've also sent the error to the shield-mod current dev, which has recently changed his methods to a new one, which causes the issue. Pardon the inconvenience, gotta wait for his fix.
Haplo_X1  [developer] 20 Dec, 2018 @ 11:44am 
I've updated the code so that you should still get the error but it shouldn't crash the creation process anymore. So now it should create the MAI even through the error :)
Ah, thanks. I don't know if the whole MAI will still work though, i've tried directly spawning the MAI's afterwards, and they give a similar error and instantly despawned. But i'll have to try, and see if it works now.

Edit/Repost: Thanks a lot, the error being caught stopped the MAI from being despawned!
< >
Showing 1-15 of 15 comments
Per page: 1530 50