Help me with my very frst mod

Started by Reize81, January 08, 2019, 02:36:38 PM

Previous topic - Next topic

Reize81

Hi there  :D

(english is my second language, please don't be offended by anything).

First things first: Sorry, I meant to post this in the help section but failed  :-[

I got some time on my hands and decided to start modding rimworld. I watched some tutorials and achieved the correct folder structure (about, defs, textures) and my first try for a new mod is a new texture for walls in rimworld. I wanted to add a chiseled or embossed wall that has less hit points, needs more resources and time to build but has some beauty by itself.
As a first test i just tried to make a new wall with custom graphics.

I managed to get my mod into the game and to see my wall under the structures tab in the game (see attached screenshot). But when I try to build it i get the following error:



Exception printing ChiseledWall38432 at (99, 0, 132): System.NullReferenceException: Object reference not set to an instance of an object
  at Verse.Graphic_Appearances.get_MatSingle () [0x00000] in <filename unknown>:0
  at Verse.Graphic_Linked.get_MatSingle () [0x00000] in <filename unknown>:0
  at Verse.Graphic.get_Shader () [0x00000] in <filename unknown>:0
  at Verse.GraphicData.GraphicColoredFor (Verse.Thing t) [0x00000] in <filename unknown>:0
  at Verse.Thing.get_DefaultGraphic () [0x00000] in <filename unknown>:0
  at Verse.Thing.get_Graphic () [0x00000] in <filename unknown>:0
  at Verse.Thing.Print (Verse.SectionLayer layer) [0x00000] in <filename unknown>:0
  at Verse.ThingWithComps.Print (Verse.SectionLayer layer) [0x00000] in <filename unknown>:0
  at Verse.SectionLayer_ThingsGeneral.TakePrintFrom (Verse.Thing t) [0x00000] in <filename unknown>:0
Verse.Log:Error(String, Boolean)
Verse.SectionLayer_ThingsGeneral:TakePrintFrom(Thing)
Verse.SectionLayer_Things:Regenerate()
Verse.Section:RegenerateLayers(MapMeshFlag)
Verse.MapDrawer:TryUpdateSection(Section)
Verse.MapDrawer:MapMeshDrawerUpdate_First()
Verse.Map:MapUpdate()
Verse.Game:UpdatePlay()
Verse.Root_Play:Update()


I thought that it would be enough to have to edit Wall_Atlas_Bricks.png (which i named chiseled.png) and then store it in a folder to which my .xml references under  <texPath>Things/Building/Linked/Chiseled</texPath>

This seems to be not enough. What am I doing wrong ? I attached a screenshot and .xml file  - any help ?


[attachment deleted due to age]

Reize81

#1
maybe this helps someone so I will post some progress I made...

... I figured out that I apparently don't get to choose the name of my wall atlas (I read the defs of other mods, this is just guesswork). So I guess my Wall Atlas will have to be named Wall_Atlas_Bricks.png and Wall_Atlas_Planks.png and Wall_Atlas_Smooth.png

I will test this.

...and apparently i had my texture not linked correctly. Now everything works. I attached the working .xml file

Please note that I even managed to give the wall a beauty. I added <beauty>1</Beauty> under <statBases>

so for now all problems solved.


[attachment deleted due to age]

Razuhl

Keep in mind that a new wall cannot be created, the vanilla game identifies only the original definition as a wall. You created a building that looks like a wall but won't support things like vents etc.. A proper new wall is created by adding a new stuff option to the default wall.

Canute

I can't help you with the modding.
But i can tell you look at the mod Fertile Field, they give you
Brick walls with unique textures, made out of stone bricks made out of clay.
And these brickwall's get recognize as valid target for door's and vent's.

Reize81

#4
thx for the replies, Razuhl and Canute  :D

I seem to have copied enough of the original wall to make vents and coolers work. I just tested. Next step is to actually create custom graphics for a chiseled wall and to figure out how this wall atlas is supposed to work :)

Can I set a color to not to be drawn ? As far as I understanf rimworld just copies and pastes a 64x64 image from the Wall_Atlas to the game and then it adds color with a overlay mask. I would like to give my wall some structure - a chiseled pillar for example. This would mean that one can see a tiny bit of the floor underneath the wall because where the chisel was applied to chisel the pillar out of the wall wall-material would be missing. And for the missing part I would have to have a color that rimworld does not copy. Does anyone know ?

Update: I just figured out that .png files support transparency. Who thought it would be so easy ?