IllustratorsLeak
JaneSimsten
JaneSimsten

patreon


Tutorial: Basics of Traits, Buffs, and Loots

Sul-sul! Today, I wanted to share a little bit of something different: a tutorial explaining the basics of traits, buffs, and loots. I know a lot of people have been using Mod Constructor, but I've always found it helpful to make my mods from scratch, and I thought others might want to learn to do it the same way. A lot of the tutorials I used when learning are outdated, or I figured things out by trial and error, so maybe this could help someone make their own mods. 😊

Getting Started

For this tutorial, and just about any modding you want to do, you will need to download Sims 4 Studio. You'll also need a browser window open to access Frankk's STBL Studio, and I reference Lot51's TDESC Browser, both incredible modding resources.

Step 1: Making a Trait

Start by creating an empty package in your mods folder.

Then, open a new Extract Tuning window.

Most mods are cloned from existing in game items. For this mod, we will be creating an "Eloquent" trait that allows Sims to gain Charisma skill faster and inspire those around them. To start, let's clone the Romantic trait. Search for trait_romantic and click "Add to Package".

You'll see that there have been not one but two files added to the package: a trait file and a SimData file. Many files in the game have a paired SimData which needs to have the same information as the associated tuning file.

Next, we need to clone these files to make our own unique trait. When you clone a file, it will need its own name and instance number.  First, open a Hash Generator window.

The Hash Generator will help us create a new instance number. In the "Text" field, enter what you want the name of your new file will be. The developers have suggested that modders add a prefix to their files to avoid any conflicts with game files, followed by a colon. For this, my prefix is "JS_EloquentTrait:" and I will be naming the file "trait_eloquent".

Traits use a 32-bit hash, but most other file types use a 64-bit hash. Copy the number generated in the "FNV32" field, then return to the Warehouse. First, select your "Trait Tuning" file, then press "Duplicate". There will be a pop-up, and in the "Instance" field, paste your new hash number. Repeat this process for the SimData file.

Now, return to your Hash Generator window. Copy your instance again, this time into the Convert Number box where it says "Hash Number". Now, copy the number generated in the "Decimal" field. This is the decimal equivalent of your hash number.

Back in the Warehouse, navigate again to your trait tuning. Paste the decimal number where it says s="0000000", and paste your trait name into where it says n="somenamehere".

The SimData does not need the decimal version, but you will need to paste your name here so they match.

Remember this process, because you'll be doing it a lot. Sometimes, I feel like half of modding is cloning game files. Generate a hash, duplicate with the new instance number, get the decimal number, and then replace the name and number.

Step 2: Editing the Trait

Anything you clone will have a bunch of information you don't need. For our purposes, we will be making a very simple trait that only does two things. First, I want to delete the entire xml tree labeled "buff_replacements". This tuning basically overrides buffs that other Sims might get with ones that make sense for your trait, but we don't need it.

We also want to delete the conflicting_traits tree. This has an associated SimData. Anything in SimData can't be deleted outright. Instead, you want to delete everything up until the root of the tree, but close it with />. If you don't, the file won't save.

Next, I want to delete the "cas_asm_param" field in tuning, but change it to "None" in the SimData.

I also deleted the WhimSet because I almost never use them.

Then, I want to change the skill tags. Right now, the trait will appear in the Emotional Group, but I want it to be a Social trait. If you look at where it says "tags", you'll see that TraitGroup_Emotional is listed. This is one place where the TDESC Browser becomes really helpful. If I search for traits, and tags, and click on the <E> tag option, it will show a list of possible tags.

The gray number beneath is the id number associated with the tag. This is important because these tags are included in the SimData as well. From a quick search, I found TraitGroup_Social with a tag of 756. Make sure to change these in both the tuning and the SimData.

Next, we'll want to change the trait name and description. For this, we will need a string table. You can make these manually, but I much prefer to use Frankk's STBL Toolkit, which you can open in your browser. Start a new project and give it a unique name. Then, add a new string that is the name of your trait. You'll see that a hash number (0xa 32 bit hash) has already been generated. On the right, you can copy the XML that has the comment of what the string says in it.

(Note: comments in XML are anything between the <!-- some comment here -->. They do not actually affect the code and are only to make it easier for you to read.)

After you've copied, paste it into the Trait Tuning file where it says "display_name", and "display_name_gender_neutral", then do the same for the SimData. Repeat this process with your "trait_description" as well, with whatever you'd like your trait's description to say.

We're close to done! Finally, I'll want to add an icon for my trait. I copied an in game trait and attached it to this tutorial, but anything of the same size 128x128 pixels will work. Generate a 64-bit hash for your image, then click "Add" in the Warehouse, and select DST Image as the type. Paste your hash in, and in the Warehouse, import your picture.

Finally, copy that number into the Trait Tuning and the SimData where it says "icon" by replacing the long number (the others are group and type).

And that's just about it! We have a trait, and it will show up with a unique icon, name, and description. But it doesn't really do anything.

Step 3: Make a Buff for the Trait

First, what is a buff? Well, you've probably heard the word used to refer to the visible moodlets that you see on your Sims, saying something like "Inspired" and having a description about something your Sim did, but buffs are not always visible, and they can do a lot more than change your Sim's mood. Almost everything a trait does is through its core buff.

