Making my pawn use X gun?

Started by SlimeCrusher, June 12, 2014, 05:35:04 PM

Previous topic - Next topic

SlimeCrusher

So, i have my pawn, it works nicely and all, but any idea on how to make it so that it spawns with a gun on its hand? Its not a humanoid, its an animal that acts like a mechanoid, this is my PawnKindDefs:
Quote<?xml version="1.0" encoding="utf-8" ?>
<PawnKindDefs>



   <PawnKindDef>
      <defName>Spitlarv</defName>
    <label>Spitlarv</label>
      <race>Spit_Larv</race>
      <defaultFactionType>Larv_Fac</defaultFactionType>
      <aiAvoidCover>true</aiAvoidCover>
    <standardBodyGraphicPath>Things/Pawn/Spitlarv</standardBodyGraphicPath>
    <moneyForWeapons>
      <min>1200</min>
      <max>1200</max>
    </moneyForWeapons>
    <weaponTags>
      <li>Gun_Biothrower</li> <---- Here, i put this gun, originally it was a mechanoid gun, so i thought that if i changed that, then i would be able to make it work, but nope
    </weaponTags>
  </PawnKindDef>




</PawnKindDefs>
Anyone has an idea of how to make it work?

ItchyFlea

Does the ThingDef for that gun include this in it's definition?
    <weaponTags>
      <li>Gun_Biothrower</li>
    </weaponTags>
All my mods are licensed under a Attribution-NonCommercial-ShareAlike 4.0 International
Ask for permission before using in ModPacks

Click here for a list of the mods I've created

SlimeCrusher

Well not exactly, the defName IS "Gun_Biothrower", but i didn't added any weaponTags.
How exactly im i supposed to use the weaponTags?

ItchyFlea

Put this code into the ThingDef for the gun:
    <weaponTags>
      <li>Biothrower</li>
    </weaponTags>

Then use the exact same thing in the PawnKindDef for the pawn.

I did the same thing in my Mech Turrets mod. Feel free to poke around the files for that to see what I did. Specifically the /Defs/PawnKindDefs/PawnKinds_Mechanoids.xml and /Defs/ThingDefs/Weapons_Guns.xml files are the two that utilise the <weaponTags> code.

Actually, here's the code from my mod to save you from having to find it:

Gun ThingDef file:
  <ThingDef ParentName="BaseGun">
    <defName>Gun_Minigun</defName>
    <label>Minigun</label>
    <description>A multi-barrel machine gun with an extremely high rate of fire. Mechanoid-built.</description>
    <texturePath>Things/Item/Equipment/Minigun</texturePath>
    <soundInteract>InteractRifle</soundInteract>
    <basePrice>600</basePrice>
    <techLevel>Spacer</techLevel>
    <destroyOnDrop>True</destroyOnDrop>
    <weaponTags>
      <li>MechanoidMinigun</li>
    </weaponTags>
    <verb>
      <projectileDef>Bullet_Minigun</projectileDef>
      <forcedMissRadius>2.4</forcedMissRadius>
      <warmupTicks>250</warmupTicks>
      <range>32</range>
      <accuracy>1</accuracy>
      <burstShotCount>30</burstShotCount>
      <ticksBetweenBurstShots>4</ticksBetweenBurstShots>
      <fireSound>ShotMinigun</fireSound>
    </verb>
  </ThingDef>

Pawn Kind:
<PawnKindDef>
<defName>CentipedeMinigun</defName>
<label>Centipede</label>
<race>Mechanoid_CentipedeMinigun</race>
<defaultFactionType>Mechanoid</defaultFactionType>
<aiAvoidCover>true</aiAvoidCover>
<standardBodyGraphicPath>Things/Pawn/Mechanoid/Centipede</standardBodyGraphicPath>
<moneyForWeapons>
<min>1200</min>
<max>1200</max>
</moneyForWeapons>
<weaponTags>
<li>MechanoidMinigun</li>
</weaponTags>
</PawnKindDef>
All my mods are licensed under a Attribution-NonCommercial-ShareAlike 4.0 International
Ask for permission before using in ModPacks

Click here for a list of the mods I've created

SlimeCrusher

Still nothing, maybe i put it in the wrong place?
This is the ThingDef of the gun
  <ThingDef ParentName="BaseBullet">
<defName>AcidBT</defName>
<label>Acid</label>
<texturePath>Things/Acid/Acid</texturePath>
<thingClass>BulletIncendiary</thingClass>
<projectile>
      <damageDef>AcidSpit</damageDef>
<damageAmountBase>3</damageAmountBase>
<speed>30</speed>
</projectile>
</ThingDef>

<ThingDef ParentName="BaseGun">
<defName>Gun_Biothrower</defName>
<label>Biothrower</label>
<description>This small creature has a strange defence system, it vomits its enemies! So raiders thought it was a great idea to use it as a gun</description>
<texturePath>Things/BioT/BioT</texturePath>
<soundInteract>InteractRifle</soundInteract>
<tradersCarry>true</tradersCarry>
<basePrice>900</basePrice>
    <weaponTags>
      <li>Gun_Biothrower</li>
    </weaponTags>
<verb>
<projectileDef>AcidBT</projectileDef>
      <ai_IsIncendiary>true</ai_IsIncendiary>
<warmupTicks>350</warmupTicks>
<range>8</range>
<accuracy>2</accuracy>
<ticksBetweenBurstShots>2</ticksBetweenBurstShots>
<burstShotCount>15</burstShotCount>
<fireSound>VomitBT</fireSound>
  </verb>
</ThingDef>

And this is the PawnKindDef
<PawnKindDef>
<defName>Spitlarv</defName>
    <label>Spitlarv</label>
<race>Spit_Larv</race>
<defaultFactionType>Larv_Fac</defaultFactionType>
<aiAvoidCover>true</aiAvoidCover>
    <standardBodyGraphicPath>Things/Pawn/Spitlarv</standardBodyGraphicPath>
    <moneyForWeapons>
      <min>1200</min>
      <max>1200</max>
    </moneyForWeapons>
    <weaponTags>
       <li>Gun_Biothrower</li>
    </weaponTags>
  </PawnKindDef>


ItchyFlea

Everything looks good, the tags are correct and in the right place. Try changing the name you're using in the <weaponTags> to something else.
Only other thing that comes to mind might be the missing <techLevel> tag, which should match, or be below, the <techLevel> tag you'll have in the <FactionDef>.

<techLevel> tag list, from lowest to highest:
Undefined
Animal
Neolithic
Medieval
Midworld
Spacer
Ultra
Transcendent
All my mods are licensed under a Attribution-NonCommercial-ShareAlike 4.0 International
Ask for permission before using in ModPacks

Click here for a list of the mods I've created

SlimeCrusher

Sadly, nothing works currently.
It may be in the way i coded the pawn? Currently it behaves like a Muffalo, it has "HerbivoreHerd" thinking, when i put it "Mechanoid" it spams the console with continous errors about pathing and stuff... Maybe that is the reason?