Making animal spawn in biomes

Started by blohod, August 07, 2017, 04:40:54 AM

Previous topic - Next topic

blohod

I am trying to make my animal spawn naturally in the wild, however when I start the game there are a lot of errors in the log. Does anyone know how I can make my animal spawn naturally? Additionally I would like traders to use my animal as an option for a pack animal, anyone know how to do that?

Log:
https://pastebin.com/ZWyJ87hj

My code:
<ThingDef ParentName="AnimalThingBase">
    <defName>Donkey</defName>
    <label>donkey</label>
    <description>A peaceful herding herbivore descended from domesticated stock. Often used as a pack animal.</description>
    <statBases>
      <MoveSpeed>4.2</MoveSpeed>
      <ComfyTemperatureMin>-14</ComfyTemperatureMin>
      <MarketValue>430</MarketValue>
    </statBases>
    <verbs>
      <li>
        <verbClass>Verb_MeleeAttack</verbClass>
        <defaultCooldownTime>1.65</defaultCooldownTime>
        <meleeDamageBaseAmount>11</meleeDamageBaseAmount>
        <meleeDamageDef>Blunt</meleeDamageDef>
        <linkedBodyPartsGroup>FrontLeftLeg</linkedBodyPartsGroup>
      </li>
      <li>
        <verbClass>Verb_MeleeAttack</verbClass>
        <defaultCooldownTime>1.65</defaultCooldownTime>
        <meleeDamageBaseAmount>11</meleeDamageBaseAmount>
        <meleeDamageDef>Blunt</meleeDamageDef>
        <linkedBodyPartsGroup>FrontRightLeg</linkedBodyPartsGroup>
      </li>
      <li>
        <verbClass>Verb_MeleeAttack</verbClass>
        <defaultCooldownTime>1.65</defaultCooldownTime>
        <meleeDamageBaseAmount>4</meleeDamageBaseAmount>
        <meleeDamageDef>Blunt</meleeDamageDef>
        <commonality>0.01</commonality>
        <linkedBodyPartsGroup>HeadAttackTool</linkedBodyPartsGroup>
  </li>
    </verbs>
    <comps>
      <li Class="CompProperties_Milkable">
        <milkDef>Milk</milkDef>
        <milkIntervalDays>2</milkIntervalDays>
        <milkAmount>3</milkAmount>
      </li>
    </comps>
    <race>
      <herdAnimal>true</herdAnimal>
      <body>QuadrupedAnimalWithHooves</body>
      <baseBodySize>1.5</baseBodySize>
      <baseHealthScale>1.4</baseHealthScale>
<baseHungerRate>0.60</baseHungerRate>
      <foodType>VegetarianRoughAnimal</foodType>
      <leatherColor>(217, 179, 140)</leatherColor>
      <leatherInsulation>1.0</leatherInsulation>
      <gestationPeriodDays>30</gestationPeriodDays>
      <wildness>0.1</wildness>
      <nuzzleMtbHours>120</nuzzleMtbHours>
<packAnimal>true</packAnimal>
      <lifeExpectancy>30</lifeExpectancy>
      <lifeStageAges>
        <li>
          <def>AnimalBaby</def>
          <minAge>0</minAge>
        </li>
        <li>
          <def>AnimalJuvenile</def>
          <minAge>0.25</minAge>
        </li>
        <li>
          <def>AnimalAdult</def>
          <minAge>0.5</minAge>
          <soundWounded>Pawn_Elk_Wounded</soundWounded>
          <soundDeath>Pawn_Elk_Death</soundDeath>
          <soundCall>Pawn_Elk_Call</soundCall>
          <soundAngry>Pawn_Elk_Angry</soundAngry>
        </li>
      </lifeStageAges>
      <soundMeleeHitPawn>Pawn_Melee_BigBash_HitPawn</soundMeleeHitPawn>
      <soundMeleeHitBuilding>Pawn_Melee_BigBash_HitBuilding</soundMeleeHitBuilding>
      <soundMeleeMiss>Pawn_Melee_BigBash_Miss</soundMeleeMiss>
  <wildBiomes>
        <li>
          <biome>AridShrubland</biome>
          <animal>Donkey</animal>
          <commonality>0.5</commonality>
        </li>
        <li>
          <biome>Desert</biome>
          <animal>Donkey</animal>
          <commonality>0.1</commonality>
        </li>
