Trying to make a simple Improved Turret mod.

Started by BoggartBear, April 15, 2014, 11:21:26 AM

Previous topic - Next topic

BoggartBear

I'm just dabbling with some simple mod ideas at the moment but have run across an issue. When I use a custom weapons xml for my new turrets I get an error upon loading.

Config error in Gun_TurretImproved: Gun_TurretImproved has null thingClass.

<ThingDef ParentName="BaseGun">
<defName>Gun_TurretImproved</defName>
<label>Improved turret gun</label>
<menuHidden>true</menuHidden>
<description>Stabilised gun attached to a turret.</description>
<texturePath>Things/Item/Equipment/Default</texturePath>
<interactSound>InteractBoltActionRifle</interactSound>
<canBeSpawningInventory>false</canBeSpawningInventory>
<weaponTags>
<li>TurretGun</li>
</weaponTags>
<verb>
<projectileDef>Bullet_TurretImprovised</projectileDef>
<warmupTicks>108</warmupTicks>
<range>25.9</range>
<accuracy>5</accuracy>
<ticksBetweenBurstShots>8</ticksBetweenBurstShots>
<burstShotCount>3</burstShotCount>
<fireSound>GunShotA</fireSound>
</verb>
</ThingDef>


I thought maybe I needed to make some new C# code, which is beyond my abilty at the moment. Or perhaps it is just something simple I have missed.

Another question, can I have multiple resource requirements for a building?

Architect

You just need to include the turret thing class here :) Anywhere in the XML file, just put <thingClass>Building_TurretGun</thingClass> and it will work.

to add more than one resource cost, simply add a new list to your cost list. Might I suggets you just copy and paste the current XML for a turret, and edit that until you know all of the tags that you need? You seem to be missing key ones such as costs, beauty, thingClass, size, etc, etc. :/
Check out BetterPower+ and all its derivatives by clicking the picture below.

It adds many new methods of power generation and uses for it, as well as other things such as incidents.


BoggartBear

#2
Thanks I'll try that now.

This is the Weapons XML, the other turret stuff is in the building XML.

EDIT: No that didn't work, I noticed that line is already in my Buildings_Turrets.xml. Weapons_Turrets.xml is the problem. The default Weapons_Guns.xml has 3 instances of thingClass, but none for the exisiting Improvised Turret.

Architect

Quote from: BoggartBear on April 15, 2014, 12:22:02 PM
Thanks I'll try that now.

This is the Weapons XML, the other turret stuff is in the building XML.

EDIT: No that didn't work, I noticed that line is already in my Buildings_Turrets.xml. Weapons_Turrets.xml is the problem. The default Weapons_Guns.xml has 3 instances of thingClass, but none for the exisiting Improvised Turret.

Sorry dude, I thought we were looking at the turret body XD My mistake. You need to put this before your weapon bit in the XML file:
<ThingDef Name="BaseGun" Abstract="True">
<category>Item</category>
<eType>Equipment</eType>
<thingClass>Equipment</thingClass>
<label>Gun</label>
<equipmentType>Primary</equipmentType>
<isGun>True</isGun>
<pathCost>10</pathCost>
<useStandardHealth>True</useStandardHealth>
<selectable>True</selectable>
<maxHealth>100</maxHealth>
<altitudeLayer>Item</altitudeLayer>
<alwaysHaulable>True</alwaysHaulable>
<tickerType>Never</tickerType>
<techLevel>Midworld</techLevel>
<storeCategories>
<li>Weapons</li>
</storeCategories>
<weaponTags>
<li>Gun</li>
</weaponTags>
<comps>
<li>
<compClass>CompForbiddable</compClass>
</li>
</comps>
<verb>
<id>Nonnative</id>
<verbClass>Verb_Shoot</verbClass>
<cooldownTicks>30</cooldownTicks>
<label>VerbGun</label>
<description>Fire a bullet.</description>
<hasStandardCommand>true</hasStandardCommand>
<targetParams>
<canTargetPawns>true</canTargetPawns>
<canTargetBuildings>true</canTargetBuildings>
<worldObjectTargetsMustBeAutoAttackable>true</worldObjectTargetsMustBeAutoAttackable>
</targetParams>
<canMiss>true</canMiss>
</verb>
</ThingDef>

What you have is the specifics, but as you can see it has a parent called the base gun which sets out all the things any gun would have to use. This here is the default basegun stuff :)
Check out BetterPower+ and all its derivatives by clicking the picture below.

It adds many new methods of power generation and uses for it, as well as other things such as incidents.


BoggartBear

Ah yes. I did the exact same thing for the buildings xml, not sure why I didn't here. Thanks a lot!

Architect

Check out BetterPower+ and all its derivatives by clicking the picture below.

It adds many new methods of power generation and uses for it, as well as other things such as incidents.