Various modding questions and answers

Started by ItchyFlea, February 19, 2014, 07:40:33 PM

Previous topic - Next topic

ItchyFlea

So I'm giving creating a new mod a go. For this test I'm adding carrots to the game.

When I first added them, I forgot to include a resources.xml file, but the game worked fine, showed the graphics and everything. Then I added that file, grabbed a new graphic for them, separated the carrots graphics folder into two folders, one to contain the raw graphic, and one to contain the grow graphic.
The game started saying that it was unable to load the graphic.
So after pulling out my hair, I decided to just undo everything I'd done, and go back to just having the first graphic show and redo it from there.

But the game will now not show any graphics at all for the carrots, regardless of what I do. Now it'll just show a pink square.


Apparently the game will not allow a custom graphic for the raw image of a plant. If I leave the path as this: <texturePath>Things/Item/Resource/PlantFoodRaw/Potatoes</texturePath> in the resources.xml file, there are no problems whatsoever loading the mod. If I change that line to one specifically for the food mod, the game claims that it cannot find the graphics, even if they are there.

I've created two food mods, carrots and tomatoes, they are attached below.

[attachment deleted by admin: too old]
All my mods are licensed under a Attribution-NonCommercial-ShareAlike 4.0 International
Ask for permission before using in ModPacks

Click here for a list of the mods I've created

palandus

I wish I could help you, ItchyFlea but, I'm having my own share of modding issues myself. But what I can do is help you troubleshoot:

-> When it said it couldn't load the graphic, is it perhaps because you mistyped something EX. "Carrot" instead of "carrot" (as it appears XML is case sensitive)

-> Does the Pink Square Graphic show up for any object that doesn't have a graphic? Maybe its grabbing the pink square graphic from somewhere else. (I'm unfamiliar with 2D Graphics, other than understanding that with 3D objects if they lack a texture it will show the mesh as being untextured pink / blue [depending on the game mesh])

-> Is the carrot graphic path correct (ie C:/.../.../.../carrot.png as an example, where the .../ are different file directories)

-> Is there a specific graphic format extension that must be used for the 2D textures to work; ie BMP, PNG, JPG, etc...?

-> Do you need to have separate folders for the graphics? Would one folder suffice and just have two carrot picture files (ie carrot1 and carrot2)?

Hope some of this helps!

ItchyFlea

I'm putting this down to a bug in the modding feature, as I have checked everything, and everything is 100% correct without typos. The game simply will not use anything other than the default graphics for raw food.

