Me again..help needed.

Started by Compo, March 20, 2017, 10:40:21 AM

Previous topic - Next topic

Compo

So how would one make a bill at the machining table, if that bill wasnt a weapon?
Say if i wanted to craft a xbox360 at the machining table, and needed 4 other things to create it there..
Um say, 30xplastic, 30xmetal, 30xrubber and 30xcomponents (just e.g).

Also these things can be made at the machining table, so you can setup a recipe at the same table.
More over, id like to put upon it, a certain crafting skill for certain objects.

Im really struggling atm, but eager to learn  :)
Ive screwed up a 5yr colony testing for this, which im gutted about.
I know its a simple bit of code, but i cannot fathom it out looking at the core or other mods that use recipes.
The mod im working on is not big (actually its almost non-existent) enough to add a bench for, and almost all mods regarding recipes seem to add a new bench (reason for this?), maybe its easier??

I know im not asking for much :o
But some xml code would be awesome, with examples of the things ive asked for.
Oh yeah..all ive eaten for the past 3 days is oxygen, i need to get this to work, for my own sanity  :-*


jimthenoob

#1
You should go on the programmers diet of things people can slip you under the door with the oxygen. food helps you think.



As for the code, well recipes are actually what I have just been messing with so you're in luck! We seem to be caught up with each other now lol!

Lets look at a simple recipe that I lifted out of the game popper.  For example this is the XML code for component recipe lifted out of the core Recipes_Production.xml


Code block 1 Item Recipe


<?xml version="1.0" encoding="utf-8" ?>
<RecipeDefs>

<RecipeDef>
    <defName>MakeComponent</defName>
    <label>make component</label>
    <description>Make a component.</description>
    <jobString>Making component.</jobString>
    <workSpeedStat>SmithingSpeed</workSpeedStat>
    <effectWorking>Cook</effectWorking>
    <soundWorking>Recipe_Machining</soundWorking>
    <workAmount>9000</workAmount>
    <unfinishedThingDef>UnfinishedComponent</unfinishedThingDef>
    <ingredients>
      <li>
        <filter>
          <thingDefs>
            <li>Steel</li>
          </thingDefs>
        </filter>
        <count>25</count>
      </li>
    </ingredients>
    <fixedIngredientFilter>
      <thingDefs>
        <li>Steel</li>
      </thingDefs>
    </fixedIngredientFilter>
    <products>
      <Component>1</Component>
    </products>
<skillRequirements>
<li>
<skill>Crafting</skill>
<minLevel>10</minLevel>
</li>
</skillRequirements>
    <workSkill>Crafting</workSkill>
  </RecipeDef>

</RecipeDefs>


Notice how it doesn't really tell us were this recipe goes, its just the recipe. There are a few ways to assign it to a table. for example in the core game, the table itself lists what recipes it makes. lets look at the component table code next to see what I mean

Code block2 Bench/work table

<ThingDef ParentName="BenchBase">
    <defName>ComponentAssemblyBench</defName>
    <label>component assembly bench</label>
    <description>A workbench equipped with advanced tools for producing components from simpler materials.</description>
    <thingClass>Building_WorkTable</thingClass>
    <altitudeLayer>Building</altitudeLayer>
    <passability>PassThroughOnly</passability>
    <pathCost>70</pathCost>
    <statBases>
      <MaxHitPoints>300</MaxHitPoints>
      <WorkToBuild>5000</WorkToBuild>
      <Flammability>1.0</Flammability>
    </statBases>
    <size>(5,2)</size>
    <costList>
      <Steel>400</Steel>
      <Component>20</Component>
    </costList>
    <comps>
      <li Class="CompProperties_AffectedByFacilities">
        <linkableFacilities>
          <li>ToolCabinet</li>
        </linkableFacilities>
      </li>
      <li Class="CompProperties_Power">
        <compClass>CompPowerTrader</compClass>
        <basePowerConsumption>250</basePowerConsumption>
        <startElectricalFires>true</startElectricalFires>
      </li>
      <li Class="CompProperties_Flickable"/>
      <li Class="CompProperties_Breakdownable"/>
    </comps>
    <recipes>
      <li>MakeComponent</li>
    </recipes>
    <graphicData>
      <texPath>Things/Building/Production/ComponentAssemblyBench</texPath>
      <graphicClass>Graphic_Multi</graphicClass>
      <shaderType>CutoutComplex</shaderType>
      <drawSize>(7,4)</drawSize>
      <damageData>
        <cornerTL>Damage/Corner</cornerTL>
        <cornerTR>Damage/Corner</cornerTR>
        <cornerBL>Damage/Corner</cornerBL>
        <cornerBR>Damage/Corner</cornerBR>
      </damageData>
    </graphicData>
    <inspectorTabs>
      <li>ITab_Bills</li>
    </inspectorTabs>
    <building>
      <spawnedConceptLearnOpportunity>BillsTab</spawnedConceptLearnOpportunity>
    </building>
    <fillPercent>0.5</fillPercent>
    <interactionCellOffset>(0,0,-1)</interactionCellOffset>
    <hasInteractionCell>true</hasInteractionCell>
    <terrainAffordanceNeeded>Heavy</terrainAffordanceNeeded>
    <designationCategory>Production</designationCategory>
    <surfaceType>Item</surfaceType>
    <designationHotKey>Misc12</designationHotKey>
    <placeWorkers>
      <li>PlaceWorker_ShowFacilitiesConnections</li>
    </placeWorkers>
    <researchPrerequisites>
      <li>ComponentAssembly</li>
    </researchPrerequisites>
  </ThingDef>



