where can I, if possible, define the bodymass or weight of a creature?

Started by forestfey, January 23, 2017, 01:31:43 PM

Previous topic - Next topic

forestfey

see title. Or a factor for calculating bodymass, whatever...

Where is it, what are its relations/dependencies and where can I define it otherwise than default in my pawnthing-def?
"Despite all our accomplishments, we owe our existence to a six-inch layer of top-soil and the fact that it rains."
_
Klirrend klare Nacht
funkelt durch den Schleier.
Entfaltung nach innen

Jingling clear night
Sparkles through the veil.
Unfolding inwards

madcat911

Weight is determined by the stat "Mass" multiplied by the body scale.

The Mass stat is defined in the BasePawn abstract which is in Core/Defs/ThingDefs_Races/Races_Animal_Base.xml and is 70. You can simply overwrite this by including <Mass>120</Mass> in the <statbases> block of your new creature, which would give a weight of 120kg. Then adjust the bodysize if you want.

Why mass AND bodysize? Because that lets you define a whole species of animal (e.g. "Big Cats") and then create lions and tigers and panthers by changing the bodysize. The bodysize controls weight (mass * bodysize) but also meat amount, leather amount, carry capacity, a million other things. Instead of having to set values for all those animals you can just change the bodysize and the values are set automatically.

So if you're making "bigger humans" leave mass at 70 (which is the base human mass) and increase the bodysize. If you're making "bigger dogs" just change the bodysize. There is also health scale, separate from bodysize, allowing you to have small tough things or huge weak things.

It's a flexible system.

Let's take a look at the Races_Humanlike.xml. Below is a section of that .xml.


<ThingDef ParentName="BasePawn">
    <defName>Human</defName>
    <label>human</label>
    <description>A baseline human, mostly unmodified by gene engineering and mostly unchanged by evolutionary pressures on non-Earth planets.</description>
    <statBases>
      <MarketValue>1750</MarketValue>
      <MoveSpeed>4.61</MoveSpeed>
      <Flammability>1.0</Flammability>
      <ComfyTemperatureMin>12</ComfyTemperatureMin>
      <ComfyTemperatureMax>32</ComfyTemperatureMax>
      <LeatherAmount>25</LeatherAmount>
     <Mass>120</Mass> <!-- THIS IS NOT IN THE ACTUAL .xml, THIS IS WHAT YOU NEED TO ADD TO EDIT THE MASS STAT -->
    </statBases>
    <verbs>
      <li>
        <verbClass>Verb_MeleeAttack</verbClass>
        <defaultCooldownTime>1.85</defaultCooldownTime>
        <meleeDamageBaseAmount>6</meleeDamageBaseAmount>
        <meleeDamageDef>Blunt</meleeDamageDef>
        <linkedBodyPartsGroup>LeftHand</linkedBodyPartsGroup>
      </li>
      <li>
        <verbClass>Verb_MeleeAttack</verbClass>
        <defaultCooldownTime>1.85</defaultCooldownTime>
        <meleeDamageBaseAmount>6</meleeDamageBaseAmount>
        <meleeDamageDef>Blunt</meleeDamageDef>
        <linkedBodyPartsGroup>RightHand</linkedBodyPartsGroup>
      </li>
    </verbs>
    <race>
      <thinkTreeMain>Humanlike</thinkTreeMain>
      <thinkTreeConstant>HumanlikeConstant</thinkTreeConstant>
      <intelligence>Humanlike</intelligence>
      <makesFootprints>true</makesFootprints>
      <lifeExpectancy>80</lifeExpectancy>
      <leatherColor>(211,194,143)</leatherColor>
      <leatherCommonalityFactor>0.01</leatherCommonalityFactor>
      <leatherInsulation>0.70</leatherInsulation>
      <leatherMarketValueFactor>3</leatherMarketValueFactor>
      <nameCategory>HumanStandard</nameCategory>
      <body>Human</body>
      <baseBodySize>1</baseBodySize> <!-- Changes stats like mass, leather amount, meat amount, so on, without changing health -->
      <baseHealthScale>1</baseHealthScale> <!-- Changes health for all body parts and pain tolerance by the multiplier without changing mass, leather, meat, so on -->
      <foodType>OmnivoreHuman</foodType>
      <gestationPeriodDays>45</gestationPeriodDays>


I've highlighted what you need to ADD to <statBases> to overwrite the inherited Mass stat from "BasePawn". Later on I've highlighted where BodySize and HealthScale live. You can also have a look at the other .xml files to see how things like <baseHungerRate> can be used to change how much food animals need, how to set them as predators, and so on.

forestfey

thank you,  I think I got the other things (hunger-rate and so on) under control, but I couldn't make sense of the weight-size relation. This should suffice to tinker around until I get my sabretooth "back in shape" in no time! I read the adults of the bigger species can weigh more than 450kg^^
"Despite all our accomplishments, we owe our existence to a six-inch layer of top-soil and the fact that it rains."
_
Klirrend klare Nacht
funkelt durch den Schleier.
Entfaltung nach innen

Jingling clear night
Sparkles through the veil.
Unfolding inwards

forestfey

@madcat911 hm, I have to check if there's an offset for these values in the lifestage-defs. Maybe I can tweak them there then, too. It would probably be better to add this information to the race-def though (if possible), so I'm not accidentally overriding the default offsets for weight, health and so on in the animal lifestage defs^^

aaaand just realized that doesn't matter that much, because I defined and renamed my own lifestage defs, so i can add it to the custom abstract like you showed in the example anyway...

EDIT (an hour or so later): It works now, but I'm not really satisfied with the level I defined it on to make it work with the bodysize offsets I chose in the lifestage-defs... (pawnthing abstract). It's very likely I will use that abstract in the future for other of my creatures, too. It would be the most elegant solution to set it on the "race-level" of... uh.. classes(?)? That must be a relatively minor change then^^
"Despite all our accomplishments, we owe our existence to a six-inch layer of top-soil and the fact that it rains."
_
Klirrend klare Nacht
funkelt durch den Schleier.
Entfaltung nach innen

Jingling clear night
Sparkles through the veil.
Unfolding inwards

forestfey

I'm sorry if that's a really silly and basic question and if I haven't seen that it's already been replied to, so:
What please is the UNIT of reference for the bodymass?

I thought I worked it out, but other people report very funny weights in the descriptions of the animalpawn. It worked when I tested it, at least twice, so I'm a bit baffled... I twiddled around with the values quite a lot. My suspicion is that the "base-weight" for an adult I have defined is going bonkers when multiplied with the lifestage-factors and/or bodysize. And that this is just because I was using the wrong unit or something.
Or a whole order of magnitude...
^ that has already has happened in other places at other times. And is an especially embarrassing if not unsafe thing in lab-environments :o

EDIT: I think I found the error, and it was indeed a rather human one I won't go more into detail about^^ Thanks forum for being my rubberducky!
"Despite all our accomplishments, we owe our existence to a six-inch layer of top-soil and the fact that it rains."
_
Klirrend klare Nacht
funkelt durch den Schleier.
Entfaltung nach innen

Jingling clear night
Sparkles through the veil.
Unfolding inwards