Hello all, help with some modding please?

Started by Jessi, August 02, 2014, 08:07:23 PM

Previous topic - Next topic

Jessi

I tried to follow a few tutorials on creating a basic 1x1 block, (Made a 64X64px Companion Cube in SAI), and implementing it into the game, but it doesn't show up in game although the code I put into the xml's were to the T, I believe.

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

   <ThingDef Name="BuildingBase" Abstract="True">
      <category>Building</category>
      <soundBulletHit>BulletImpactMetal</soundBulletHit>
      <selectable>true</selectable>
      <drawerType>MapMeshAndRealTime</drawerType>
      <surfaceNeeded>Light</surfaceNeeded>
      <constructionEffect>ConstructMetal</constructionEffect>
      <repairEffect>Repair</repairEffect>
   </ThingDef>
   
    <ThingDef ParentName="BuildingBase">
      <eType>BuildingComplex</eType>
      <thingClass>Building</thingClass>
      <altitudeLayer>Waist</altitudeLayer>
      <passability>Impassable</passability>
      <castEdgeShadows>true</castEdgeShadows>
      <fillPercent>1</fillPercent>
      <placingDraggableDimensions>0</placingDraggableDimensions>
      <tickerType>Never</tickerType>
      <rotatable>true</rotatable>
      <neverMultiSelect>true</neverMultiSelect>
      <holdsRoof>false</holdsRoof>
      <Overdraw>false</Overdraw>
      <designationCategory>Decoration</designationCategory>
      <staticSunShadowHeight>0.5</staticSunShadowHeight>
      <blockLight>true</blockLight>

      <defName>SimpleBlock</defName>
      <label>Companion Cube</label>
      <description>A friend when you have none.</description>
      <texturePath>Things/Building/SimpleBlock_Atlas</texturePath>
      <uiIconPath>Things/Building/SimpleBlock_MenuIcon</uiIconPath>
      <maxHealth>500</maxHealth>
      <flammability>0.1</flammability>
      <workToBuild>100</workToBuild>
      <mineable>false</mineable>
      <size>(1,1)</size>
      <costList>
         <li>
            <thingDef>Metal</thingDef>
            <count>10</count>
         </li>
      </costList>
      <filthLeavings>
         <li>
            <thingDef>SlagRubble</thingDef>
            <count>4</count>
         </li>
      </filthLeavings>
      <designationHotKey>Z</designationHotKey>
   </ThingDef>
</Buildings>