This the the code for the component assembly bench. As you can see there is a  <recipes> container with the recipe <li>MakeComponent</li> listed. This tells the game this table can make that recipe (the def name of the component recipe). You can add your recipe this way as well (by modding the core work bench and over writing it with a def of the same name) But then that will cause problems if anyone else decided to overwrite the core def to add their recipes (erasing yours or theirs depending on mod load order is my understanding) This leads to the second way to add a recipe to a benches bill tab.  which is done on the recipe code itself. lets take a look at that first code block again and see what needs to be done.

(note this way is likely fine for adding recipes to your own bench)


Breakdown



Change work table type

By default there does not seem to be anything really on here to do that. But there is a way!
if we add the following lines


      <recipeUsers>
        <li>ComponentAssemblyBench</li>
      </recipeUsers>


This tells the game that this recipe is to be assigned to the "ComponentAssemblyBench" work table def. The same can be done using the proper def names of the other vanilla benches. This will allow your recipe to be assigned to the bench without being bound to it directly. So it should not cause as many issues with other peoples code if they chose to overwrite the core worktables.

To change it to the machine table, as in your request, simply replace"ComponentAssemblyBench" with "TableMachining" in that line to assign it to the machine table. These defs are in the core production buildings def file if you need to make sure you reference them with the right spelling. 

Change recipe costs

Next up we need to figure out how to make this thing cost more to make, 25 steel for an original Xbox just isn't enough, they are the size of small moons after all.

Here is were things can get a bit different, you can see already there is a cost listed.

   
<ingredients>
      <li>
        <filter>
          <thingDefs>
            <li>Steel</li>
          </thingDefs>
        </filter>
        <count>25</count>
      </li>
    </ingredients>
    <fixedIngredientFilter>
      <thingDefs>
        <li>Steel</li>
      </thingDefs>
    </fixedIngredientFilter>




to make this work for more then one ingredient we need to modify the   <fixedIngredientFilter> (or its just going to use steel, we want more then that) then we need to add/ modify our other ingredients to the list. they need to follow the format that is already there for the steel. when its done the ingredients should look like:



<ingredients>
      <li>
        <filter>
          <thingDefs>
            <li>Steel</li>
          </thingDefs>
        </filter>
        <count>300</count>
      </li>
  <li>
        <filter>
          <thingDefs>
            <li>Component</li>
          </thingDefs>
        </filter>
        <count>2</count>
      </li>
  <li>
        <filter>
          <thingDefs>
            <li>WoodLog</li>
          </thingDefs>
        </filter>
        <count>25</count>
      </li>
      </ingredients>
<fixedIngredientFilter>
<thingDefs>
<li>Steel</li>
<li>Component</li>
<li>WoodLog</li>
</thingDefs>
</fixedIngredientFilter>


Note with this method: if you forget to add the items to the fixed item filter (or forget the filter all together) then the pwns will refuse to make the recipe, saying you don't have the required ingredients (even if they are on the play space and available)




