Hi there! You are currently browsing as a guest. Why not create an account? Then you get less ads, can thank creators, post feedback, keep a list of your favourites, and more!
Quick Reply
Search this Thread
Field Researcher
Original Poster
#1 Old 22nd Sep 2014 at 3:00 PM Last edited by Zerbu : 22nd Sep 2014 at 10:02 PM.
Default Social Event Modding - It's Possible!
I've been playing around with Social Event modding, and was actually shocked at how easy it is. Creating a new social event is as simple as copying the XML file with a new instance and making changes. Using that method, I created the Destination Party social event, which is a clone of House Party for community lots:



After successfully creating that event, I looked further in to see what else is moddable, and I wasn't disappointed. It gets more complicated from there, but still well within reach of the tools we have.

Using Sims4XmlExtractor and checking "Create subfolders for instance types" allows you to extract and categorize the XML files. These are the categories that control events:
  • situation - The events themselves are in this folder. To get started with creating a new event, just clone one of the files in this folder (for example House Party) and chance the instance name. The new event will immediately appear in the game with no extra effort. The references to the other types (goals, goal sets and jobs) are in this file.
  • situation_goal - These are the goals for the event. They are referenced by a numeric ID that can be changed in clones. All that seems to matter is that the ID is unique. This seems complicated at the moment, but changing the amount of times something is required as well as the roles it should be done by or done on can be changed.
  • situation_goal_set - It's just a list of goals that can be referenced by the main "situation" file, seems fairly simple to me. Once again, referenced by a numeric ID.
  • situation_job - These are the roles that can be assigned to events, for example "Host", "Guest", "Mixologist" etc. It is possible to create your own custom roles, and these can be utilized by custom goals. Again, they're referenced by a numeric ID.

For ID numbers, it is strongly recommended you use a number that's completely random. It is recommended you use a hash containing your creator name using Fogity's Hasher tool: http://www.den.simlogical.com/denfo....php?topic=3279

You'll also need to create an STBL file if you want custom text strings.

I personally recommend planning what goals and jobs your event will have before you begin creating it, so you won't leave yourself frustrated and confused.
Advertisement
Pettifogging Legalist!
retired moderator
#2 Old 22nd Sep 2014 at 3:18 PM Last edited by plasticbox : 23rd Sep 2014 at 4:26 AM.
Cool, thanks for posting =)

I'd just like to add that there are very specific recomendations on how to construct reliably unique IDs for CC -- everyone please refer to the Best Practices as outlined in the EA docs; excerpt:

Quote: Originally posted by TS4 Custom Content Guide.pdf
ALWAYS use a hash for the instance of Custom Content or Mod records. You will notice that some records authored by Maxis use an incrementing number for the instance (for example, see resource type 0x034aeecb) - Custom Content should not do this as it will lead to collisions. See “Catalog Instances” section below for more information.


Available here. The point isn't so much that the numbers need to be "random" but they must be unique.

Stuff for TS2 · TS3 · TS4 | Please do not PM me with technical questions – we have Create forums for that.

In the kingdom of the blind, do as the Romans do.
Field Researcher
Original Poster
#3 Old 22nd Sep 2014 at 3:43 PM
The "ID" of goals, goal sets and jobs aren't the same as instances, they're just numbers, though the practice of not using incremental numbers would still apply.
Pettifogging Legalist!
retired moderator
#4 Old 22nd Sep 2014 at 3:47 PM
Yeah but woudn't there still be major confusion when everyone starts to use "really unique" IDs like 123456 .. ?

Stuff for TS2 · TS3 · TS4 | Please do not PM me with technical questions – we have Create forums for that.