As for the pink graphic thing, for some reason the game decided it no longer liked the carrot graphic being 128x128. Converting it to 256x256 solved that issue. (Which is why I've striked it out.)
All my mods are licensed under a Attribution-NonCommercial-ShareAlike 4.0 International
Ask for permission before using in ModPacks

Click here for a list of the mods I've created

Tynan

What format was your graphic, and where was it?

It must be a PNG file.

And it must be in the path specified in the xml, under YourMod/Textures. So if you had  <texturePath>Things/Item/Resource/PlantFoodRaw/Potatoes</texturePath>, the graphic would have to be Mods/YourMod/Textures/Things/Item/Resource/PlantFoodRaw/Potatoes.png

The rose is done as a mod image in the Core mod, you can look at it for reference.
Tynan Sylvester - @TynanSylvester - Tynan's Blog

ItchyFlea

#4
The Rose only has an entry in Plants.xml, and the TexturePath entry in that file for my mod works perfectly fine.
The game is ignoring the TexturePath entry in Resources.xml.

The game is capable of loading the image, as I'm using the exact same image in both Plants.xml and Resources.xml and it loads the one referenced in Plants.xml

The image is located here:
C:\Games\RimWorld\RimWorld358WinDev\Mods\Tomato\Textures\Things\Item\Resource\PlantFoodRaw\Tomatoes\
It is a .png. It is an exact duplicate of the image used in this location, which the game does load:
C:\Games\RimWorld\RimWorld358WinDev\Mods\Tomato\Textures\Things\Plant\TomatoPlant

Of course, in the .xml files, I am using the relative path, which is: Things\Plant\TomatoPlant or Things\Item\Resource\PlantFoodRaw\Tomatoes

I've added the file name to texturepath in resources.xml and the game still states that it cannot find the file. I've even tried the full path with the filename, same result.

EDIT:

Gah. Managed to fix it by changing the line in Resources.xml from this:
<texturePath>Things/Plant/TomatoPlant</texturePath>
To this:
<textureFolderPath>Things/Plant/TomatoPlant</textureFolderPath>

<texturePath> is the tag used by everything that is currently contained in Resources.xml, which is why I used that instead of <textureFolderPath>, which is the tag used by Plants.xml
All my mods are licensed under a Attribution-NonCommercial-ShareAlike 4.0 International
Ask for permission before using in ModPacks

Click here for a list of the mods I've created

Tynan

Yeah, TexturePath takes a path to and including the texture. TextureFolderPath takes a path to a folder; the game will choose textures randomly from in that folder for individual things in game. I could have added more rose textures to that folder for variation but I never got around to it.

Another example you can look at is the test mod's royal bed.

Tynan Sylvester - @TynanSylvester - Tynan's Blog

ItchyFlea

Tynan, is it possible to create a new recipe that does not rely on food as ingredients?
I'm trying to make a Table Saw that can convert Raw Wood into Processed Wood Planks, and my attempts to modify the recipes contained in \Defs\RecipeDefs\Meals.xml results in the game throwing NullRef Exceptions.

Any idea what I'm doing wrong?

I've attached the mod in it's current form to this post.

What it currently adds to the game:
� Trees that generate with new worlds.
� Wooden Tables and Chairs.
� Table Saw (For turning raw wood into planks, currently doesn't work.)
� Two new resources: Raw Wood and Wood Planks.

And here's a screenshot of it in use in-game: http://i.imgur.com/NgWOlnY.png
The textures are a mixture of modified graphics from RimWorld, as well as from Google Image Search.

[attachment deleted by admin: too old]
All my mods are licensed under a Attribution-NonCommercial-ShareAlike 4.0 International
Ask for permission before using in ModPacks

Click here for a list of the mods I've created

Tynan

#7
Yes.

Ingredients are a bit tricky because they define an entire class of things a recipe can accept. Like "All meat" or "All corpses except human corpses". This is accomplished using thingfilters which filter based on a combination of categories (the same ones used for storage zone settings) and individual thing defs.

For your purpose, you need to create a filter that accepts wood planks only for your ingredients. This will be tricky though because as of today you can only configure filters as "accept category" with "except these thingdefs". Tomorrow I'll release a build with "accept this def" as a thing you can do with the filters. Right now you'd have to accept the wood's category and except every other def besides the wood.

Exciting to see an actual mod appearing!

Update: You can now configure filters to accept individual thing defs, with the <thingDefs> list.
Tynan Sylvester - @TynanSylvester - Tynan's Blog

ItchyFlea

#8
And now it's working as intended!
There is, however, a huge problem. I must replace either the Cooking Stove or the Butchery Table for it to work.
Specifically, I must have either this: <DefName>TableButcher</DefName> or this: <defName>CookStove</defName> for the Table Saw in \Defs\ThingDefs\Buildings_Furniture.xml, otherwise the colonists completely ignore it and will not do work on it.

Am I missing something? I cannot fathom why the colonists only interact with it when it has either of those two DefNames. I would have expected them to work with it regardless of <DefName> because of the <EType> tag and the <ThingClass> tag.

This is the ThingDef for the Table Saw.
<ThingDef ParentName="BuildingBase">
<DefName>TableButcher</DefName>
<EType>Building_WorkTable</EType>
<Label>Bench Saw</Label>
<ThingClass>Building_WorkTable</ThingClass>
<Description>A bench saw for processing raw wood into usable wood.</Description>
<TexturePath>Things/Buildings/WoodBench/SawBench</TexturePath>
<CostList>
<ResourceCost>
<thingDef>Metal</thingDef>
<count>60</count>
</ResourceCost>
</CostList>
<AltitudeLayer>Waist</AltitudeLayer>
<WorkToBuild>300</WorkToBuild>
<UseStandardHealth>True</UseStandardHealth>
<maxHealth>180</maxHealth>
<Size>(3,1)</Size>
<Overdraw>False</Overdraw>
<DesignationCategory>Furniture</DesignationCategory>
<Passability>Impassable</Passability>
<hasInteractionSquare>True</hasInteractionSquare>
<interactionSquareOffset>(0,0,1)</interactionSquareOffset>
<itemSurface>True</itemSurface>
<recipes>
<li>ProcessWood</li>
</recipes>
<inspectorTabs>
<li>UI.ITab_Bills</li>
</inspectorTabs>
</ThingDef>

NOTE: I haven't bothered setting the recipe to be set correctly, so when you create the Process Wood bill, you'll need to give everything an X and give a Green Tick to 'ProcWood'

[attachment deleted by admin: too old]
All my mods are licensed under a Attribution-NonCommercial-ShareAlike 4.0 International
Ask for permission before using in ModPacks

Click here for a list of the mods I've created

palandus

Maybe because those two other benches are skill related. You may need to create a skill to allow characters to utilize the saw bench.

It may also be a priority issue type thing, where they won't interact with it because it literally isn't on their list of priorities. They probably use it if its a renamed other bench because the skill cooking is listed on their priorities, and may see the bench as useful to be used because they THINK its a cooking bench and as they are a cook, they will try to "cook" at that bench, which isn't cooking, but I digress.

ItchyFlea

#10
I see what you mean. I'll look into it.
EDIT: Did what I could to switch it over to using the Crafting skill, no change. They still refuse to interact with it unless it has either of those two names. I suspect a bug, especially since the turrets worked as intended even with different <defName> tags.

In the mean time, after seeing your post about editing the turrets over in the "Confirmed" Features in Alpha 2 thread, I figured I'd give it a quick go. The attached mod is roughly 5 minutes of my time, including testing/laughing.

It adds two extra turrets. A laser turret and a grenade turret.

[attachment deleted by admin: too old]
All my mods are licensed under a Attribution-NonCommercial-ShareAlike 4.0 International
Ask for permission before using in ModPacks

Click here for a list of the mods I've created

Tynan

Ah yes, the table saw issue would be because in your version the work types aren't data-driven. There's no work type that searches for a table saw to work at.

I'll look at making the worktypes data-driven.
Tynan Sylvester - @TynanSylvester - Tynan's Blog

Tynan

By the way, you can call the xml files anything. As long as they're in the right folder.
Tynan Sylvester - @TynanSylvester - Tynan's Blog

palandus

So you can call a Laser Turret xml file something like x3photoniceyeblaster.xml (or something even more outlandish?) instead of turret.xml as long as its in the same folder?

... How'd you create the laser effect, ItchyFlea? If theres any kind of mod I'd be interested in working on its one related to Turrets, Guns, Armor, Offenses or Defenses (as I'm a hardcore RTS fan)?

@Tynan... Is there a way to create "charge-up" sounds prior to firing a weapon? For most futuristic super weapons in games they tend to have a charge up sound before firing... so, like with the BFG9000 in Doom, it has a brief charge up period before firing (about 1.25 seconds I think) where it plays a "charge-up" sound effect before firing. Anything like that available or planned at being available?

Tynan

Quote from: palandus on February 20, 2014, 10:34:59 AM
So you can call a Laser Turret xml file something like x3photoniceyeblaster.xml (or something even more outlandish?) instead of turret.xml as long as its in the same folder?

... How'd you create the laser effect, ItchyFlea? If theres any kind of mod I'd be interested in working on its one related to Turrets, Guns, Armor, Offenses or Defenses (as I'm a hardcore RTS fan)?

@Tynan... Is there a way to create "charge-up" sounds prior to firing a weapon? For most futuristic super weapons in games they tend to have a charge up sound before firing... so, like with the BFG9000 in Doom, it has a brief charge up period before firing (about 1.25 seconds I think) where it plays a "charge-up" sound effect before firing. Anything like that available or planned at being available?

Sorry, no charge up thing. And yes, you can call the xml files anything at all. The game just scans them all, per-folder.
Tynan Sylvester - @TynanSylvester - Tynan's Blog