And here is the finished item, with comments on some of the lines for you:


<?xml version="1.0" encoding="utf-8" ?>
<RecipeDefs>


<RecipeDef>
    <defName>MakeXBOX</defName>
    <label>Make XBox</label>
    <description>Make an XBox</description>
     
<!--test displayed for working the job-->
<jobString>Making XBox</jobString>
    <workSpeedStat>SmithingSpeed</workSpeedStat>
<!--sound and work overlay effects-->
<effectWorking>Cook</effectWorking>
    <soundWorking>Recipe_Machining</soundWorking>
<!--work ammount to build the thing-->
<workAmount>900</workAmount>
<!--def name used for the unfinished state and graphic of the item.-->
    <unfinishedThingDef>UnfinishedComponent</unfinishedThingDef>
<!--Ingridents list, multi ingrident with diffrent ammounts for each, note containers for each thing used-->
<ingredients>
      <li>
        <filter>
          <thingDefs>
            <li>Steel</li>
          </thingDefs>
        </filter>
        <count>300</count>
      </li>
  <li>
        <filter>
          <thingDefs>
            <li>Component</li>
          </thingDefs>
        </filter>
        <count>2</count>
      </li>
  <li>
        <filter>
          <thingDefs>
            <li>WoodLog</li>
          </thingDefs>
        </filter>
        <count>25</count>
      </li>
      </ingredients>
<fixedIngredientFilter>
<thingDefs>
<li>Steel</li>
<li>Component</li>
<li>WoodLog</li>
</thingDefs>
</fixedIngredientFilter>
<!--makes 3 Component. change the name to the def name of the item you wish this recipe to make-->
<products>
      <Component>3</Component>
    </products>
<!--Skill used/level to make-->
<skillRequirements>
<li>
<skill>Crafting</skill>
<minLevel>1</minLevel>
</li>
</skillRequirements>
<!--Skill/job requirment to work recipe?? need to mess with-->
    <workSkill>Crafting</workSkill>
<!--def name of work table that this recipe will use-->
  <recipeUsers>
        <li>TableMachining</li>
      </recipeUsers>
 
  </RecipeDef>


</RecipeDefs>




That should be most of it, or at least enough for you to figure it out and poke around. Remember def names are case sensitive! there are other things to worry about like the <unfinishedThingDef> tag, which points to what def it will act/look like when its not finished. There are example of these in the "Items_Unfinished" core item defs.


Have fun poking around! and keep in mind I'm a noob too so i might mess up the code a bit in this post, but i tried to test it as i wrote it.


Granitecosmos

#2
Quote from: jimthenoob on March 20, 2017, 05:13:48 PM
<<tons of helpful information>>

That's one damn fine job at presenting some info. You've managed to post it while I was working on my reply, actually. You've made a RecipeDef, yes, but what if I told you and OP that you can do everything in just one file?

Let's get this party started then!

Quote from: Compo on March 20, 2017, 10:40:21 AM
So how would one make a bill at the machining table, if that bill wasnt a weapon?
Say if i wanted to craft a xbox360 at the machining table, and needed 4 other things to create it there..
Um say, 30xplastic, 30xmetal, 30xrubber and 30xcomponents (just e.g).

Let's forget the plastic and rubber for now. It's easier to just focus on one thing at a time. So basically you want to make an !!ITEM!! to have a recipe that shows up at the Machining table. All you need to do is look at existing items that match your one in a certain way.

First of all. Your stuff is going to be an item. So you need to look at some kind of item that's simple to understand. I have one for you, the AI Persona Core, in Defs/ThingDefs_Items/Items_Exotic.xml:

<ThingDef ParentName="ResourceBase">
<defName>AIPersonaCore</defName>
<label>AI persona core</label>
<description>A hyper-advanced computer core that houses a superhumanlike artificial intelligence. In its isolated state, the core is dormant. Installed in a proper support structure, however, it can become a mind of frightening power.</description>
<graphicData>
<texPath>Things/Item/Special/AIPersonaCore</texPath>
<graphicClass>Graphic_Single</graphicClass>
</graphicData>
<resourceReadoutPriority>Middle</resourceReadoutPriority>
<soundInteract>Metal_Drop</soundInteract>
<soundDrop>Metal_Drop</soundDrop>
<stackLimit>1</stackLimit>
<useHitPoints>true</useHitPoints>
<statBases>
<MarketValue>4000</MarketValue>
<MaxHitPoints>100</MaxHitPoints>
<Mass>2</Mass>
</statBases>
<thingCategories>
<li>Items</li>
</thingCategories>
<drawGUIOverlay>false</drawGUIOverlay>
<tradeTags>
<li>Exotic</li>
</tradeTags>
</ThingDef>


