Trait - basarab1504/ReligionMod GitHub Wiki
When Rimworld generates a pawn it's a process with a few incremental steps:
- generate appereance
- generate name and bio
- generate traits
- generate skills
Something like this. So, important thing that should be mentioned: when game generates traits it will look on bio of pawn. So when we edit tags to make a trait def - game will use them to compare with a pawn's bio.
<Religion.TraitDef_ReligionTrait>
<defName>YourReligionDefName</defName>
<commonality>0.3</commonality>
<degreeDatas>
<li>
<label>YourReligion Faith</label>
<description>{PAWN_nameDef} believes in YourReligionGod.</description>
</li>
</degreeDatas>
<conflictingTraits>
<li>Pyromaniac</li>
<li>Abrasive</li>
<li>Psychopath</li>
<li>Cannibal</li>
</conflictingTraits>
<requiredWorkTags>
<li>Social</li>
</requiredWorkTags>
<disabledWorkTags>Violent</disabledWorkTags>
<foreignReligions>
<li>OtherReligionDefName</li>
</foreignReligions>
</Religion.TraitDef_ReligionTrait>
We start with defining a new TraitDef:
<Religion.TraitDef_ReligionTrait>
...
</Religion.TraitDef_ReligionTrait>
Then we put required tags:
<defName>MotherReligion</defName>
<commonality>0.3</commonality>
<degreeDatas>
<li>
<label>Mother Faith</label>
<description>{PAWN_nameDef} believes in Great Mother.</description>
</li>
</degreeDatas>
Commonality defines how often trait will be assigning to pawns. The higher number the highest frequency.
<commonality>0.3</commonality>
Now we going to put restrictions for our trait. Every tag you'll add here will NOT do anything to a pawn exactly (editing skills, bio, etc). The game will decide if you can add a trait to your character, based only on whether the character’s biography allows it.
If you want to add some traits which are inappropriate for your religion - put them here. If pawn have one of this list - he will not convert by every possible way.
<conflictingTraits>
<li>Pyromaniac</li>
<li>Abrasive</li>
<li>Psychopath</li>
<li>Cannibal</li>
</conflictingTraits>
Maybe you want to make a religion where it is a crime to cut a plant - here you are. Put defName in this list and now your game will not spawn a pawn with your trait and enabled Plant Cutting work type. Doesn't affect on gaining trait in-game.
<requiredWorkTypes>
...
</requiredWorkTypes>
Same with disabledWorkTypes.
<disabledWorkTypes>
...
</disabledWorkTypes>
Now let's talk about WorkTypes and WorkTags. WorkType - is a concrete type of work, like Firefighting, Doctor, Cooking, etc. WorkType is a everything you can assign pawn in the Work tab. Several WorkTypes may have one WorkTag. For example: Growing is a concrete WorkType and it's WorkTags are ManualSkilled and PlantWork. If you put Growing in disabledWorkTypes list - no pawns with enabled Growing and your religion trait will be generate. But you add PlantWork in disabledWorkTags list - no pawn with Growing and PlantCutting and your trait. Pretty simple.
<requiredWorkTags>
...
</requiredWorkTags>
<disabledWorkTags>
...
</disabledWorkTags>
Pawns of aggressive religion will have a bad opinion to pawns of any other religion. Put "true" or "false"
<isAgressive>
</isAgressive>
Pawns with our religion trait will have a bad opinion to pawns of religion from this list as well.
<foreignReligions>
...
</foreignReligions>