I've got textures in another Def folder, so it should be working? I'm lost. :(
A curious little creature...

mrofa

#1
What error do you get ?

Edit: just tested it its working
From what you did write i assume that you did make wrong texture path
In your mod folder it should look like:
Your_mod_folder -> Textures(if you dont have it then make with exact name)

texturepath starts reading from texture folder so if your structure looks like my_mod/texture/building/my_texture.png
then in texturepath you need to write "building/my_texture"
And remmber that all text is case sensitive.

All i do is clutter all around.

Jessi

#2
Quote from: mrofa on August 02, 2014, 08:59:42 PM
What error do you get ?

No errors, I enable the dev mode, load the mod with my other mods, and let it load. I open the console after and nothing appears to tell me anything has loaded wrong. Loading or starting a new game though, the new object doesn't appear.

Could it be my pathing?

From the Mods Folder I have CompanionCube, which branches into two.

/Defs/ThingsDefs/Buildings.xml
And,
/Textures/Things/Buildings/CompanionCube.png

The 'About' is in there too.
A curious little creature...

mrofa

Did you enable your mod in game ?
It maybe that you got wrong folder structure
Normally it looks like Rimworld/mods/my_mod
in my_mod you should have Defs,Textures and About folders
All i do is clutter all around.

Bog

#4
Please note: I don't have any experience with rimworld buildings, (yet) just with weapons, so my info might be wrong.


Your file has <defName>SimpleBlock</defName> in it. If you haven't changed that from the original name in the file then that's most likely your problem.

If the game already has a SimpleBlock defname in it somewhere then when loading the mod it will think your new item and the original SimpleBlock are one and the same thing, so it won't show up, and won't send a bug report because it'll think everything's fine and dandy.

Changing it to CompanionCube or something should fix it if that's the case.

Anyways, that's the problem I've always had when a new gun I make doesn't show up. The bugs that don't tell you what's wrong are the worst. Took me a while minutes to figure it out the first time I made that mistake.

Oh, and just below the SimpleBlock defname it's still going to a different texture so far as I can tell. I think you probably want it to say <texturePath>Things/Building/CompanionCube</texturePath> instead of  <texturePath>Things/Building/SimpleBlock_Atlas</texturePath>.



PS: I was working on my own companion cube, but have only got so far as the "brainstorming" phase on it. I figured I'd make it a "chunk" instead of a building so people could move it around. Of course that'll mean someone using it would have to place a stockpile for it and designate it for hauling to move it, but then it'd be movable and if you don't mark it for hauling your colonists would leave it be, which I think is desirable.

I primarily haven't done it though because I'd like to make it so that it increases the morale of nearby characters, which I wouldn't even know where to start for working on it. So I've been working on the portal cake instead. :D
Divergence of Civilization Lead Developer (in this case that's the fancy way of saying "Only Developer")

Project Armoury Developer (New huge 2.13 Release now live!)

mrofa

I did copy/plased his code in one of my def files and it worked normally, so only thing that comes to mind is folder path.
All i do is clutter all around.

Bog

#6
Okay so I went and familiarized myself with the building code.

In your .hml file the texture path is currently:

<texturePath>Things/Building/SimpleBlock_Atlas</texturePath>

If I understand correctly, then right now your texture is:

/Textures/Things/Buildings/CompanionCube.png

So that doesn't seem to be lining up. They need to be the same.

First of all one says "/Buildings/" and the other says "/Building/". Either they both need to have an "s" or they both need to not have it. They need to match or it won't work. I'd remove the "s" if it was my mod, but if you want you could also add an "s" to the one lacking it.

Second of all, as I said in the last post you'll want to rename the texture path to say:
<texturePath>Things/Building/CompanionCube</texturePath> (You don't need the .png)

That way it'll see and use your texture.

If after all that it still doesn't work then don't despair! Just come back and say so. There are other options available, such as sending one of us the entire mod via e-mail or something so we can have a "hands-on" look at it to see what's wrong and hopefully fix it and explain to you exactly what the problem is, and how you can avoid it next time.

We'll make a modder of you yet. ;)
Divergence of Civilization Lead Developer (in this case that's the fancy way of saying "Only Developer")

Project Armoury Developer (New huge 2.13 Release now live!)

Jessi

Quote from: Bog on August 03, 2014, 12:25:12 AM
Okay so I went and familiarized myself with the building code.

In your .hml file the texture path is currently:

<texturePath>Things/Building/SimpleBlock_Atlas</texturePath>

If I understand correctly, then right now your texture is:

/Textures/Things/Buildings/CompanionCube.png

So that doesn't seem to be lining up. They need to be the same.

First of all one says "/Buildings/" and the other says "/Building/". Either they both need to have an "s" or they both need to not have it. They need to match or it won't work. I'd remove the "s" if it was my mod, but if you want you could also add an "s" to the one lacking it.

Second of all, as I said in the last post you'll want to rename the texture path to say:
<texturePath>Things/Building/CompanionCube</texturePath> (You don't need the .png)

That way it'll see and use your texture.

If after all that it still doesn't work then don't despair! Just come back and say so. There are other options available, such as sending one of us the entire mod via e-mail or something so we can have a "hands-on" look at it to see what's wrong and hopefully fix it and explain to you exactly what the problem is, and how you can avoid it next time.

We'll make a modder of you yet. ;)

This is my code now; it's still not showing in game. :/

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


   <ThingDef Name="BuildingBase" Abstract="True">
      <category>Building</category>
      <soundBulletHit>BulletImpactMetal</soundBulletHit>
      <selectable>true</selectable>
      <drawerType>MapMeshAndRealTime</drawerType>
      <surfaceNeeded>Light</surfaceNeeded>
      <constructionEffect>ConstructMetal</constructionEffect>
      <repairEffect>Repair</repairEffect>
   </ThingDef>
      
<ThingDef ParentName="BuildingBase">
      <defName>CompanionCube</defName>
      <eType>BuildingInert</eType>
      <label>CompanionCube</label>
      <thingClass>Building</thingClass>
      <category>Building</category>
      <texturePath>CompanionCube/Textures/Things/Buildings</texturePath>
      <altitudeLayer>Waist</altitudeLayer>
      <pathCost>60</pathCost>
      <passability>PassThroughOnly</passability>
      <castEdgeShadows>true</castEdgeShadows>
      <fillPercent>0.5</fillPercent>
      <maxHealth>500</maxHealth>
      <size>1,1</size>
      <description>A stunning crate. What a good friend it'd be.</description>
      <workToBuild>20</workToBuild>
      <costList>
         <li>
            <thingDef>Metal</thingDef>
            <count>50</count>
         </li>
      </costList>
      <filthLeavings>
         <li>
            <thingDef>ChunkSlag</thingDef>
            <count>2</count>
         </li>
      </filthLeavings>
      <rotatable>true</rotatable>
      <selectable>true</selectable>
      <neverMultiSelect>true</neverMultiSelect>
      <beauty>NiceTiny</beauty>
      <surfaceNeeded>Light</surfaceNeeded>
      <designationCategory>Decoration</designationCategory>
      <staticSunShadowHeight>0.20</staticSunShadowHeight>
      <constructionEffect>ConstructDig</constructionEffect>
      <repairEffect>ConstructDig</repairEffect>
   </ThingDef>
   
</Buildings>

The Pathing files are:
/Defs/ThingsDefs/Buildings.xml
And,
/Textures/Things/Buildings/CompanionCube.png
A curious little creature...

mrofa

Again :p
Press "~" in game menu to see if you got any errors.
Check if mod is activated in game mod menu
Check if mod itself is in proper folder structue ( Rimworld/Mods/My_mod/ (Defs and Textures folders))

Your prev code worked if you dont have any errors and dont see it in game (Decoration category)
It means that the game dont see your mod files and that means you got wrong folder structure.
Check Core mod in Rimworld/Mods folder, for proper folder/file structure
All i do is clutter all around.

Haplo

As far as I see it, you didn't do as mrofa told you to do.
You have this texture path:
<texturePath>CompanionCube/Textures/Things/Buildings</texturePath>
where it should be
<texturePath>Things/Buildings/CompanionCube</texturePath>

Shinzy

Quote from: Haplo on August 03, 2014, 08:21:01 AM
As far as I see it, you didn't do as mrofa told you to do.
You have this texture path:
<texturePath>CompanionCube/Textures/Things/Buildings</texturePath>
where it should be
<texturePath>Things/Buildings/CompanionCube</texturePath>

^ This!
That same thing gave me major headaches when I begun working on my mod
The <texturepaths> are smart enough to start searching for the textures from inside the Textures folder. So you needn't name the Textures folder in the path separately

I literally wrestled with this for entire day and a half
I only figured it out while quadruple checking texture paths in other mods
while I was about to post a cry for help in here
It's not very intuitive in my opinion =P But I'm just a scrub with mis-aligned toughtpatterns

Jessi

A curious little creature...

Haplo

I just tested it.
When you have the correct texture path you DO find it under Decorations.
I didn't need to make any changes except the texture path.

so if your texture is like this:
/Textures/Things/Buildings/CompanionCube.png
your path needs to be like this:
<texturePath>Things/Buildings/CompanionCube</texturePath>

Take a look if your path REALLY is correct. Most people use this path in there mod: (see the difference?)
/Textures/Things/Building/CompanionCube.png

Shinzy

#13
Quote from: Jessi on August 03, 2014, 10:31:41 AM
Still nothing. ._.

Have you accidentally hit enter before the
<?xml version="1.0" encoding="utf-8" ?>
or just left an empty gap above it?

because everything else in your works flawlessly if you got the texture path right
for some reason it doesn't recognise the file at all if there's emptiness on the first row

I really hope that's it, so you can get ahead in your mod =P

Edit: Just saying cause that happened to me just now when I tried to copy all that in an empty file

Jessi

Did all that, still nothing showing in game. :o ??

Although now I'm getting something in the editor code box thingy.

'XML Error: <version>2.0.1</version> doesn't correspond to any field in type ModMetaData'
A curious little creature...