This item should be a nice base for yours. It inherits some attributes from ResourceBase. I'll spare you the effort to find that one, it's in Defs/ThingDefs_Items/Items_Luxury.xml:

<ThingDef Name="ResourceBase" Abstract="True">
<thingClass>ThingWithComps</thingClass>
<category>Item</category>
<resourceReadoutPriority>Middle</resourceReadoutPriority>
<useHitPoints>true</useHitPoints>
<selectable>true</selectable>
<altitudeLayer>Item</altitudeLayer>
<stackLimit>75</stackLimit>
<statBases>
<Beauty>-7</Beauty>
</statBases>
<comps>
<li Class="CompProperties_Forbiddable"/>
</comps>
<alwaysHaulable>true</alwaysHaulable>
<drawGUIOverlay>true</drawGUIOverlay>
<rotatable>false</rotatable>
<pathCost>15</pathCost>
</ThingDef>


Of course, just because it inherits from that one it doesn't mean we can't just overwrite those stats.

Since you want your !!ITEM!! to be an XBox360, let's "Xboxify" this. But before we start, the defName can't end with a number, so we'll use the defName Xbox. Don't worry, the label is what is shown in the game and we can set that to Xbox360 so it will show that in-game.

So, after "Xboxifying" the AI Persona Core, we get this:

<ThingDef ParentName="ResourceBase">
<defName>Xbox</defName>
<label>Xbox360</label>
<description>Some kind of ancient technology used by the long-dead race only known as Console Peasants.</description>
<graphicData>
<texPath>Items/Xbox/Xbox</texPath>
<!-- The way the game looks at this: it will first
search for a folder named Items in the folder Textures in your mod,
then it will search for a folder named Xbox in the Items folder,
then it will search for a file named Xbox in the Xbox folder.
For my quick test I've dropped a png file I grabbed from my mod real quick
and renamed it to Xbox.png and it works flawlessly. -->
<graphicClass>Graphic_Single</graphicClass>
</graphicData>
<resourceReadoutPriority>Middle</resourceReadoutPriority>
<soundInteract>Metal_Drop</soundInteract>
<soundDrop>Metal_Drop</soundDrop>
<stackLimit>1</stackLimit>
<useHitPoints>true</useHitPoints>
<statBases>
<MarketValue>1000</MarketValue>
<MaxHitPoints>100</MaxHitPoints>
<Mass>2</Mass>
<Beauty>0</Beauty>
<!-- I've dropped the MarketValue and added a Beauty of zero to overwrite
the one in ResourceBase. -->
</statBases>
<thingCategories>
<li>Items</li>
</thingCategories>
<drawGUIOverlay>false</drawGUIOverlay>
<!-- Make sure that drawGUIOverlay is set to true if stackLimit is over 1. -->
<tradeTags>
<li>Exotic</li>
<!-- This just tells traders what category the item is. -->
</tradeTags>
</ThingDef>


So now we have the basics. The item is now fully functional but can't be crafted yet. Since you've mentioned weapons, let's look at some weapon defs.

Like with the AI Persona Core, weapons also inherit from abstract defs. Let's start with those first, in Defs/ThingDefs_Misc/Weapons_Guns.xml:

<ThingDef Name="BaseMakeableGun" ParentName="BaseGun" Abstract="True">
<recipeMaker>
<workSpeedStat>SmithingSpeed</workSpeedStat>
<workSkill>Crafting</workSkill>
<effectWorking>Smith</effectWorking>
<soundWorking>Recipe_Smith</soundWorking>
<recipeUsers>
<li>TableMachining</li>
</recipeUsers>
<unfinishedThingDef>UnfinishedGun</unfinishedThingDef>
</recipeMaker>
</ThingDef>