In the kingdom of the blind, do as the Romans do.
Field Researcher
Original Poster
#5 Old 22nd Sep 2014 at 6:30 PM
Good point! Hashes won't work though since they include letters (from A-F) and IDs can only contain numbers. The best way to get a unique number would be to generate one that's completely random, preferably in the really high range to avoid conflicting with EA ones.
Lab Assistant
#6 Old 22nd Sep 2014 at 6:53 PM
Those are hexadecimal numbers, and they are in fact instance id's. EA uses sequential naming in these cases, but as they point out we modders should use hashes. So make sure to generate and use hashes when you are creating new instances, following EA's convention as plasticbox mentioned. s4pe has a built in hash generator (fnv hash) but you should make sure that the top bit is set. You can manually do this by looking at your hash, if the number after the x is lower then 8 add 8 to it, the letters A through F represent 10 through 15.
Pettifogging Legalist!
retired moderator
#7 Old 22nd Sep 2014 at 7:11 PM Last edited by plasticbox : 22nd Sep 2014 at 7:36 PM.
Ah thanks for the clarification, Fogity! I was about to go searching for what was probably one of your posts (about where those IDs come from -- they are represented as decimal sometimes, right now I'm not sure what the rules are for that).

Stuff for TS2 · TS3 · TS4 | Please do not PM me with technical questions – we have Create forums for that.

In the kingdom of the blind, do as the Romans do.
Lab Assistant
#8 Old 22nd Sep 2014 at 8:09 PM
So, I am not sure my description was clear or not. But I decided to make a simple little tool that calculates hashes in both decimal and hexadecimal format as well as calculates hashes with high bit set so you don't have to do it manually.
It is located here on Simlogical: http://www.den.simlogical.com/denfo....php?topic=3279
Pettifogging Legalist!
retired moderator
#9 Old 22nd Sep 2014 at 8:37 PM
Your description was clear! It's just that I am not sure under which circumstances an instance needs to be represented in decimal form -- in the EA docs it says for example (in the line-by-.line comments on XML tuning, which says in line 7: s="17242299340165163524"> ):

"Line 7: The “s” attribute is the instance ID of this tuning resource as a decimal number."

but references to icons for example have a good old fashioned hexadecimal ID. And I believe somebody (maybe not you?) posted something about that recently which I found enlightening =) but can't quite remember .. I'll go check in the XML Tool thread, maybe it was there.

Thanks for the link as well, will put it in Tools sticky =).

Stuff for TS2 · TS3 · TS4 | Please do not PM me with technical questions – we have Create forums for that.

In the kingdom of the blind, do as the Romans do.
Lab Assistant
#10 Old 22nd Sep 2014 at 8:44 PM
The "s" attribute refers to the instance id of the xml tuning, it is the same as the instance id of the resource only in decimal form. Hence the choice in the tool. But decimal is really only needed for fnv 64.
Field Researcher
Original Poster
#11 Old 22nd Sep 2014 at 8:46 PM
Quote: Originally posted by Fogity
The "s" attribute refers to the instance id of the xml tuning, it is the same as the instance id of the resource only in decimal form. Hence the choice in the tool. But decimal is really only needed for fnv 64.


I'm confused then... I've already tried it with random numbers that don't match the instance, and there don't seem to be any problems.
Lab Assistant
#12 Old 22nd Sep 2014 at 8:48 PM
Yeah, I think it is not too important when you do not have a DATA resource to accompany the xml. I suspect that is the main reason it is there, as well as being unique.
Field Researcher
Original Poster
#13 Old 22nd Sep 2014 at 9:13 PM
I'll still use your hasher tool though. I guess it's a good idea to have some kind of "rule" of what ID to use.
Pettifogging Legalist!
retired moderator
#14 Old 22nd Sep 2014 at 9:15 PM Last edited by plasticbox : 22nd Sep 2014 at 9:39 PM.
The uniqueness in particular would be an issue that won't be apparent right now -- there isn't a lot of custom content yet so there can hardly be any "namespace" issues. But the practice of using one's own creator tag as part of the hash (recommended by EA as well as tried and tested) pretty much guarantees that also on the long run, one can only run into conflicts with oneself. So I'd hesitate to call that "not too important" .. it won't be fun to sort out conflicts five years from now =P

