Home | Download | Discussion | Help | Site Map | New Posts | Sign in
Replies: 38 (Who?), Viewed: 5710 times.
Page 1 of 2
Lab Assistant
Original Poster
#1 Old 8th Nov 2014 at 2:05 PM Last edited by Cinderellimouse : 12th Nov 2014 at 8:22 PM.
Default Help needed: adding custom ingredients/plants - Solved! Thank you douglasveiga and Arsil!
Hello!

I've been poking around with the ingredient, plants, and recipe XMLs and have become a little bit stuck.

So far I have been able to add 'new' ingredients by referencing existing ingredients and giving them a new name and STBL entry. So the 'pomelo' is a 'colossal olive' because it looks like it could be a big olive. XD

However, I would like to be able to do more then this. I can edit the THUM image of an existing ingredient to change the colour, so I changed the colour of the red apple to green. But I have been unable to add cloned ingredients.

When I look at the ingredients XML, the lines that seem to tell the game which resources to use are:

<Model_Name>mushroomMycena</Model_Name>
<Thumbnail_Model_Name>mushroomMycena#thumbnail</Thumbnail_Model_Name>

I thought that entering the name of the THUM, MLOD/MODL or OBJK/OBJD resource here would work, but it doesn't. I don't really understand what these lines are referencing exactly? Could anyone point me in the right direction?

I have already poked around at douglasveiga's Strawberry Plant. The lines there are:

<Model_Name>strawberry#plantSurface</Model_Name>
<Thumbnail_Model_Name>strawberry#plantSurface</Thumbnail_Model_Name>

There are no THUM files in the package that I can see, so is that referencing a part of the MODL/MLOD that I can't see? I am not particularly familiar with Blender but have been following the tutorials to learn how to use it. I imported the strawberry S3m2b files into Blender but still couldn't figure out what these lines are referencing. Finally, I checked the FNV32 and FNV64 hash of 'strawberry#plantSurface' [0x0D7D0CA5/0x4FB32B9A145A4FC5] to see if I could spot the codes anywhere, but couldn't.

I apologise if I sound incredibly stupid, or I'm missing something obvious, but I've been trying to figure this out for ages and I'd hugely appreciate it if someone with a bit more knowledge could help me out? [<---please, pity the fool]
Advertisement
Inventor
#2 Old 8th Nov 2014 at 6:35 PM Last edited by douglasveiga : 13th Nov 2014 at 12:07 AM.
The game renders the thumbnail of the ingredients/recipes "on demand", that is why you didn't find them anywhere.
The "<Thumbnail_Model_Name>" tag defines what and how to render the thumbnail.

for example, If you would like to create a green apple, you can set the texture material parameter:
(it's just an example, I don't recall the exactly model/geostate names)
<Thumbnail_Model_Name>apple#plantSurface:greenapple</Thumbnail_Model_Name>

apple-> model name
plantSurface -> geostate name
greenapple -> texture material name (overrides the original model material texture)

If you would like to create a fully function ingredient that looks realistic, you need to model different geostates.
plantHarvest -> the apple will look like hanging on the tree.
plantSurface -> the apple will look like placed on the floor.
without geostate -> the apple will look exactly like the model.


edit1: The game uses a different hash function to generate the resourcekey for ingredient/recipe model.
edit2: You will find a small program to generate resourcekeys a couple posts below.
edit3: The material name is a parameter, defined inside the model file, that defines which texture must override the current model texture.
For example, almost all recipes in the game have the "burnt" material, that actually makes the recipe looks burnt.
Lab Assistant
Original Poster
#3 Old 8th Nov 2014 at 8:05 PM
Thank you so much for the reply, douglasveiga, I was hoping you would see this!

This makes a lot more sense to me now, thank you for explaining it. I have a much better idea of what I should be doing now.
Lab Assistant
Original Poster
#4 Old 11th Nov 2014 at 12:30 PM
I'm still stuck.

When I clone an object to use as a base for my own ingredient, how do I change the model name? I assumed I would just change the 'name' of the MODL in S3PE by double-clicking on it and entering a new name, but this changes the instance and breaks the object. I've poked at every file in every way I can possibly think of, in Blender, TSR Workshop, S3pe, Texture Tweaker, S3oc... but it remains a mystery.