Well, well, well. What do we have here? The recipeMaker acts like a built-in RecipeDef. Of course it needs some more data but the core functionality is there. We'll grab this data for our item.

There are some more abstract defs that weapons inherit from but for our item we won't need to inspect those. Time to take a look at an actual weapon. In this same file, we'll take the Pistol as an example:

<ThingDef ParentName="BaseHumanMakeableGun">
<defName>Gun_Pistol</defName>
<label>pistol</label>
<description>Ancient pattern automatic pistol. Weak and short range, but quick.</description>
<graphicData>
<texPath>Things/Item/Equipment/WeaponRanged/Pistol</texPath>
<graphicClass>Graphic_Single</graphicClass>
</graphicData>
<soundInteract>InteractPistol</soundInteract>
<statBases>
<WorkToMake>15000</WorkToMake>
<Mass>1.2</Mass>
<AccuracyTouch>0.91</AccuracyTouch>
<AccuracyShort>0.71</AccuracyShort>
<AccuracyMedium>0.50</AccuracyMedium>
<AccuracyLong>0.32</AccuracyLong>
<RangedWeapon_Cooldown>1.26</RangedWeapon_Cooldown>
</statBases>
<costList>
<Steel>30</Steel>
<Component>2</Component>
</costList>
<verbs>
<li>
<verbClass>Verb_Shoot</verbClass>
<hasStandardCommand>true</hasStandardCommand>
<projectileDef>Bullet_Pistol</projectileDef>
<warmupTime>0.3</warmupTime>
<range>24</range>
<soundCast>ShotPistol</soundCast>
<soundCastTail>GunTail_Light</soundCastTail>
<muzzleFlashScale>9</muzzleFlashScale>
</li>
</verbs>
</ThingDef>


The costList is what we're after. The verbs section refers to the ability to shoot, by the way. Also worth to mention the WorkToMake in statBases.

So let's add the new data to our abomination Xbox!

<ThingDef ParentName="ResourceBase">
<defName>Xbox</defName>
<label>Xbox360</label>
<description>Some kind of ancient technology used by the long-dead race only known as Console Peasants.</description>
<graphicData>
<texPath>Items/Xbox/Xbox</texPath>
<graphicClass>Graphic_Single</graphicClass>
</graphicData>
<resourceReadoutPriority>Middle</resourceReadoutPriority>
<soundInteract>Metal_Drop</soundInteract>
<soundDrop>Metal_Drop</soundDrop>
<stackLimit>1</stackLimit>
<useHitPoints>true</useHitPoints>
<statBases>
<MarketValue>1000</MarketValue>
<MaxHitPoints>100</MaxHitPoints>
<Mass>2</Mass>
<Beauty>0</Beauty>
<WorkToMake>2500</WorkToMake>
<!-- Added WorkToMake so it's not completed instantly. -->
</statBases>
<recipeMaker>
<workSpeedStat>SmithingSpeed</workSpeedStat>
<workSkill>Crafting</workSkill>
<effectWorking>Smith</effectWorking>
<soundWorking>Recipe_Smith</soundWorking>
<recipeUsers>
<li>TableMachining</li>
<!-- This tells the game what worktable the recipe is for. -->
</recipeUsers>
<unfinishedThingDef>UnfinishedGun</unfinishedThingDef>
<!-- This unfinishedThingDef will spawn an unfinished item until you
complete crafting. Exactly like for guns! -->
</recipeMaker>
<costList>
<Steel>50</Steel>
<Component>8</Component>
<!-- This tells the game what resources the recipe will require. -->
</costList>
<thingCategories>
<li>Items</li>
</thingCategories>
<drawGUIOverlay>false</drawGUIOverlay>
<tradeTags>
<li>Exotic</li>
</tradeTags>
</ThingDef>


I've tested it personally and it works. It's just an item with no uses whatsoever, but it's craftable and should appear, as long as you provide a texture file for it.

Quote from: Compo on March 20, 2017, 10:40:21 AM
Ive screwed up a 5yr colony testing for this, which im gutted about.

Never, NEVER, NEVER test your shit in your main game. It's always best to test in a new game. Use the dev tools to do research and spawn buildings/pawns. It's basically god mode, made exactly for devs/modders.

Quote from: Compo on March 20, 2017, 10:40:21 AM
But some xml code would be awesome, with examples of the things ive asked for.