Zerbu, can you update your mod then while it's still in the queue? (Also, perhaps edit your first post .. it's still talking about random.org random numbers =)

Stuff for TS2 · TS3 · TS4 | Please do not PM me with technical questions – we have Create forums for that.

In the kingdom of the blind, do as the Romans do.
Lab Assistant
#15 Old 22nd Sep 2014 at 9:25 PM
The guidelines is to use this format for the string when creating a hash: "<modder id>:<resource name>". So if I were to create lets say a trait that was called Test I would hash the string "Fogity:trait_Test". The important part is to prefix with your modder id.
Pettifogging Legalist!
retired moderator
#16 Old 22nd Sep 2014 at 9:38 PM
BTW I didn't find that "enlightening" post I was looking for -- for now I guess the best thing to do would be to look in the EA XML to see where they use which format (hex vs dec) and do it the same way. Plus what you said above, "decimal is really only needed for fnv 64".

Stuff for TS2 · TS3 · TS4 | Please do not PM me with technical questions – we have Create forums for that.

In the kingdom of the blind, do as the Romans do.
Lab Assistant
#17 Old 22nd Sep 2014 at 9:46 PM
Well there is no need to search, it is all specified in the modding documentation. In the tuning descriptions.
Pettifogging Legalist!
retired moderator
#18 Old 22nd Sep 2014 at 10:00 PM
Yes I know those -- but one thing that I didn't find there (may be an oversight) is some sort of explanation / rule for "how do i know whether to use hex or dec for this particular thing?" (I wanted to know this before when I added an ingredient to a recipe -- by looking at other recipes that have ingredients, I can see that they use the decimal version (so I also used decimal and it worked), but I don't know *why* this is decimal. Since other references are in hexadecimal. I'd just have liked to know the general rule for that =)

Anyhow, I don't wanna derail this thread! If I run into something where I really really have to know, I'll make a new one.

Stuff for TS2 · TS3 · TS4 | Please do not PM me with technical questions – we have Create forums for that.

In the kingdom of the blind, do as the Romans do.
Field Researcher
Original Poster
#19 Old 22nd Sep 2014 at 10:07 PM
Quote: Originally posted by plasticbox
The uniqueness in particular would be an issue that won't be apparent right now -- there isn't a lot of custom content yet so there can hardly be any "namespace" issues. But the practice of using one's own creator tag as part of the hash (recommended by EA as well as tried and tested) pretty much guarantees that also on the long run, one can only run into conflicts with oneself. So I'd hesitate to call that "not too important" .. it won't be fun to sort out conflicts five years from now =P

Zerbu, can you update your mod then while it's still in the queue? (Also, perhaps edit your first post .. it's still talking about random.org random numbers =)


The mod I already made doesn't go as deep as creating custom goals are jobs, so there's nothing in it to change. I'm still exploring the more advanced stages of social event modding, but it's something I hope to master in the future because I think those types of mods have a lot of potential to bring more fun to the game. I have updated the first post though.
Pettifogging Legalist!
retired moderator
#20 Old 22nd Sep 2014 at 10:11 PM
Oh, duh. Yes, you are referring to the EA stuff, says so. My fault for not reading!

(Also edited my first post with the EA guide link since it was paraphrasing your now-edited part)

Stuff for TS2 · TS3 · TS4 | Please do not PM me with technical questions – we have Create forums for that.

In the kingdom of the blind, do as the Romans do.
Field Researcher
Original Poster
#21 Old 22nd Sep 2014 at 11:37 PM
It's okay

More on social event modding: managing all the files is proving to be very daunting, so I'm working on a tool that will automatically do some of the tasks. It will allow searching through the XML files by text and quickly cloning them, as well as keeping a list of text strings to find and replace. That should come in really handy given how frustratingly annoying it is to have to update every single reference one by one.
Back to top