Difference between revisions of "Modding Tutorials/Xenotypes"

From RimWorld Wiki
Jump to navigation Jump to search
(→‎Adding xenotypes to generated pawns: Expand and clarify section on interaction between multiple xenotypeSets. Small style note: It may be misleading to emphasize the order in which the chances are added up, as if to imply that this order is important)
 
(6 intermediate revisions by one other user not shown)
Line 1: Line 1:
{{Recode|reason=Sanguophage uses a bunch of special options - add these}}
+
[[Xenotypes]] offer a wide range of possibilities for modders.
The following is the template for assembling xenotypes from the [[genes]] in the game. Under each heading the existing genes are listed. Simply delete or comment out the genes you do not wish to include. This is best done by editing or viewing the source of this page and copy and pasting from there.  
+
 
 +
== Xenotype template ==
 +
{{Recode|reason=1) Make collapsible 2) Sanguophage uses a bunch of special options - add these}}
 +
The following is the template for assembling xenotypes from the [[genes]] in the game. Under each heading the existing genes are listed. Simply delete or comment out the genes you do not wish to include. This is best done by editing or viewing the source of this page and copy and pasting from there. Do not include the <nowiki><pre> and </pre> tags</nowiki>
  
 
It is accurate as of the 1st of November 2022. It is originally provided by Ryflamer but has since been modified.
 
It is accurate as of the 1st of November 2022. It is originally provided by Ryflamer but has since been modified.
Line 16: Line 19:
 
<nameMaker>NamerPersonDirtmole_Male</nameMaker> <!-- If omitted, the default name generator will be used. If this is used but nameMakerFemale is omitted, it will be used for both genders -->
 
<nameMaker>NamerPersonDirtmole_Male</nameMaker> <!-- If omitted, the default name generator will be used. If this is used but nameMakerFemale is omitted, it will be used for both genders -->
 
<nameMakerFemale>NamerPersonDirtmole_Female</nameMakerFemale>
 
<nameMakerFemale>NamerPersonDirtmole_Female</nameMakerFemale>
<chanceToUseNameMaker>1</chanceToUseNameMaker>  
+
<chanceToUseNameMaker>1</chanceToUseNameMaker>
 
         <combatPowerFactor>1.5</combatPowerFactor>  <!-- Can be omitted for 1x factor -->
 
         <combatPowerFactor>1.5</combatPowerFactor>  <!-- Can be omitted for 1x factor -->
 
<genes>
 
<genes>
Line 295: Line 298:
 
</pre>
 
</pre>
  
[[Category: Modding Tutorials]]
+
== Adding xenotypes to generated pawns ==
 +
{{Stub|section=1|reason=More details on how pawnkind and ideoligion generation affects xenotype selection. Information on <code>MustBeCapableOfViolence</code> flag on pawn generation request.}}
 +
[[Factions]] have their distribution of xenotypes set in their faction def at the top level by the following:
 +
<pre>
 +
    <xenotypeSet>
 +
      <xenotypeChances>
 +
        <Neanderthal MayRequire="Ludeon.RimWorld.Biotech">0.05</Neanderthal>
 +
        <Hussar MayRequire="Ludeon.RimWorld.Biotech">0.15</Hussar>
 +
        <Genie MayRequire="Ludeon.RimWorld.Biotech">0.10</Genie>
 +
      </xenotypeChances>
 +
    </xenotypeSet>
 +
</pre>
 +
<small>Note: The above is for a faction that is not defined by the [[Biotech DLC]], hence the may require. This difference is irrelevant to the interpretation method chosen.</small>
 +
These values are then interpreted one of two ways.
 +
First:
 +
If the values add up to less than 1.0, then they are interpreted as percentage chances for a pawn, absent any other xenotype selections, to be that xenotype, with the remainder being the chance to be a baseliner. In the above example, as the sum of 0.05, 0.15, and 0.10 is only 0.30. As this is less than 1.0, there is a 5% chance for a pawn from that faction to be a [[neanderthal]], a 15% chance to be a [[hussar]], a 10% chance to be a genie, and a 70% chance to be baseliner.
 +
 
 +
Second:
 +
