Swap out pawn with new def?

Started by Orion, January 16, 2015, 04:04:11 AM

Previous topic - Next topic

Orion

I'm trying to swap out an existing pawn with a similar one that has a different pawn and race def. Obviously I'd like the new one to stay at the same position.

Also I want to retain all healthTracker data (this is the trickiest part, it seems). Does anyone have experience doing this?

Gaesatae

Check the ticks controlled events thread pinned at the top of this subforum. I believe the code has something very similar to your idea.

Orion

Thanks so much for pointing me that way!

What I had missed was using
IntVec3 pos = GenCellFinder.RandomStandableClosewalkCellNear(Position, 2);
to find a suitable position and
GenSpawn.Spawn(newPawn, pos);
to finally place it correctly.

Awesome!