Home | Download | Discussion | Help | Site Map | New Posts | Sign in

Latest Site News

2018 MTS Calendar Contest - posted on 12th Nov 2017 at 8:48 PM
Replies: 7 (Who?), Viewed: 1787 times.
Inventor
Original Poster
#1 Old 18th Aug 2015 at 12:57 PM Last edited by Arsil : 23rd Aug 2015 at 11:09 AM. Reason: updated description
Default 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.
Download - please read all instructions before downloading any files!
File Type: zip CustomPaintingLoaderSourceCode.cs.zip (2.0 KB, 12 downloads) - View custom content
Description: The source code of the mod, only interesting for other script modders
File Type: zip Arsil_CustomPaintingLoader.package.zip (5.8 KB, 15 downloads) - View custom content
Description: The mod itself, needed to parse the resources of custom type
File Type: zip Arsil_CustomPaintingExample.package.zip (839 Bytes, 12 downloads) - View custom content
Description: An example package to use as reference
Advertisement
Forum Resident
#2 Old 18th Aug 2015 at 3:04 PM
This is genius, what a great idea!
Forum Resident
#3 Old 18th Aug 2015 at 3:25 PM Last edited by douglasveiga : 18th Aug 2015 at 5:25 PM.
I created the PhotosetLoader yesterday. It's useful to load photo sets into the game *without the painting skill.

http://modthesims.info/showthread.php?t=562446
Inventor
Original Poster
#4 Old 18th Aug 2015 at 3:33 PM
Damn it, you scared me douglasveiga, for a moment I though I did something you already did! ^^

I've been away from the forum for some time so I didn't see that, but that uses
the same approach of the CCLoader and NRaas BootStrapCreator: it generates
a S3SA resource and one or more _XML resource, the approach used here is different.

EDIT: uhm, I guess I misunderstood your post... anyway, congrats for that mod/tool and thank you for doing it.
Forum Resident
#5 Old 18th Aug 2015 at 5:44 PM
Quote:
Originally Posted by Arsil
Damn it, you scared me douglasveiga, for a moment I though I did something you already did! ^^

I've been away from the forum for some time so I didn't see that, but that uses
the same approach of the CCLoader and NRaas BootStrapCreator: it generates
a S3SA resource and one or more _XML resource, the approach used here is different.

EDIT: uhm, I guess I misunderstood your post... anyway, congrats for that mod/tool and thank you for doing it.


Your approach is very interesting because it's flexible to load many images into the game. The only feature I would like to suggest is the option to choose the image you would like to paint, from a menu. And somehow group images into Sets.

Something like that:
http://thumbs2.modthesims2.com/img/...456-screen2.jpg
Inventor
Original Poster
#6 Old 18th Aug 2015 at 6:01 PM Last edited by Arsil : 19th Aug 2015 at 9:47 AM.
That's interesting but it would require to modify the painting system* and that is beyond the scope of the mod.

EDIT: another mod could do that (*replacing the draw interaction of the easel) without conflicting with this
but I'm not interested in doing it myself.
Forum Resident
#7 Old 18th Aug 2015 at 9:21 PM
ok. Both mods perform almost the same task. I will keep my mod with the photoframe/photoset approach, and you can keep the painting/canvas.
Lab Assistant
#8 Old 19th Aug 2015 at 7:12 PM
Thank you both! I plan on making another mod to add master artists' paintings to the game as well that can be painted on the canvas. I am a bit busy with RL at the moment, but will try to update my current mod with this method.
Back to top