If the values exceed 1.0, then the values are instead interpreted as a weight, where the chance is equal to the value for that xenotype divided by the sum of all the weights given. If baseliners are not included as a weight, they are excluded
 +
 
 +
For example:
 +
<pre>
 +
    <xenotypeSet>
 +
      <xenotypeChances>
 +
        <Neanderthal>999</Neanderthal>
 +
      </xenotypeChances>
 +
    </xenotypeSet>
 +
</pre>
 +
<small>Note: The above is for a faction that is defined by the [[Biotech DLC]], hence the lack of may require. This difference is irrelevant to the interpretation method chosen.</small>
 +
Neanderthals have a (999/999)*100%, or a 100% chance to be selected.
 +
 
 +
Additional xenotypeSet definitions can be made in [[memes]]{{Hover title|link=no|At the time of writing (version 1.4.3704), no memes in the official content contain xenotypeSet definitions.|<sup>[Note]</sup>}} and PawnKinds. Whenever a pawn generation request is made, the generator sums the xenotype chances from the faction, the PawnKind, and each meme of the faction's primary ideoligion. The totals are then interpreted as either probabilities or weights, as described above.
 +
 
 +
For example, suppose a pawn is generated using the faction at the top of this section and a PawnKind with the following configuration:
 +
<pre>
 +
    <xenotypeSet>
 +
      <xenotypeChances>
 +
        <Highmate>0.25</Highmate>
 +
        <Genie>0.15</Genie>
 +
      </xenotypeChances>
 +
    </xenotypeSet>
 +
</pre>
 +
The chances will be added together, resulting in Neaderthal=0.05, Hussar=0.15, Genie=0.25 (from adding 0.10 and 0.15), and Highmate=0.25. The total of all of these is 0.7, leaving baseliners with a chance of 0.3.
 +
 
 +
Note that a PawnKind may have <code><useFactionXenotypes>false</useFactionXenotypes></code>, which causes the faction's xenotypeSet to be ignored.
 +
 
 +
[[Category: Modding tutorials]]

Latest revision as of 20:49, 24 July 2023

Xenotypes offer a wide range of possibilities for modders.

Xenotype template[edit]

The following is the template for assembling xenotypes from the genes in the game. Under each heading the existing genes are listed. Simply delete or comment out the genes you do not wish to include. This is best done by editing or viewing the source of this page and copy and pasting from there. Do not include the <pre> and </pre> tags

It is accurate as of the 1st of November 2022. It is originally provided by Ryflamer but has since been modified.