Gotcha covered.

jimthenoob

That seems like a much easier and less round about way, i was making recipes that called up items later. nice tips!

Compo

Just..WOW!
You guys are truly awesomes! Thx so much. Going to give it another crack today, cant go wrong really..surely lol

P.S. Hahaa, the references/descriptions you both gave for the classic xbox360 were ACE! Had me truly laughing!

Ive been staring at pretty much the code youve put up, i did find out the machining table was called "TableMachining", but i guess i made cockups elsewhere.
Ahhh the AI persona Core, (way too powerful for an xbox360) that is exactly the type of item i was needing. You def (or is it Def?) got me covered mate!

Anyways, thx again..you both deserve medals!

Compo

Man o man...

Ive got another problem  ::)

After this great help, in the end i decided to go ahead and make my own workbench. It all works great.
But ive only just bloody figured out, all my stuff (guns) can still be made at the machining table, as well as me bench lol!

Its not exactly the tidiest mod, with bits needed for this n that...
Tho now, its not only my bench thats cluttered, ive made the vanilla bench cluttered too!  :o

Is there anything i can do to disable my things showing up on the vanilla one? Ive tried removing "gun" tags, which didnt work.
Theres nothing in the xml i can see that points to the tableMachining.

Shinzy

It sounds like your defs inherit that from their 'parent' def
<ThingDef ParentName="BaseHumanMakeableGun">

It's likely you're going to need to make your own parent def for them
Go find BaseHumanMakeableGun and copypaste that into your xml and modify that

Compo

Thx Shinzy, i'll give that a go!

Compo

#8
This is the code that im using. Not exactly sure still what to do. Sorry and thanks.


<?xml version="1.0" encoding="utf-8" ?>
<ThingDefs>
<ThingDef ParentName="BaseBullet">
    <defName>Bullet_A1000P</defName>
    <label>A1000 Bullet</label>
    <projectile>
      <damageDef>Bullet</damageDef>
      <damageAmountBase>20</damageAmountBase>
      <speed>80</speed>
    </projectile>
    <graphicData>
      <texPath>Things/Projectile/Bullet_big</texPath>
      <graphicClass>Graphic_Single</graphicClass>
    </graphicData>
  </ThingDef>
  <ThingDef ParentName="BaseHumanMakeableGun">
    <defName>A1000P</defName>
    <label>A1000</label>
    <description>The A1000.A very powerful weapon, when equiped with certain accesories.</description>
    <graphicData>
    <texPath>Things/A1000P</texPath>
    <graphicClass>Graphic_Single</graphicClass>
    </graphicData>
   <soundInteract>InteractRifle</soundInteract>
   <statBases>
      <MarketValue>500</MarketValue>
     <WorkToMake>30000</WorkToMake>
      <Mass>3.5</Mass>
      <AccuracyTouch>0.30</AccuracyTouch>
      <AccuracyShort>0.60</AccuracyShort>
      <AccuracyMedium>0.60</AccuracyMedium>
      <AccuracyLong>0.60</AccuracyLong>
      <RangedWeapon_Cooldown>1.40</RangedWeapon_Cooldown>
    </statBases>
   <recipeMaker>
      <workSpeedStat>SmithingSpeed</workSpeedStat>
      <skillRequirements>
         <li>
            <skill>Crafting</skill>
            <minLevel>5</minLevel>
         </li>
      </skillRequirements>
      <workSkill>Crafting</workSkill>
      <effectWorking>Smith</effectWorking>
      <soundWorking>Recipe_Smith</soundWorking>
      <recipeUsers>
         <li>A1000_WorkBench</li>
         <!-- This tells the game what worktable the recipe is for. -->
      </recipeUsers>
      <unfinishedThingDef>UnfinishedGun</unfinishedThingDef>
      <!-- This unfinishedThingDef will spawn an unfinished item until you
      complete crafting. Exactly like for guns! -->
   </recipeMaker>
   <costList>
      <Steel>100</Steel>
      <Component>10</Component>
    </costList>
    <verbs>
      <li>
        <verbClass>Verb_Shoot</verbClass>
        <hasStandardCommand>true</hasStandardCommand>
        <projectileDef>Bullet_A1000P</projectileDef>
        <warmupTime>1.1</warmupTime>
        <range>44</range>
        <burstShotCount>4</burstShotCount>
       <ticksBetweenBurstShots>5</ticksBetweenBurstShots>
      <soundCast>ShotSurvivalRifle</soundCast>
        <soundCastTail>GunTail_Heavy</soundCastTail>
        <muzzleFlashScale>10</muzzleFlashScale>
      </li>
    </verbs>
   <weaponTags>
      <li>Gun</li>
      </weaponTags>
  </ThingDef>
