Setting a fixed pawn skin color via C#?

Started by Temeez, December 25, 2014, 08:06:16 AM

Previous topic - Next topic

Temeez

Hey,

I'm trying to mod a new race and I really want to set a fixed(non random) skin color (and trait(s)), but I'm having a problem of figuring out how to do that without "hacking" and setting pawn textures as armors <.<

I'm not sure if its possible, but at least when I tried to do something like this, it didn't work:
    internal class FooPawn : Pawn
    {
        public static readonly Color FooSkin = new Color(34,197,238);

        public FooPawn()
        {
        }

        public virtual void ExposeData()
        {
            base.ExposeData();
            this.story.skinColor = FooSkin;
        }

    }


I'm guessing that it didn't work because the game sets the skin color sometimes after ExposeData(), but even so, I have no idea how to go around that. I hope that someone can help me.

I guess it would also work if I could somehow override (or add to it (if race == "Foo" then use these colors..)) "public static Color RandomSkinColor()" for the new race, but again, I don't know how to.  :'(

mipen

If I remember correctly, the pawn skin colour is tied into it's back story. To change it in the pawns class, you could try changing it on spawnsetup, exposedata, and also add a check in the tick method which checks the pawns skin colour, and if it isn't the one you want, then changes it. It's a little inelegant, but gets the job done. At least I think it does :P

Temeez

Thanks, I'll have to look into it at some point. :)