<?xml version="1.0" encoding="utf-8"?>
<Defs>    
	<XenotypeDef>
		<defName>xenotypedefname</defName>
		<label>ingame name</label>
		<description>A long description goes here, where you can describe the lore and whatever</description>
		<descriptionShort>A shorter description goes here</descriptionShort>
		<iconPath>UI/Icons/Xenotypes/Hussar</iconPath>
		<inheritable>true</inheritable> <!-- Can be omitted for not inheritable -->
		<nameMaker>NamerPersonDirtmole_Male</nameMaker> <!-- If omitted, the default name generator will be used. If this is used but nameMakerFemale is omitted, it will be used for both genders -->
		<nameMakerFemale>NamerPersonDirtmole_Female</nameMakerFemale>
		<chanceToUseNameMaker>1</chanceToUseNameMaker>
        <combatPowerFactor>1.5</combatPowerFactor>  <!-- Can be omitted for 1x factor -->
		<genes>
			<!-- ======================================== Visual Genes ======================================== -->
			<!-- ==================== Beard ==================== -->
			<!-- <li>Beard_Always</li> -->
			<!-- <li>Beard_NoBeardOnly</li> -->
			<!-- <li>Beard_BushyOnly</li> -->
			<!-- ==================== Beard ==================== -->
			<!-- ==================== Bodies ==================== -->
			<!--<li>Body_Hulk</li>-->
			<!--<li><li>Body_Thin</li>-->
			<!--<li><li>Body_Standard</li>-->
			<!-- <li>Body_Fat</li> -->
			<!-- ==================== Bodies ==================== -->
			<!-- ==================== Brows ==================== -->
			<!-- <li>Brow_Heavy</li> -->
			<!-- ==================== Brows ==================== -->
			<!-- ==================== Ears ==================== -->
			<!-- <li>Ears_Cat</li> -->
			<!-- <li>Ears_Floppy</li> -->
			<!-- <li>Ears_Human</li> -->
			<!-- <li>Ears_Pig</li> -->
			<!-- <li>Ears_Pointed</li> -->
			<!-- ==================== Ears ==================== -->
			<!-- ==================== Eyes ==================== -->
			<!-- <li>Eyes_Red</li> -->
			<!-- <li>Eyes_Gray</li> -->
			<!-- ==================== Eyes ==================== -->
			<!-- ==================== Facial Overlay ==================== -->
			<!-- <li>FacialRidges</li> -->
			<!-- ==================== Facial Overlay ==================== -->
			<!-- ==================== Hands ==================== -->
			<!-- <li>ElongatedFingers</li> -->
			<!-- <li>Hands_Human</li> -->
			<!-- <li>Hands_Pig</li> -->
			<!-- ==================== Hands ==================== -->
			<!-- ==================== Hair ==================== -->
			<!-- <li>Hair_BaldOnly</li>-->
			<!-- <li>Hair_ShortOnly</li>-->
			<!-- <li>Hair_LongOnly</li> -->
			<!-- <li>Hair_Grayless</li> -->
			<!-- <li>Hair_Pink</li>-->
			<!-- <li>Hair_Blonde</li>-->
			<!-- <li>Hair_SandyBlonde</li>-->
			<!-- <li>Hair_ReddishBrown</li>-->
			<!-- <li>Hair_DarkBrown</li>-->
			<!-- <li>Hair_DarkSaturatedReddish</li>-->
			<!-- <li>Hair_DarkReddish</li>-->
			<!-- <li>Hair_MidBlack</li>-->
			<!-- <li>Hair_DarkBlack</li>-->
			<!-- <li>Hair_InkBlack</li>-->
			<!-- <li>Hair_SnowWhite</li> -->
			<!-- <li>Hair_Gray</li> -->
			<!-- <li>Hair_LightOrange</li> -->
			<!-- <li>Hair_SandyBlonde</li> -->
			<!-- <li>Hair_LightPurple</li> -->
			<!-- <li>Hair_LightBlue</li> -->
			<!-- <li>Hair_LightTeal</li> -->
			<!-- <li>Hair_LightGreen</li> -->
			<!-- <li>Hair_BrightRed</li> -->
			<!-- ==================== Hair ==================== -->
			<!-- ==================== Head ==================== -->
			<!-- <li>Headbone_MiniHorns</li> -->
			<!-- <li>Head_Gaunt</li> -->
			<!-- ==================== Head ==================== -->
			<!-- ==================== Horns ==================== -->
			<!-- <li>Headbone_Human</li> -->
			<!-- <li>Headbone_CenterHorn</li> -->
			<!-- <li>Headbone_MiniHorns</li> -->
			<!-- ==================== Horns ==================== -->
			<!-- ==================== Jaw ==================== -->
			<!-- <li>Jaw_Baseline</li> -->
			<!-- <li>Jaw_Heavy</li> -->
			<!-- ==================== Jaw ==================== -->
			<!-- ==================== Skin ==================== -->
			<!-- <li>Furskin</li> -->
			<!-- <li>Skin_Blue</li> -->
			<!-- <li>Skin_DeepRed</li> -->
			<!-- <li>Skin_DeepYellow</li> -->
			<!-- <li>Skin_Green</li> -->
			<!-- <li>Skin_InkBlack</li> -->
			<!-- <li>Skin_LightGray</li> -->
			<!-- <li>Skin_Orange</li> -->
			<!-- <li>Skin_PaleRed</li> -->
			<!-- <li>Skin_PaleYellow</li> -->
			<!-- <li>Skin_Purple</li> -->
			<!-- <li>Skin_SheerWhite</li> -->
			<!-- <li>Skin_SlateGray</li> -->
			<!-- <li>Skin_Melanin1</li> -->
			<!-- <li>Skin_Melanin2</li> -->
			<!-- <li>Skin_Melanin3</li> -->
			<!-- <li>Skin_Melanin4</li> -->
			<!-- <li>Skin_Melanin5</li> -->
			<!-- <li>Skin_Melanin6</li> -->
			<!-- <li>Skin_Melanin7</li> -->
			<!-- <li>Skin_Melanin8</li> -->
			<!-- <li>Skin_Melanin9</li> -->
			<!-- ==================== Skin ==================== -->
			<!-- ==================== Nose ==================== -->
			<!-- <li>Nose_Human</li> -->
			<!-- <li>Nose_Pig</li> -->
			<!-- ==================== Nose ==================== -->
			<!-- ==================== Tail ==================== -->
			<!-- <li>Tail_Furry</li> -->
			<!-- <li>Tail_Smooth</li> -->
			<!-- ==================== Tail ==================== -->
			<!-- ======================================== Stat Genes ======================================== -->
			<!-- ==================== Abilities ==================== -->
			<!-- <li>AcidSpray</li> -->
			<!-- <li>AnimalWarcall</li> -->
			<!-- <li>Bloodfeeder</li> -->
			<!-- <li>Coagulate</li> -->
			<!-- <li>FireSpew</li> -->
			<!-- <li>FoamSpray</li> -->
			<!-- <li>LongjumpLegs</li> -->
			<!-- <li>PiercingSpine</li> -->
			<!-- <li>Resurrect</li> -->
			<!-- <li>XenogermReimplanter</li> -->
			<!-- ==================== Abilities ==================== -->
			<!-- ==================== Aggression ==================== -->
			<!-- <li>Aggression_HyperAggressive</li> -->
			<!-- <li>Aggression_Aggressive</li> -->
			<!-- <li>Aggression_DeadCalm</li> -->
			<!-- ==================== Aggression ==================== -->
			<!-- ==================== Aptitude ==================== -->
			<!-- <li>AptitudeTerrible_Animals</li> -->
			<!-- <li>AptitudeTerrible_Social</li> -->
			<!-- <li>AptitudeTerrible_Artistic</li> -->
			<!-- <li>AptitudeTerrible_Mining</li> -->
			<!-- <li>AptitudeTerrible_Mining</li> -->
			<!-- <li>AptitudeTerrible_Plants</li> -->
			<!-- <li>AptitudePoor_Artistic</li> -->
			<!-- <li>AptitudePoor_Intellectual</li> -->
			<!-- <li>AptitudePoor_Social</li> -->
			<!-- <li>AptitudePoor_Shooting</li> -->
			<!-- <li>AptitudePoor_Cooking</li> -->
			<!-- <li>AptitudePoor_Cooking</li> -->
			<!-- <li>AptitudePoor_Plants</li> -->
			<!-- <li>AptitudePoor_Animals</li> -->
			<!-- <li>AptitudeStrong_Melee</li> -->
			<!-- <li>AptitudeStrong_Social</li> -->
			<!-- <li>AptitudeStrong_Intellectual</li> -->
			<!-- <li>AptitudeRemarkable_Shooting</li> -->
			<!-- <li>AptitudeRemarkable_Melee</li> -->
			<!-- <li>AptitudeRemarkable_Animals</li> -->
			<!-- <li>AptitudeRemarkable_Mining</li>-->
			<!-- <li>AptitudeRemarkable_Social</li> -->
			<!-- ==================== Aptitude ==================== -->
			<!-- ==================== Beauty ==================== -->
			
			<!-- <li>Beauty_VeryUgly</li> -->
			<!-- <li>Beauty_Ugly</li> -->
			<!-- <li>Beauty_Pretty</li> -->
			<!-- <li>Beauty_Beautiful</li> -->
			<!-- ==================== Beauty ==================== -->
			<!-- ==================== Chemical Dependency ==================== -->
			<!-- <li>ChemicalDependency_GoJuice</li> -->
			<!-- <li>ChemicalDependency_Psychite</li> -->
			<!-- ==================== Chemical Dependency ==================== -->
			<!-- ==================== Fertility ==================== -->
			<!-- <li>Sterile</li> -->
			<!-- <li>Fertile</li> -->
			<!-- ==================== Fertility ==================== -->
			<!-- ==================== Immunity ==================== -->
			<!-- <li>Immunity_Weak</li> -->
			<!-- <li>Immunity_Strong</li> -->
			<!-- <li>Immunity_SuperStrong</li> -->
			<!-- ==================== Immunity ==================== -->
			<!-- ==================== Learning ==================== -->
			<!-- <li>Learning_Slow</li> -->
			<!-- <li>Learning_Fast</li> -->
			<!-- ==================== Learning ==================== -->
			<!-- ==================== Libido ==================== -->
			<<!-- li>Libido_Low</li>-->
			<!-- <li>Libido_High</li> -->
			<!-- ==================== Libido ==================== -->
			<!-- ==================== Melee Damage ==================== -->
			<!-- <li>MeleeDamage_Weak</li> -->
			<!-- <li>MeleeDamage_Strong</li> -->
			<!-- ==================== Melee Damage ==================== -->
			<!-- ==================== Mood ==================== -->
			<!-- <li>Mood_Depressive</li> -->
			<!-- <li>Mood_Pessimist</li> -->
			<!-- <li>Mood_Optimist</li> -->
			<!-- <li>Mood_Sanguine</li> -->
			<!-- ==================== Mood ==================== -->
			<!-- ==================== Movement Speed ==================== -->
			<!-- <li>MoveSpeed_Quick</li>-->
			<!-- <li>MoveSpeed_Slow</li>-->
			<!-- <li>MoveSpeed_VeryQuick</li> -->
			<!-- ==================== Movement Speed ==================== -->
			<!-- ==================== Pain ==================== -->
			<!-- <li>Pain_Reduced</li> -->
			<!-- <li>Pain_Extra</li>-->
			<!-- ==================== Pain ==================== -->
			<!-- ==================== Psychic Ability ==================== -->
			<!-- <li>PsychicAbility_Deaf</li> -->
			<!-- <li>PsychicAbility_Dull</li> -->
			<!-- <li>PsychicAbility_Enhanced</li> -->
			<!-- <li>PsychicAbility_Extreme</li> -->
			<!-- ==================== Psychic Ability ==================== -->
			<!-- ==================== Sleep ==================== -->
			<!-- <li>Neversleep</li> -->
			<!-- <li>LowSleep</li> -->
			<!-- <li>Sleepy</li> -->
			<!-- <li>VerySleepy</li> -->
			<!-- ==================== Sleep ==================== -->
			<!-- ==================== Temperature ==================== -->
			<!-- <li>MinTemp_SmallDecrease</li> -->
			<!-- <li>MinTemp_SmallIncrease</li> -->
			<!-- <li>MinTemp_LargeIncrease</li> -->
			<!-- <li>MaxTemp_SmallDecrease</li> -->
			<!-- <li>MaxTemp_SmallIncrease</li> -->
			<!-- <li>MaxTemp_LargeIncrease</li> -->
			<!-- ==================== Temperature ==================== -->
			<!-- ==================== Toughness ==================== -->
			<!--<li>Delicate</li>-->
			<!-- <li>Robust</li> -->
			<!-- ==================== Toughness ==================== -->
			<!-- ==================== Toxic Resistance ==================== -->
			<!-- <li>ToxicEnvironmentResistance_Partial</li> -->
			<!-- <li>ToxicEnvironmentResistance_Total</li> -->
			<!-- <li>ToxResist_Partial</li> -->
			<!-- <li>ToxResist_Total</li> -->
			<!-- ==================== Toxic Resistance ==================== -->
			<!-- ==================== UV Sensitivity ==================== -->
			<!-- <li>UVSensitivity_Intense</li>-->
			<!-- <li>UVSensitivity_Mild</li> -->
			<!-- ==================== UV Sensitivity ==================== -->
			<!-- ==================== Vision ==================== -->
			<!-- <li>DarkVision</li>-->
			<!-- <li>Nearsighted</li>-->
			<!-- ==================== Vision ==================== -->
			<!-- ==================== Voice ==================== -->
			<!-- <li>Voice_Human</li> -->
			<!-- <li>VoicePig</li> -->
			<!-- <li>VoiceRoar</li> -->
			<!-- ==================== Voice ==================== -->
			<!-- ==================== Wound Healing ==================== -->
			<!-- <li>WoundHealing_Fast</li>-->
			<!-- <li>WoundHealing_Slow</li> -->
			<!-- <li>WoundHealing_SuperFast</li> -->
			<!-- ==================== Wound Healing ==================== -->
			<!-- ======================================== Unique Genes ======================================== -->
			<!-- ==================== Vampire ==================== -->
			<!-- <li>Hemogenic</li> -->
			<!-- <li>HemogenDrain</li> -->
			<!-- <li>DiseaseFree</li> -->
			<!-- <li>TotalHealing</li> -->
			<!-- <li>Deathrest</li> -->
			<!-- <li>Ageless</li> -->
			<!-- <li>Deathless</li> -->
			<!-- <li>ArchiteMetabolism</li> -->
			<!-- <li>PerfectImmunity</li> -->
			<!-- <li>FireWeakness</li> -->
			<!-- <li>FireTerror</li> -->
			<!-- ==================== Vampire ==================== -->
			<!-- ==================== Misc ==================== -->
			<!-- <li>AddictionImmune_WakeUp</li> -->
			<!-- <li>FireResistant</li> -->
			<!-- <li>Inbred</li> -->
			<!-- <li>Instability_Mild</li> -->
			<!-- <li>Instability_Major</li> -->
			<!-- <li>KillThirst</li> -->
			<!-- <li>KindInstinct</li> -->
			<!-- <li>NakedSpeed</li> -->
			<!-- <li>PollutionRush</li> -->
			<!-- <li>PsychicBonding</li> -->
			<!-- <li>RobustDigestion</li> -->
			<!-- <li>StrongStomach</li> -->
			<!-- <li>Superclotting</li> -->
			<!-- <li>Unstoppable</li> -->
			<!-- <li>ViolenceDisabled</li> -->
		</genes>
	</XenotypeDef>