I appreciate any help. I feel like I'm asking really stupid questions. *blushes*
Inventor
#5 Old 11th Nov 2014 at 2:39 PM
I'm absolutely not sure of what I'm talking about, so better wait for someone who does ^^

You mean the instance name of the object?
You can set it by editing the OBJD resource with "Grid", but you also need to create a
NGMP resource to map the name (its fnv64 hash) to the instance of the OBJD.

It took me hours to figure out that the lack of a NGMP was the issue when I was
trying to add an object to the grocery store shopping list, so if this info can help
you I will be very glad.
Lab Assistant
Original Poster
#6 Old 11th Nov 2014 at 2:50 PM
Thank you for replying Arsil!

I have tried changing the instance name of the OBJD using the grid, but I haven't heard of the NGMP before? I can see in S3PE it's a file that I can add: type 'NGMP 0xF3A38370'. What should I do with it? So... set the group to 0x00000000... *tinkers around a bit*

OH! I think it might have worked! The names have all changed! I'll go and test this out and report back.

(Just to add: I took a look at the corkboard for you earlier but couldn't see anything wrong)
Inventor
#7 Old 11th Nov 2014 at 2:58 PM
Oh my, I hope I haven't write something very stupid...
Well, if that is the case someone will correct me so I'll learn too.

I too want to thank douglasveiga for his explanation. I mean,
I'm still a blockhead and I didn't understand all he wrote, but that helped.
Lab Assistant
Original Poster
#8 Old 11th Nov 2014 at 6:18 PM
I still haven't got it working, but at least I'm learning new things!

I'm going to keep playing around with it.
Inventor
#9 Old 11th Nov 2014 at 8:14 PM Last edited by Arsil : 11th Nov 2014 at 8:29 PM.
I need distraction from my own modding failures, so why don't you explain what's wrong?
I doubt I can help you, but who knows ^^

EDIT: I've read your message again... you just want to change the name of a resource in your
package without changing its instance? If that's right you just have to tick "Use resource name"
and "Rename if present" then change the name and press "OK", without pressing on FNV64 first
(or you can edit directly the _KEY resource).
But keep in mind that that is only a name internal to the package, it has no meaning for the game.
Lab Assistant
Original Poster
#10 Old 11th Nov 2014 at 9:37 PM
I really appreciate that you are helping me!

Basically, the bit that I'm stuck on is getting the ingredients XML to acknowledge the new resource. It's this line:

<Model_Name></Model_Name>

I can add the name of an existing game object here and it will show up as an ingredient in the game. For example, I randomly entered 'accessorySponge' in that line and had my sim eating and planting sponges (to my great amusement). So I know that whatever I add there will become the object used for that ingredient entry.

The problem comes when I clone an object with the intention of creating a custom ingredient. I'm not trying to make anything specific yet, I'm just trying to learn how to do it. So, for example, I have cloned the blackberry (from the store). While cloning in S3OC I'll give the object a new name, 'hazelnut'. I can edit the 'hazelnut' and get it to show up in the buy catalogue, so I know the actual object is visible. However, when I open the package in S3PE all the names and ids still seem to say it's a blackberry.

I need to know what exactly the '<Model_Name></Model_Name>' is referencing, and how to change that part of the cloned object package.

I've changed absolutely everything I can see: the names of all the 'parts' of the object that show up in the list in S3pe. I've used the grid on different resources to change what I think are the mesh names. I've played around with adding a NGMP and directed resource ids towards one another. I've used S3OC to replace instances within the package. As far as I can tell, I've changed the name of pretty much everything to the 'model_name' entry! The object is still in the buy catalogue (apparently unbroken), my sim is still buying and eating an invisible object.

Although I'm frustrated with it, at least I'm learning new things. I didn't know what a NGMP was before, or that I could replace the instances with S3oc, or what douglasveiga said about the game generating a thumbnail automatically.

About adding a new texture (as mentioned in douglasveiga's post), I don't know if I'm doing this incorrectly too. I basically tried cloning the image file in both S3PE and Texture Tweaker, and giving it a new name 'greenapple'. But when I add reference the apple in the ingredients list as suggested (<Thumbnail_Model_Name>apple#plantSurface:greenapple</Thumbnail_Model_Name>) it still shows as a red apple.

*sigh*

I really do appreciate the advice, Arsil, and I wish I knew more so I could help you with your threads.
Inventor
#11 Old 12th Nov 2014 at 12:36 AM Last edited by douglasveiga : 12th Nov 2014 at 1:02 AM.
Each ingredient in the game is associated to the default "Ingredient" (objd and objk). That is why, for example, you won't find the apple resources (objd and objk) anywhere.

Since every single ingredient in the game uses the exactly same "Ingredient" (objd and objk) resource, the game reads the "<Model_Name></Model_Name>" tag from the "ingredient.xml" to discovery which model must be assigned to each object (ingredient) loaded in the game. That means, the game will instantiate the default "Ingredient" and automatically apply the model to the object (ingredient) to make it look like the correct ingredient.

So, to make a new ingredient, you don't need to worry about the objd, objk or ngmp, just create a new model and include the information inside the ingredients.xml.
It's important to make your CC Ingredient inherits from the default ingredient, because this will ensure your ingredient will behave like an ingredient, and not like an average buy/build mode object.

edit: sorry, @Cinderellimouse. now, I remembered that the "greenapple" "texture" override didn't work because it's the material name and not the "texture name", like I said before. The "material name" must be defined in the model, but I am too familiar with such kind of thing.
Inventor
#12 Old 12th Nov 2014 at 12:59 AM Last edited by douglasveiga : 29th Jan 2015 at 1:21 PM.
(Sorry about the double post)

A small program to generate instance key for ingredient/recipe models. For Windows Operational System.

Instructions:
1- Open the program.
2- Write your unique modelname.
3- Press "Enter".
4- Copy the hashed instance key.
Download - please read all instructions before downloading any files!
File Type: zip ModelInstanceKeyHash.zip (33.5 KB, 109 downloads) - View custom content
Lab Assistant
Original Poster
#13 Old 12th Nov 2014 at 12:00 PM
So there is one objk/objd set which acts like a master ingredient, and all the other ingredient models use those resources? Ok.

I'm having trouble running the program, it opens in notepad.
Inventor
#14 Old 12th Nov 2014 at 6:25 PM
That's C source-code, it has to be compiled first.
Inventor
#15 Old 12th Nov 2014 at 7:27 PM
Quote:
Originally Posted by Cinderellimouse
So there is one objk/objd set which acts like a master ingredient, and all the other ingredient models use those resources? Ok.

I'm having trouble running the program, it opens in notepad.


The game instantiates the "master ingredient" and automatically assign the specific model (defined inside the ingredients.xml) to the ingredient.


PS: I updated the file and included the compiled code.
Lab Assistant
Original Poster
#16 Old 12th Nov 2014 at 8:20 PM
It worked!

I am absolutely over the moon right now! I've spent months trying to work out how to add custom ingredients and was too shy/embarrassed to ask for help. I'm so happy I did now because I would never have been able to get the right resource key without your program, douglasveiga! Thank you so so so very much for your help. I know that you spent time helping me here and I want you to know how much I appreciate this.

And thank you too Arsil! It means a lot that you replied and your suggestions taught me things I didn't previously know. I was so nervous that everyone would ignore me!

The only problem I have now is that I want make ingredients all night, but have to do coursework. XD
Inventor
#17 Old 13th Nov 2014 at 12:33 AM
You're welcome.
Test Subject
#18 Old 23rd Nov 2014 at 5:03 AM
Thank you so much. Now i can get the ingredient to show its image. Thank you.
It's weird that I don't install EP, so technically the game don't have ghostChili MODL name, but I can not use that name I must generate another name. Is there any way to override it?

One more little important thing. I don't know why the image is smaller than its original. I don't change anything just the model name

also all my store fruits have the same ugly issue.
Inventor
#19 Old 23rd Nov 2014 at 8:59 AM
Just speculating: maybe one thumbnail is generated automatically by the game using
the mesh+texture as "model" while the other is an actual thumbnail (a THUM resource).
Inventor
#20 Old 23rd Nov 2014 at 1:48 PM Last edited by douglasveiga : 23rd Nov 2014 at 10:33 PM.
Quote:
Originally Posted by tenmang
Thank you so much. Now i can get the ingredient to show its image. Thank you.
It's weird that I don't install EP, so technically the game don't have ghostChili MODL name, but I can not use that name I must generate another name. Is there any way to override it?

One more little important thing. I don't know why the image is smaller than its original. I don't change anything just the model name

also all my store fruits have the same ugly issue.



Quote:
Originally Posted by tenmang
It's weird that I don't install EP, so technically the game don't have ghostChili MODL name, but I can not use that name I must generate another name. Is there any way to override it?

You need to check the "DataVersion" and "CodeVersion" tag in the ingredients.xml.

If you would like to generate new modelname, you must define "basegame".
If you would like to keep the original modelname (from an EP), you must define the correct EP flag.

Quote:
Originally Posted by tenmang
One more little important thing. I don't know why the image is smaller than its original. I don't change anything just the model name


The different image is because of the current "geostate", probably the left one is the "plantSurface" and the right one is the "full", "hole" or whatever they named it.
Test Subject
#21 Old 24th Nov 2014 at 5:20 AM
Sorry it seem not like that. This is what i do:
1/ Right image: with EP7 installed. its xml
<DataVersion>EP7</DataVersion>
<Model_Name>ghostChili#Whole</Model_Name>
<Thumbnail_Model_Name>ghostChili#Whole</Thumbnail_Model_Name>
2/ Left image: no EP7 installed
<!-- disabled <DataVersion>EP7</DataVersion> -->
<Model_Name>newghostChili#Whole</Model_Name>
<Thumbnail_Model_Name>newghostChili#Whole</Thumbnail_Model_Name>
in resource file, use you tool change MODL instance to newghostChilli hash. I just change model name, dont touch geometry
=> worked but it image is so ugly small. I see that store fruit like Orange, Lemon, Bohemian fruit also have this issue (Corn get big image :D)

By the way
Quote:
If you would like to keep the original modelname (from an EP), you must define the correct EP tag in the productversion tag.
I tried
DataVersion/CodeVersion/Even ProductVersion and keep GroupID/change GroupID to basegame => dont work.
But forgot it. this is not a big thing like annoy small image :D
Inventor
#22 Old 24th Nov 2014 at 11:15 AM Last edited by douglasveiga : 27th Nov 2014 at 12:59 AM.
Quote:
Originally Posted by tenmang
Sorry it seem not like that. This is what i do:
1/ Right image: with EP7 installed. its xml
<DataVersion>EP7</DataVersion>
<Model_Name>ghostChili#Whole</Model_Name>
<Thumbnail_Model_Name>ghostChili#Whole</Thumbnail_Model_Name>
2/ Left image: no EP7 installed
<!-- disabled <DataVersion>EP7</DataVersion> -->
<Model_Name>newghostChili#Whole</Model_Name>
<Thumbnail_Model_Name>newghostChili#Whole</Thumbnail_Model_Name>
in resource file, use you tool change MODL instance to newghostChilli hash. I just change model name, dont touch geometry
=> worked but it image is so ugly small. I see that store fruit like Orange, Lemon, Bohemian fruit also have this issue (Corn get big image :D)


did you copy all the associated files and fixed their references to the mdl file?
there is a file that defines the camera position and scale during the rendering process of the thumb, but I don't recall the file type. probably you need to change the groupid and resourcekey of this file.
Inventor
#23 Old 24th Nov 2014 at 11:45 AM
Hi douglasveiga,
Since you are, as far as I know, the only one who made a custom food/recipe
can you please confirm if the steps mentioned in this thread are correct?
The missing pieces can be found in what you already posted here?
Inventor
#24 Old 24th Nov 2014 at 4:00 PM Last edited by douglasveiga : 24th Nov 2014 at 9:53 PM.
Quote:
Originally Posted by Arsil
Hi douglasveiga,
Since you are, as far as I know, the only one who made a custom food/recipe
can you please confirm if the steps mentioned in this thread are correct?
The missing pieces can be found in what you already posted here?


yes, apparently it's correct. probably, the author of the tutorial didn't know that the model's resourcekey uses a different hash function instead of the FNV hash.

you can follow the tutorial, but you need to use my program to generate a new resource key for each model.

edit: if you would like to edit the object inside TSR workshop or make you food "buyable only", you need the objd, objk and ngmp files too. If you would like to make a "cookable only " food, you can delete these files from your package because the game just requires the models with the appropriate resourcekey.
Inventor
#25 Old 24th Nov 2014 at 5:35 PM
Thank you, I appreciate your help. Someday I'll try again to do my "white rice",
I was so close: I could buy it from registers and order it in "restaurants" but
couldn't get to make/cook it from the fridge/oven.
Page 1 of 2
Back to top