Creating a new race

Started by benjiboy12, July 16, 2014, 03:45:55 PM

Previous topic - Next topic

benjiboy12

Hello all, I've been working on a mod that will include several new races, I've got a pretty good understanding how things work when adding new content, but I've seem to hit a major road block.  The game crashes when I load in the mod i'm working on and the error message says no cross reference for BaseOrk.  Here is the race that I created, don't mind some of obvious things such as still using the mechanoid as the art.

  <ThingDef Name="BasePawn" Abstract="True">
    <eType>Pawn </eType>
    <thingClass>Pawn</thingClass>
    <category>Pawn</category>
    <selectable>true</selectable>
    <tickerType>Normal</tickerType>
    <altitudeLayer>Pawn</altitudeLayer>
    <useStandardHealth>false</useStandardHealth>
    <flammability>1.0</flammability>
    <hasTooltip>true</hasTooltip>
    <soundBulletHit>BulletImpactFlesh</soundBulletHit>
    <inspectorTabs>
      <li>ITab_Pawn_Thoughts</li>
      <li>ITab_Pawn_Needs</li>
      <li>ITab_Pawn_Prisoner</li>
      <li>ITab_Pawn_Gear</li>
      <li>ITab_Pawn_Character</li>
    </inspectorTabs>
    <drawGUIOverlay>true</drawGUIOverlay>
  </ThingDef>



  <!-- ============================ Ork ========================== -->
 
 
  <ThingDef ParentName="BasePawn" Name="BaseOrk" Abstract="True">
 
    <soundBulletHit>BulletImpactFlesh</soundBulletHit>
    <flammability>1.0</flammability>
    <race>
      <hasStory>false</hasStory>
      <needsRest>false</needsRest>
      <hasGenders>false</hasGenders>
      <isFlesh>true</isFlesh>
      <diet>NeverEats</diet>
    </race>
  </ThingDef>
 
  <!-- Ork Boy -->
 
  <ThingDef ParentName="BaseOrk">
    <defName>Ork_Boy</defName>
    <label>Ork Boy</label>
    <description>Tough, mean, and green, this ork's only concern is to shoot and smash.  It's shear muscle mass makes a protective armor coating that can abosorb a great deal of damage.</description>
    <maxHealth>200</maxHealth>
    <sunShadowInfo>
      <baseWidth>0.4</baseWidth>
      <baseHeight>0.4</baseHeight>
      <tallness>0.8</tallness>
    </sunShadowInfo>
    <targetHitChanceFactor>1.5</targetHitChanceFactor>
<race>
      <thinkTree>Humanoid</thinkTree>
      <humanoid>true</humanoid>
      <walkSpeed>1.0</walkSpeed>
      <meleeDamage>25</meleeDamage>
      <bodySize>1.25</bodySize>
      <soundWounded>Pawn_Human_Wounded</soundWounded>
      <soundDeath>Pawn_Human_Death</soundDeath>
      <soundMeleeHitPawn>Pawn_Melee_Punch_HitPawn</soundMeleeHitPawn>
      <soundMeleeHitBuilding>Pawn_Melee_Punch_HitBuilding</soundMeleeHitBuilding>
      <soundMeleeMiss>Pawn_Melee_Punch_Miss</soundMeleeMiss>
    </race>
  </ThingDef>


Here is the pawn kind
<PawnKindDef>
<defName>Ork_Choppa</defName>
    <label>Ork Choppa</label>
    <race>Ork_Boy</race>
    <pointsCost>100</pointsCost>
<defaultFactionType>Ork_Clan</defaultFactionType>
<aiAvoidCover>false</aiAvoidCover>
    <isFighter>true</isFighter>
    <standardBodyGraphicPath>Things/Pawn/Mechanoid/Centipede</standardBodyGraphicPath>
    <moneyForWeapons>
      <min>1200</min>
      <max>1200</max>
    </moneyForWeapons>
    <weaponTags>
      <li>MechanoidGunHeavy</li>
    </weaponTags>
  </PawnKindDef>