</Defs>

Adding xenotypes to generated pawns[edit]

Factions have their distribution of xenotypes set in their faction def at the top level by the following:

    <xenotypeSet>
      <xenotypeChances>
        <Neanderthal MayRequire="Ludeon.RimWorld.Biotech">0.05</Neanderthal>
        <Hussar MayRequire="Ludeon.RimWorld.Biotech">0.15</Hussar>
        <Genie MayRequire="Ludeon.RimWorld.Biotech">0.10</Genie>
      </xenotypeChances>
    </xenotypeSet>

Note: The above is for a faction that is not defined by the Biotech DLC, hence the may require. This difference is irrelevant to the interpretation method chosen. These values are then interpreted one of two ways. First: If the values add up to less than 1.0, then they are interpreted as percentage chances for a pawn, absent any other xenotype selections, to be that xenotype, with the remainder being the chance to be a baseliner. In the above example, as the sum of 0.05, 0.15, and 0.10 is only 0.30. As this is less than 1.0, there is a 5% chance for a pawn from that faction to be a neanderthal, a 15% chance to be a hussar, a 10% chance to be a genie, and a 70% chance to be baseliner.

Second: If the values exceed 1.0, then the values are instead interpreted as a weight, where the chance is equal to the value for that xenotype divided by the sum of all the weights given. If baseliners are not included as a weight, they are excluded