<li>
          <biome>BorealForest</biome>
          <animal>Donkey</animal>
          <commonality>0.5</commonality>
        </li>
<li>
          <biome>Tundra</biome>
          <animal>Donkey</animal>
          <commonality>0.3</commonality>
        </li>
<li>
          <biome>TemperateForest</biome>
          <animal>Donkey</animal>
          <commonality>0.2</commonality>
        </li>
<li>
          <biome>TropicalRainforest</biome>
          <animal>Donkey</animal>
          <commonality>0.1</commonality>
        </li>
      </wildBiomes>
    </race>
    <tradeTags>
      <li>StandardAnimal</li>
    </tradeTags>
  </ThingDef>


blohod

#1
I managed to make animals spawn, for people finding this thread here is the fix.

The following should be in <race>

            <wildBiomes>
                <AridShrubland>0.4</AridShrubland>
<Desert>0.1</Desert>
<BorealForest>0.5</BorealForest>
<Tundra>0.3</Tundra>
<TemperateForest>0.5</TemperateForest>
<TropicalRainforest>0.1</TropicalRainforest>
            </wildBiomes>


Also, I think I need to patch the biomes to make traders use them, let me know if I am wrong.

blohod

ok, I need help to make traders use my donkey as a pack animal, colonists can use it when forming caravans but no trader caravans use donkeys.

So far I have added donkeys to allowed pack animals in all the biomes it spawns, shown below, but traders still only seem to use muffalo and dromedaries.

<Patch>
<Operation Class="PatchOperationAdd">
  <xpath>*/BiomeDef[defName="AridShrubland"]/allowedPackAnimals</xpath>
  <value>
<li>Donkey</li>
  </value>
</Operation>

<Operation Class="PatchOperationAdd">
  <xpath>*/BiomeDef[defName="Desert"]/allowedPackAnimals</xpath>
  <value>
<li>Donkey</li>
  </value>
</Operation>

<Operation Class="PatchOperationAdd">
  <xpath>*/BiomeDef[defName="BorealForest"]/allowedPackAnimals</xpath>
  <value>
<li>Donkey</li>
  </value>
</Operation>

<Operation Class="PatchOperationAdd">
  <xpath>*/BiomeDef[defName="Tundra"]/allowedPackAnimals</xpath>
  <value>
<li>Donkey</li>
  </value>
</Operation>

<Operation Class="PatchOperationAdd">
  <xpath>*/BiomeDef[defName="TemperateForest"]/allowedPackAnimals</xpath>
  <value>
<li>Donkey</li>
  </value>
</Operation>

<Operation Class="PatchOperationAdd">
  <xpath>*/BiomeDef[defName="TropicalRainforest"]/allowedPackAnimals</xpath>
  <value>
<li>Donkey</li>
  </value>
</Operation>
</Patch>

kaptain_kavern

You also have to add them in FactionDefs as well.  There is a tag for specifying what animals the faction will use for caravans.
It's looking like that

<carriers>
          <Muffalo>1</Muffalo>
          <Dromedary>1</Dromedary>
</carriers>

blohod

Quote from: kaptain_kavern on August 08, 2017, 09:06:10 AM
You also have to add them in FactionDefs as well.  There is a tag for specifying what animals the faction will use for caravans.
It's looking like that

<carriers>
          <Muffalo>1</Muffalo>
          <Dromedary>1</Dromedary>
</carriers>


Thanks :) I was thinking it would be something like that and I looked in traderDefs, I didn't think to look at the factions.