Animal Defs

Started by Raxbit, August 07, 2018, 10:23:55 AM

Previous topic - Next topic

Raxbit

I'm fairly new to modding and I've been trying to modify animal behavior after pregnancy I had no problems replacing the pregnancy hediff code with my own but I have two questions for anyone who can answer.

1. Where can I locate the animal defs in the xml files?
2. What would be the best way to modify an animal pawns definitions such as base mass and wildness for an individual animal from within the code after you have the pawn object you are looking to modify? Is there a particular Utility class for this or a way to modify the read only values?

RawCode

rimworld store "stats" of pawns inside database, record is shared over all pawns of specific kind, you can't set arbitrary values for specific pawn.

to implement such thing, you will C# and custom classes, not possible with XML only (as long as you not going to pregenerate zillion defs)

Raxbit

That was my plan, I just don't know how to go about modifying those values as they are readonly, my custom code sits on the DoBirthSpawn of the Hediff_Pregnant class to override the default birth code, it is mostly the same atm as modifying these values is the base of all my ideas, I wanted to see the xml files for animals so I have idea of how all the stats are scaled compared to other animals.

I figured since I was overriding the default spawning code, I could get around the fact that the records are shared, I've been thinking is adding hediff's for all my desired stat changes a better way of modifying these values, or is there a more direct route of modifying the animal/pawn within the code?

RawCode

use hidden hediffs as "buffs" this won't allow you to change anything, but lot's of things can be changed this way.

you can give your animals hidden gear, that can be both armor and weapons to alter sprite and attack stats.

you can setup very variable effects from animal age and manipulate age.

but this all workarounds and you really should provide custom class for your pawn that support arbitrary changed.

Raxbit

#4
Thanks for the advice, didn't realize you could create hidden gear and hediffs which could do some of stuff I want, but i guess a custom pawn class is best way forward, more work than I expected but since the main things I want to affect are move and eat speed; leather and milk returns; wildness and dietary restrictions I'll look into doing that.