For example:

    <xenotypeSet>
      <xenotypeChances>
        <Neanderthal>999</Neanderthal>
      </xenotypeChances>
    </xenotypeSet>

Note: The above is for a faction that is defined by the Biotech DLC, hence the lack of may require. This difference is irrelevant to the interpretation method chosen. Neanderthals have a (999/999)*100%, or a 100% chance to be selected.

Additional xenotypeSet definitions can be made in memes[Note] and PawnKinds. Whenever a pawn generation request is made, the generator sums the xenotype chances from the faction, the PawnKind, and each meme of the faction's primary ideoligion. The totals are then interpreted as either probabilities or weights, as described above.

For example, suppose a pawn is generated using the faction at the top of this section and a PawnKind with the following configuration:

    <xenotypeSet>
      <xenotypeChances>
        <Highmate>0.25</Highmate>
        <Genie>0.15</Genie>
      </xenotypeChances>
    </xenotypeSet>

The chances will be added together, resulting in Neaderthal=0.05, Hussar=0.15, Genie=0.25 (from adding 0.10 and 0.15), and Highmate=0.25. The total of all of these is 0.7, leaving baseliners with a chance of 0.3.

Note that a PawnKind may have <useFactionXenotypes>false</useFactionXenotypes>, which causes the faction's xenotypeSet to be ignored.