</ThingDefs>

Shinzy

A bit in your xml (I'll modify your post to highlight it) is referring to this here bit
  <ThingDef Name="BaseHumanMakeableGun" ParentName="BaseMakeableGun" Abstract="True">
    <weaponTags>
      <li>Gun</li>
    </weaponTags>
  </ThingDef>


which in turn refers to this thing
  <ThingDef Name="BaseMakeableGun" ParentName="BaseGun" Abstract="True">
    <recipeMaker>
      <workSpeedStat>SmithingSpeed</workSpeedStat>
      <workSkill>Crafting</workSkill>
      <effectWorking>Smith</effectWorking>
      <soundWorking>Recipe_Smith</soundWorking>
      <recipeUsers>
        <li>TableMachining</li>
      </recipeUsers>
      <unfinishedThingDef>UnfinishedGun</unfinishedThingDef>
    </recipeMaker>
  </ThingDef>


which lets the guns to be crafted at a machining table

so you need to either make your own parent def for the guns
or remove the bit referring to the parent entirely

Compo

Legend! Thanks mate, just deleted parent an worked ace :)

Compo

#11
umm

Im now getting errors that the guns have a "null thing class"

Ive updated to steam too..
weird thing is it seems to be ok on mates laptop, but on my PC i cant get game to load  :(

Im not entirely sure i updated the mod correctly.
Any pointers to actually do that as well?
I have two mod folders (mine), on my mod list, but could only update the non-steam one. Did that update the steam one?
Some simple directions on how to fix mod, and update it on steam would be so helpful. Cheers

Edit:
Actually mate is getting errors also.

Ive now updated steam to revert it back, so at least its working again  :D

So how would i go about making a new parentgun?
Do i need a new folder somewhere?
Or just paste the parentgun above existing xml, an edit it to something else?

Thanks

Shinzy

The parents are separate defs you put into either a separate or the same xml file with the rest of the guns, then when you define those defs as parent of your gun def it'll inherit all the data from it
Which means you could also just copy paste all the fields from the parent defs into the gun def directly and forget about even making a parent def

but right now I'd recommend cross referencing your xml file with the vanilla gun xml file and see what's different
that way you'll start to understand how the things work bit better (and face way less problems!)
it might take a while but it's well worth the effort! ;D

Compo

Im sorry Shinzy (by now im guessing youre thinking silly TW?T), but I think ive tried the ways you said, and its just not working.
Im not the brightest tool, when it comes to this stuff lol.
I understand whats wrong, but cant seem to fix.

I do not suppose you could just look through my mod folder for me, and show me with pics of code, what needs to be changed?
If you look at the way jimthenoob & Granitecosmos, explained things (above), like to a simpleton..that works lol.

Heres my steam link:
http://steamcommunity.com/sharedfiles/filedetails/?id=892234587
Heres my dropbox link:
https://www.dropbox.com/sh/cxn8cces1x3bf4x/AABOmD4SEegEp0zy7lmJx2kca?dl=0

Anyways, thanks for your time, i really do appreciate it mate.

Granitecosmos

Quote from: Compo on March 28, 2017, 09:43:18 AM
After this great help, in the end i decided to go ahead and make my own workbench. It all works great.
But ive only just bloody figured out, all my stuff (guns) can still be made at the machining table, as well as me bench lol!

Round two. Fight!

In order to fix the problem we have to trace back to the part of the code that contains reference to TableMachining. Clues are everywhere, you just have to follow them.

  <ThingDef ParentName="BaseHumanMakeableGun">
    <defName>A1000P</defName>
    <label>A1000</label>
    <description>The A1000.A very powerful weapon, when equiped with certain accesories.</description>
    <graphicData>
    <texPath>Things/A1000P</texPath>
    <graphicClass>Graphic_Single</graphicClass>
    </graphicData>
<soundInteract>InteractRifle</soundInteract>
<statBases>
      <MarketValue>500</MarketValue>
  <WorkToMake>30000</WorkToMake>
      <Mass>3.5</Mass>
      <AccuracyTouch>0.30</AccuracyTouch>
      <AccuracyShort>0.60</AccuracyShort>
      <AccuracyMedium>0.60</AccuracyMedium>
      <AccuracyLong>0.60</AccuracyLong>
      <RangedWeapon_Cooldown>1.40</RangedWeapon_Cooldown>
    </statBases>
<recipeMaker>
<workSpeedStat>SmithingSpeed</workSpeedStat>
<skillRequirements>
<li>
<skill>Crafting</skill>
<minLevel>5</minLevel>
</li>
</skillRequirements>
<workSkill>Crafting</workSkill>
<effectWorking>Smith</effectWorking>
<soundWorking>Recipe_Smith</soundWorking>
<recipeUsers>
<li>A1000_WorkBench</li>
<!-- This tells the game what worktable the recipe is for. -->
</recipeUsers>
<unfinishedThingDef>UnfinishedGun</unfinishedThingDef>
<!-- This unfinishedThingDef will spawn an unfinished item until you
complete crafting. Exactly like for guns! -->
</recipeMaker>
<costList>
      <Steel>100</Steel>
      <Component>10</Component>
    </costList>
    <verbs>
      <li>
        <verbClass>Verb_Shoot</verbClass>
        <hasStandardCommand>true</hasStandardCommand>
        <projectileDef>Bullet_A1000P</projectileDef>
        <warmupTime>1.1</warmupTime>
        <range>44</range>
        <burstShotCount>4</burstShotCount>
    <ticksBetweenBurstShots>5</ticksBetweenBurstShots>
<soundCast>ShotSurvivalRifle</soundCast>
        <soundCastTail>GunTail_Heavy</soundCastTail>
        <muzzleFlashScale>10</muzzleFlashScale>
      </li>
    </verbs>
<weaponTags>
      <li>Gun</li>
      </weaponTags>
  </ThingDef>


No sign of TableMachining but the code inherits from BaseHumanMakeableGun. So let's find that one, it's in Core\Defs\ThingDefs_Misc\Weapons_Guns.xml:

  <ThingDef Name="BaseHumanMakeableGun" ParentName="BaseMakeableGun" Abstract="True">
    <weaponTags>
      <li>Gun</li>
    </weaponTags>
  </ThingDef>


Still no sign of TableMachining but this one inherits from BaseMakeableGun. That one is in the same file:

  <ThingDef Name="BaseMakeableGun" ParentName="BaseGun" Abstract="True">
    <recipeMaker>
      <workSpeedStat>SmithingSpeed</workSpeedStat>
      <workSkill>Crafting</workSkill>
      <effectWorking>Smith</effectWorking>
      <soundWorking>Recipe_Smith</soundWorking>
      <recipeUsers>
        <li>TableMachining</li>
      </recipeUsers>
      <unfinishedThingDef>UnfinishedGun</unfinishedThingDef>
    </recipeMaker>
  </ThingDef>


We got the TableMachining reference here. Now, we can't just change this because every craftable vanilla gun inherits from this. So we make our own abstract instead and, while we're on it, we'll merge BaseHumanMakeableGun and BaseMakeableGun functionalities for our new abstract.

So let's merge the code and remove TableMachining and we get this:

<ThingDef Name="A1000Abstract" ParentName="BaseGun" Abstract="True">
<recipeMaker>
<workSpeedStat>SmithingSpeed</workSpeedStat>
<workSkill>Crafting</workSkill>
<effectWorking>Smith</effectWorking>
<soundWorking>Recipe_Smith</soundWorking>
<unfinishedThingDef>UnfinishedGun</unfinishedThingDef>
</recipeMaker>
<weaponTags>
<li>Gun</li>
</weaponTags>
</ThingDef>


Now that we're done with the easy and fun part, you'll have to continue with the long and tedious one. You'll have to change every line of ParentName="BaseHumanMakeableGun" to ParentName="A1000Abstract" in every xml you have weapon codes in your mod. Considering the number of files this will probably feel somewhere between annoying and rage-inducing.

Flawless victory!