Open up your Extract Tuning window, search for buff_trait_romantic, and add it to your package. Clone this and the associated SimData with a new 64 bit hash and name (I named mine JS_EloquentTrait:buff_trait_eloquent). Take your decimal version of the instance number and copy it back in your Trait Tuning where it references buffs.

Like before, we'll want to get rid of a lot of things the buff does that we don't need. Navigate back to your Buff Tuning, and delete the entire tree that references actor_mixers and interactions. The actor_mixers adds unique interactions for Sims who have this buff, and interactions is used mostly for idle interactions that distribute a buff, like when your Genius Sims randomly get focused. But we don't need that for our trait, because interactions are outside the scope of this tutorial.

First, we want to make our Sims able to learn Charisma Skill twice as fast. This can be done under game_effect_modifiers. You can see all the options that are available using the TDESC Browser. For our purposes, we will want to add a skill tag modifier. The key is a reference to a tag, and the value is what we want to multiply the original skill gain rate by.

So in this case, if I delete the original autonomy modifier and replace it with a skill tag modifier that has a value of two, our Sims will gain Charisma twice as fast. You could also do a fraction, so 0.5 would mean Sims gain Charisma half as fast.

Next, I want to add something that will make other Sims react to how well Eloquent Sims speak. For this, we will want to add an affordance modifier. (An affordance is another word for an interaction.) This will allow us to modify all existing interactions that have meet specific requirements to do something extra I want them to. You can see in the TDESC that you could choose to modify specific affordances, or a list of affordances, but for my purposes I'd like it to affect all Friendly interactions, so I used "interaction_category_tags" instead.

I want these interactions to have a chance of adding a buff to the TargetSim (or the person the Eloquent Sim is interacting with), and this can be done with a loot, which we will make next. The success chance is a percentage, so in the picture above the loot has a 100% chance of firing. I always make it 100% until I test that it works in game, and then change after the fact.

Step 4: Make a Loot

Let's navigate back to the Extract Tuning window, and search for loot_buff_tea. This is a game loot that potentially adds a buff to the Sim. Duplicate and rename it as always, then add the decimal number to the

First I want to delete the parts we don't need, which are the second buff and the tests.

You'll be left with something that looks like this. Create a new string table entry that gives a reason for the buff, and copy it in. You'll want to add a line that specifies the subject as TargetSim, because the default is Actor (the actor is the Sim with the trait). Now we'll need to make a new buff and copy the decimal number where it says "buff_type". If you search for buff_tea_upgraded in the Extract Tuning window, you can find a visible buff to clone.

Step 5: Make a Visible Buff

Now that we have a visible buff, we will want to change the buff_name and buff_description in the Buff Tuning and the SimData by creating new strings. You could change the mood by changing where it says mood_type in both the Tuning and the SimData. If you need the decimal number, you can always search again in Extract Tuning, but for our purposes, I'll keep it as Inspired. (Eloquent people are inspiring, right?)

The max_duration under "temporary_commodity_info" controls how many Sim minutes the buff will last, and the category tells you what kind of buff it is. (Other in game loots might affect all Inspired_Buffs, for instance). I'll also want to create a new DST Image for the buff icon as we did before, and then copy the 64-bit hash into the Buff Tuning and SimData.

Step 6: Importing the Strings

Navigate back to your STBL Toolkit and download the package. Now you could keep the strings package file separate, but for a mod this small it makes sense to only have one package. Open up the package containing the strings, select all of them, hit "Batch Export", and save them to somewhere you'll be able to find them easily.

Then open up the package containing your trait, hit "Batch Import", navigate to where your string files are located, select all of them, and hit "Open". You should now have all of the string files in your package.

Step 7: Recapping

And that's pretty much it! To review, we made a trait which contains a core buff. That buff has information that allows Sims with our trait to gain a skill faster and points to a loot that only affects certain interactions. The loot adds a visible buff which other Sims will sometimes get when interacting with our Sim.

Trait --> Invisible Buff --> Loot --> Visible Buff

This was a pretty rapid tutorial, and it's hard to encompass everything that might be possible to make in a trait or a buff. Remember, you can always browse through the TDESC and experiment on your own to see what is possible! A good place to start is by chasing down in-game files and seeing how they work and what other files they point to. I hope you found this tutorial helpful, and feel free to drop questions on Discord if you need help. πŸ˜ŠπŸ’•

Cheers, ~JS

Tutorial: Basics of Traits, Buffs, and Loots Tutorial: Basics of Traits, Buffs, and Loots Tutorial: Basics of Traits, Buffs, and Loots Tutorial: Basics of Traits, Buffs, and Loots Tutorial: Basics of Traits, Buffs, and Loots Tutorial: Basics of Traits, Buffs, and Loots Tutorial: Basics of Traits, Buffs, and Loots

Comments

Commenting this so I can find it easier later when I dit down. Thank you so much for this🧑🧑🧑

VarΓΉΓ°

Thank you so much! I'm always on the lookout for tutorials and you explained it oh so clearly! :D (I also like the "from scratch" aspect of it.)

mirificentjoy

Great work! Keep it up πŸ‘ŠπŸ’―β€οΈ

IRIDYSCENZIA


More Creators