Menu

Show posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.

Show posts Menu

Topics - EzraN

#1
Help / Add item to ThingDefOf for spawning.
August 26, 2016, 11:33:12 PM
I am working on a mod with multiple items and have created a building that when it is spawned will place a new item I made from the mod beside it. The trouble is with getting the item to spawn since when using GenSpawn you need a thingdef, but I am not too sure on how to reference that item or locate it. How can I find that item and then place it into GenSpawn or a similar method to make it spawn into the game world?
#2
Outdated / [A14] Resource Mining Rig (1.2)
August 17, 2016, 04:25:14 PM
Resource Miner

Description:
This mod adds a new way for you to get resources passively. You can construct a 2*2 mining 'rig' that will use power to find resources like stone, silver, steel, and other metals and place them around the rig.

Texture updated to look slightly more like it belongs in the game

Stone blocks will now spawn instead of stone walls, (Mountain rock?) steel slag also possibly now.

Images:




Technical Details:
Power Usage: 1500 W
Stack size: 1 (Will not stack items)
Will not place items on 'filled' zones (buildings, walls, ect...)
It will place an item at the surface about every two minutes.

Author
Me and a bunch of forum posts  :P

Download
https://www.dropbox.com/sh/az7c92dq4zyr6ux/AAC2tLXPViHxAH4x5dTLwppMa?dl=0

How to install:
- Unzip the contents and place them in your RimWorld/Mods folder.
- Activate the mod in the mod menu in the game.

Side Notes:
First mod I have made so criticism would be very helpful. I know the texture for the mining rig is not very good I'm not a good artist, might update it with a better texture if I can figure out what to make it look like...



  • If someone wanted to use this mod for any of their modpacks I would be very happy for you to do so.
  • If you want to see how it works or want to change it to work better for you I will post the link to the development version.
#3
Help / Spawning items into game world.
August 16, 2016, 09:24:54 PM
Right now I am trying to figure out how to use C# with items for mods and have run into a problem. What I'm trying to do is create a block that will spawn in an item (steel), but it doesn't work.
Could not convert id number from thingID=Steel, numString= Exception=System.FormatException: Input string was not in the correct format
  at System.Int32.Parse (System.String s) [0x00000] in <filename unknown>:0
  at System.Convert.ToInt32 (System.String value) [0x00000] in <filename unknown>:0
  at Verse.Thing.IDNumberFromThingID (System.String thingID) [0x00000] in <filename unknown>:0

This error message will pop up so I must not be using the ThingID property correctly, has anyone used it before?

This is the code that I am using trying to spawn the item in with:

   
Thing item = new Thing();
item.ThingID = ("Steel");
                   
GenSpawn.Spawn(item, location);


#4
Help / Tried to SetFactionDirect on a building error.
August 12, 2016, 06:20:02 PM
There is a problem when I try to create a new type of table in the game and spawn it in, it will say Tried to SetFactionDirect on VaultTable4848 which cannot have a faction..
I've looked through the xml file to see if "SetFactionDirect" is in the file, but I can't find it. The output log says: (Filename: C:/buildslave/unity/build/artifacts/generated/common/runtime/UnityEngineDebugBindings.gen.cpp Line: 37)

Tried to SetFactionDirect on VaultTable4848 which cannot have a faction.

(Filename: C:/buildslave/unity/build/artifacts/generated/common/runtime/UnityEngineDebugBindings.gen.cpp Line: 37)

Setting up 1 worker threads for Enlighten.
  Thread -> id: 4a0 -> priority: 1


And the table xml file reads:
<?xml version="1.0" encoding="utf-8" ?>
<ThingDefs>

 
  <ThingDef>
    <DefName>VaultTable</DefName>
    <label>Vault construction table</label>
    <ThingClass>Building_WorkTable</ThingClass>
    <Description>Info on bench...</Description>
    <graphicData>
      <texPath>Things/VaultTable</texPath>
      <graphicClass>Graphic_Random</graphicClass>
      <drawSize>(3.5,1.5)</drawSize>
      <damageData>
        <cornerTL>Damage/Corner</cornerTL>
        <cornerTR>Damage/Corner</cornerTR>
        <cornerBL>Damage/Corner</cornerBL>
        <cornerBR>Damage/Corner</cornerBR>
      </damageData>
    </graphicData>
    <castEdgeShadows>true</castEdgeShadows>
    <staticSunShadowHeight>0.20</staticSunShadowHeight>
    <costStuffCount>75</costStuffCount>
    <CostList>
      <Steel>50</Steel>
      <Component>3</Component>
    </CostList>
    <stuffCategories>
      <li>Metallic</li>
      <li>Woody</li>
    </stuffCategories>
    <AltitudeLayer>Building</AltitudeLayer>
    <fillPercent>0.5</fillPercent>
    <useHitPoints>True</useHitPoints>
    <statBases>
      <WorkToMake>2500</WorkToMake>
      <MaxHitPoints>180</MaxHitPoints>
      <Flammability>1.0</Flammability>
    </statBases>
    <Size>(3,1)</Size>
    <DesignationCategory>Production</DesignationCategory>
    <Passability>PassThroughOnly</Passability>
    <pathCost>70</pathCost>
    <hasInteractionCell>True</hasInteractionCell>
    <interactionCellOffset>(0,0,-1)</interactionCellOffset>
    <surfaceType>Item</surfaceType>
    <inspectorTabs>
      <li>ITab_Bills</li>
    </inspectorTabs>
    <building>
      <spawnedConceptLearnOpportunity>BillsTab</spawnedConceptLearnOpportunity>
      <unpoweredWorkTableWorkSpeedFactor>0.4</unpoweredWorkTableWorkSpeedFactor>
    </building>
    <comps>
      <li Class="CompProperties_AffectedByFacilities">
        <linkableFacilities>
          <li>ToolCabinet</li>
        </linkableFacilities>
      </li>
      <li Class="CompProperties_Breakdownable"/>
    </comps>

  </ThingDef>
 