Finally the faction

<FactionDef>
    <defName>Ork_Clan</defName>
    <label>Ork Clan</label>
    <description>A large group of greenskins who travel around the galaxy looking for a fight.</description>
    <pawnsPlural>Orks</pawnsPlural>
    <requiredCountAtGameStart>1</requiredCountAtGameStart>
    <fixedName>a ork clan</fixedName>
    <raidCommonality>45</raidCommonality>
    <humanoidFaction>false</humanoidFaction>
    <hidden>false</hidden>
    <canFlee>true</canFlee>
    <techLevel>Ultra</techLevel>
    <startingGoodwill>
      <min>-100</min>
      <max>-100</max>
    </startingGoodwill>
    <naturalColonyGoodwill>
      <min>-100</min>
      <max>-100</max>
    </naturalColonyGoodwill>
    <spawnGroups>
      <li>
        <selectionWeight>100</selectionWeight>
        <kinds>
          <li>Ork_Boy</li>
        </kinds>
      </li>
    </spawnGroups>
  </FactionDef>


I've spent a entire day trying to figure out what I've done wrong.  Also if your wondering what the mod is, its a 40k mod. Any 2d artist who want to help out are more than welcome, already finished most of the imperial weapons, just need to make the armors and alien bodies  ;D.

mrofa

You cant make new race without .dll. I mean new race like humanoid or canepids. Also from what i seen in a4 dlls you wont be able to make entire new race without rewriting half of the game.
But you could take arachnid threat mod or horror world as a tamplate, this mods create pawns purly in xml and they work fine :)
All i do is clutter all around.

Berengar

#2
Hey
i just want to say, im a big fan of Orcs, and working too on a Mod, but there you have to play that green little Bastards. So maybe i can help you with the textures. Here is a little example.
PS: Sry for my bad english, im from Germany.


benjiboy12

QuoteBut you could take arachnid threat mod or horror world as a template, this mods create pawns purly in xml and they work fine
That's what I did  :P, I dissected the arachnid threat mod, which is a pretty cool mod kuddos to the developer, I didn't copy and paste his mod, but I've cross reference his /thingsdef race and my race and I cannot seem to see how his works and mine has an error. The error has something to do with the racebase, is there another file this should be attached to or what?

To Berengar, I could use help on armor and body texture, I do a pretty good job with weapon sprites if you need any, but my skill at proportioning and scaling is quite rubbish so I have a hard time making armor and bodies. PM if you are interested. 

benjiboy12

I figured it out, it was a simple mistake but I'll explain how to make a race just in case any poor soul is searching through the forums wanting to know how to do such a thing races.

The problem was in the pawn kinds, I put the <race> as Ork_Base  in the pawn definition when it should have been Ork_Boy. 

When making a new race you will need to have three xml files

ThingsDef- which will hold the BaseRace from which you apply health and think tree and what not.
PawnKindsDef- this is where you make the different professions of the race, for humans you have mercenaries pirates and what not.
FactionsDef- this is where you you put your pawnkinds in to make a faction, so if you wanted to add space ork pirates to the pirate faction you would simply just have to
1.Create a ork race inside ThingsDef.
2.Create a space pirate ork pawn(this is where you tell what type of equipment and armor the pawn type should use)
3.Add that pawn to the pirate faction's pawn list so it will have a chance(depending on a weight value) of being initiated when a pirate assault or raid occurs.   

Creating a race, if you want to create a race that has multiple sub species it is a good idea to make a parent class that all sub species will share, such as <backstory>,<isFlesh>, and <diet>.  Make sure that when you create the parent class that you write <Abstract>True, this shows that this is not actually a race, but something that can hold its value and give it to its children. 

Although I fixed the bug I have already encountered a dozen more when I try to instantiate a ork  :'(, but I think that has to do more with me using a robot image and trying to apply it to a humanoid pawn.