Custom Painting Loader - aka Helping creators to add custom content to the game, a different approach (theory + working example)
Hello.
Since @veiledstar uploaded her mod that adds custom paintings for the painting skill
and expressed her desire to add more paintings in the future (I hope I'm not making that
up, maybe it was a commenter who said that), I've been thinking about proposing douglasveiga
to add that feature to his wonderful CCLoader but then 2 things came to mind:
- sure, it's called CCLoader, so it's generic, but at the moment it's all about gardening+food
and maybe its scope shouldn't become too much broad
- I'm a curious cat and I have recently worked (without success) on dreamTrees
So I thought about a different approach to reach the same goal: make a mod that helps
other creators to add custom stuff to the game.
Now, this is in no way an attempt to step into douglasveiga's shoes (or NRaas for the
custom careers), I just want to show a different approach to do the same thing.
I don't know if it's better or worse, and I don't care.
I also want to say that this
is experimental, I only tested it a little but it seems to work.
The idea is this: using a custom resource type, unused by the game, to define our custom
xml data and then have a mod that parses all resources of that type (this is how it works with dream-trees).
Example
Let's use the TypeId 0x15970001 for our custom resource (a plain text file, like any xml resource).
The mod will parse all resources of that type and load into the game the data defined there.
So, for instance, instead of overriding PaintingSkillDB (with all problems that overriding
has, like having more mods that add paintings - or sketches - and sharing them without
conflicts), we can add our custom painting xml data to a custom resource of that type
and the mod will take care of parsing it and adding the paintings to the game.
How to enhance this idea?
- Use different custom resource types (0x15970002, etc) for different things (tv channels, etc, etc)
- Improve the parser so it's able to parse - from the same file/resource - different kind of
things, maybe using headers or parent tags or whatever they are called to separate them
_S3PE_
Edit this file
<MainDir>/Helpers/Notepad.helper
with a notepad and add the resourceType 0x15970001 to the list in the first row,
this way you can right click on the custom resource type and select notepad to edit it
(so you can avoid the extra step needed to define an external text editor to modify it).
It would be nice to associate a descriptive tag to that resource type (e.g. PSDB as in
Painting Skill DataBase) and enable the preview on _S3PE_, but I don't know how to
do that and I don't want to bother Inge Jones with a PM or a mention (even if she has
always been very kind and nice every time I asked something).
How other creators can use this mod to add their custom paintings
- Open my example package with _S3PE_
- right click on Arsil_CustomPaintingResource and select "Export as package"
- save the new package into the Mods/Packages folder (or, better yet, in a sub-folder that you use for testing stuff)
- open the new created package with _S3PE_
- double click on the custom resource, tick "Rename if present" and change its name
- put a unique name, use your nickname plus a meaningful description (e.g. Arsil_ElvenPaintings_FirstSet)
- then click on the FNV64 button and click the OK button
- Now you can edit the file to define the xml data needed for new paintings (I won't explain that, but it's pretty simple,
just a quick reminder: the name you put here for the paintings must be the FNV64 hashing key that generated the
InstanceId of the related _IMG resource and of course you should use that same name for the textual/humanReadable
name of that resource, to avoid confusion and understand at the first glance which is which)
- import the .dds images to the same package and you are done (use unique names also for the images to avoid potential conflicts with existing or future mods)
- save the package, test in game
Note: since there are a lot of paintings in the game, it may be difficult to get/spot the custom ones,
here's what I do: I override the PaintingSkillDB resource and remove every painting so only the custom
ones will be picked up when a sim-painter creates a new painting. Remember to remove that overriding resource after testing!
-----
There are 3 files in the attachments:
- the source code of the mod (only interesting for other script modders)
- the mod itself (needed to parse the resources of the custom type)
- an example package that
adds a custom painting and that can be used as reference as I've explained above
(there's no need to keep this package inside the Mods/Packages folder
, unless you like my painting)
EDIT: actually I've removed the image because I couldn't be bothered searching one without copyright,
but I've tested it and it works.