</ThingDefs>


Am I missing something from this?
#5
I am trying to create a piece of clothing that will not be affected by the materials it is made by, is there a setting to turn this off?
#6
I am trying to figure out how to use the xml modding system, but I am having some trouble. Currently I am trying to create a workbench that will combine two ingredients to form a new item, but right now I have it just convert slag into steel. The whole system works until the slag is supposed to turn into steel where the debug menu says
JobDriver threw exception in initAction, Pawn=Emmie, Job=DoBill A=Thing_RobotTable53782, Exception: System.NullREferenceException: Object reference not set to an instance of an object

The problem does not happen when I remove the products item in the recipe def I assume since it doesn't try to create the object. Is there a thing I am missing when I spawn it? Right now I pulled parts of the core mod xml code to try to get it to work is there things that I am missing/have things not needed?

ThingDef:
<?xml version="1.0" encoding="utf-8" ?>
<Buildings>

  <ThingDef Name="BenchBase" ParentName="BuildingBase" Abstract="True">
    <castEdgeShadows>true</castEdgeShadows>
    <staticSunShadowHeight>0.20</staticSunShadowHeight>
  </ThingDef>

  <ThingDef ParentName="BenchBase">
    <DefName>RobotTable</DefName>
    <label>Robot construction table</label>
    <ThingClass>Building_WorkTable</ThingClass>
    <Description>A workbench equipped for building advanced robots.</Description>
    <graphicData>
      <texPath>Things/Building/Production/TableSculpting</texPath>
      <graphicClass>Graphic_Multi</graphicClass>
      <drawSize>(3.5,1.5)</drawSize>
      <damageData>
        <cornerTL>Damage/Corner</cornerTL>
        <cornerTR>Damage/Corner</cornerTR>
        <cornerBL>Damage/Corner</cornerBL>
        <cornerBR>Damage/Corner</cornerBR>
      </damageData>
    </graphicData>
   
    <CostList>
      <Steel>50</Steel>
    </CostList>
    <stuffCategories>
      <li>Metallic</li>
      <li>Woody</li>
    </stuffCategories>
    <costStuffCount>75</costStuffCount>
   
    <AltitudeLayer>Building</AltitudeLayer>
    <fillPercent>0.5</fillPercent>
    <useHitPoints>True</useHitPoints>
    <statBases>
      <WorkToMake>2500</WorkToMake>
      <MaxHitPoints>180</MaxHitPoints>
      <Flammability>1.0</Flammability>
      <Cleanliness>0</Cleanliness>
    </statBases>
    <Size>(3,1)</Size>
    <DesignationCategory>Production</DesignationCategory>
    <Passability>PassThroughOnly</Passability>
    <pathCost>70</pathCost>
    <hasInteractionCell>True</hasInteractionCell>
    <interactionCellOffset>(0,0,-1)</interactionCellOffset>
    <surfaceType>Item</surfaceType>
    <inspectorTabs>
      <li>ITab_Bills</li>
    </inspectorTabs>
    <building>
      <spawnedConceptLearnOpportunity>BillsTab</spawnedConceptLearnOpportunity>
    </building>
    <comps>
      <li Class="CompProperties_AffectedByFacilities">
        <linkableFacilities>
          <li>ToolCabinet</li>
        </linkableFacilities>
      </li>
    </comps>
   
    <recipes>
      <li>craftWire</li>
    </recipes>

  </ThingDef>
</Buildings>


RecipeDef:

<?xml version="1.0" encoding="utf-8" ?>
<RecipeDefs>
  <RecipeDef>
    <defName>craftWire</defName>
    <label>Craft electrical wires</label>
    <description>Creates wires useful for building robots.</description>
    <jobString>Crafting Wire.</jobString>
    <workAmount>500</workAmount>


    <fixedIngredientFilter>
      <thingDefs>
        <li>ChunkSlagSteel</li>
      </thingDefs>
    </fixedIngredientFilter>

    <products>
      <li>
        <Steel>1</Steel>
      </li>
    </products>
   
  </RecipeDef>
</RecipeDefs>


WorkGiverDef:
<?xml version="1.0" encoding="utf-8" ?>
<WorkGivers>
  <WorkGiverDef>
    <defName>DoBillsRobotTable</defName>
    <label>Work at robotics table</label>
    <giverClass>WorkGiver_DoBill</giverClass>
    <workType>Smithing</workType>
    <fixedBillGiverDefs>
      <li>RobotTable</li>
    </fixedBillGiverDefs>
    <verb>work</verb>
    <gerund>working at</gerund>
  </WorkGiverDef>
</WorkGivers>


I'm kinda new to xml code but have a bit of a background in html.