Mod with Me: Let’s create an interaction!

Chippedsim
5 min readJan 25, 2023

--

Someone send me a message a while ago asking if I could add an interaction for ghosts to ask them how they died. Since ghosts already get an unique trait based on their death this isn’t too complicated to set up. So I though it would be the perfect opportunity to share a bit of my modding workflow.

Disclaimer: This isn’t a tutorial and will require you to know at least some of the basics of creating tuning mods. This is meant for those who want to learn a bit more about how I code and maybe discover some little tricks I use here and there.

Preview of the interaction in game!

Find an interaction as base

As a first step I’m going to use a similar interaction to base my interaction of. I could also write my tuning from scratch but this will save me some time. I used mixer_Social_Sim_Ghost_Ask_About_Being_Dead as base and extracted it to a new package file with Sims 4 Studio.

Rehashing the File

Before changing anything about the tuning I’m going to rehash the file to make sure it’s not overriding the interaction I cloned it from. I changed it to ChippedSim_GhastlyGhosts:Interaction_mixer_Social_Sim_Ghost_Ask_About_Death. Using the : will lead to Sims 4 Studio automatically hashing your file.

Changing the interaction name

I want to change the interaction name to my own custom name so I look for:

<T n="display_name">0xEACA8FF2<!--Talk about Death--></T>

I want to change that to “Ask how (Name of the Ghost) died”. I need to create a custom string for that and add that to my string table. I’m using Frank’s String Table Studio for this. This is a web tool which makes it less tedious to create custom string strings. I just need to add a new entry to my string table with the text and it will auto hash the string. At the end I can download my finished string table and merge that into my package.

This is how my edited code looks like:

<T n="display_name">0x29B03721<!--Ask how {1.SimFirstName} Died--></T>

{1.SimFirstName} will turn into the name of the target Sim in game. This is because in the display_name_text_tokens section the second entry is set to “Object”. It starts counting at zero so if you used {0.SimFirstName} it would show the name of your Actor/ active Sim instead. You can edit this section to add more text tokens or edit them — just make sure the strings match the order of the text tokens listed in the tuning.

Adding a pie menu icon

I want all the interactions that are unique to ghosts to display a little ghost icon next to the interaction name. I looked the code up in the TDESC browser and searched the icon by exporting a icon list from S4S (you can do that by opening the cheat console in S4S and type in list.icons). Then I just looked for the ghost icon and copied it’s ID.

This is the code I added to my interaction to display the ghost icon:

<V n="pie_menu_icon" t="enabled">
<V n="enabled" t="resource_key">
<U n="resource_key">
<T n="key">2f7d0004:00000000:14094b494cd3f93d</T>
</U>
</V>
</V>

Basic Content of the interaction

Since I don’t want to create a success + failure outcome for my interaction I decided to move the animation to basic content section. I used Soc_Friendly_NT_askQuestionFriendly_success_basic as an animation for the actor and added a reaction let Soc_Generic_AnswerQuestion_nuetral_basic that will play on the ghost so they react to the question they’ve been asked. I want the balloons over their heads to display how the Sim died so I kept the balloon for the Actor but decided to create a new balloon category tuning for the ghost so they will display a different icon based on their death trait.

Setting up the Balloon Category Tuning

I’m just going to show a part of the tuning since there are a lot of death types in the game but I just copy pasted the tuples in the balloons list and changed the image key and trait I tested against for each individual death type.

<I c="BalloonCategory" i="balloon" m="balloon.balloon_category" n="ChippedSim_GhastlyGhosts:BalloonCategory_Speech_DeathType" s="14123163975524853823">
<T n="balloon_chance">100</T>
<E n="balloon_type">SPEECH</E>
<L n="balloons">
<U>
<V n="item" t="balloon_icon">
<U n="balloon_icon">
<V n="icon" t="resource_key">
<U n="resource_key">
<T n="key">2f7d0004:00000000:749facb71646f4ca</T>
</U>
</V>
</U>
</V>
<L n="tests">
<L>
<V t="trait">
<U n="trait">
<E n="subject">TargetSim</E>
<L n="whitelist_traits">
<T>101679<!--trait_ghost_Anger--></T>
</L>
</U>
</V>
</L>
</L>
</U>
<U>
<V n="item" t="balloon_icon">
<U n="balloon_icon">
<V n="icon" t="resource_key">
<U n="resource_key">
<T n="key">2f7d0004:00000000:264ed166d0e9aa8e</T>
</U>
</V>
</U>
</V>
<L n="tests">
<L>
<V t="trait">
<U n="trait">
<E n="subject">TargetSim</E>
<L n="whitelist_traits">
<T>267992<!--trait_Ghost_AnimalObjects_Killerchicken--></T>
</L>
</U>
</V>
</L>
</L>
</U>
</L>
</I>

Setting up the Loot Action

For the loot action I did something similar and created an unique notification for each death trait (just included 2 of the traits in this example so you can get the idea). Set up a loot tuning and then reference that in the outcome of the interaction.

<?xml version="1.0" encoding="utf-8"?>
<I c="LootActions" i="action" m="interactions.utils.loot" n="ChippedSim_GhastlyGhosts:Loot_Notification_Speech_DeathType" s="14478579884990279592">
<L n="loot_actions">
<V t="notification_and_dialog">
<U n="notification_and_dialog">
<V n="dialog" t="notification">
<U n="notification">
<V n="icon" t="enabled">
<V n="enabled" t="participant">
<U n="participant">
<L n="participant_type">
<E>TargetSim</E>
</L>
</U>
</V>
</V>
<V n="text" t="single">
<T n="single">0xEDDF4705<!--You know when you get so mad you feel like you could just explode? Here's a secret: You can.--></T>
</V>
<E n="visual_type">SPEECH</E>
</U>
</V>
<L n="tests">
<L>
<V t="trait">
<U n="trait">
<E n="subject">TargetSim</E>
<L n="whitelist_traits">
<T>101679<!--trait_ghost_Anger--></T>
</L>
</U>
</V>
</L>
</L>
</U>
</V>
<V t="notification_and_dialog">
<U n="notification_and_dialog">
<V n="dialog" t="notification">
<U n="notification">
<V n="icon" t="enabled">
<V n="enabled" t="participant">
<U n="participant">
<L n="participant_type">
<E>TargetSim</E>
</L>
</U>
</V>
</V>
<V n="text" t="single">
<T n="single">0x023E0976<!--I picked a fight with...Charles? I think his name was Char- he was a chicken, who cares what his name was! Anyway, I called him chicken, and he proved me wrong.--></T>
</V>
<E n="visual_type">SPEECH</E>
</U>
</V>
<L n="tests">
<L>
<V t="trait">
<U n="trait">
<E n="subject">TargetSim</E>
<L n="whitelist_traits">
<T>267992<!--trait_Ghost_AnimalObjects_KillerChicken--></T>
</L>
</U>
</V>
</L>
</L>
</U>
</V>
</L>
<T n="run_test_first">True</T>
</I>

Interaction Outcome

For the outcome of the interaction I want it to trigger the loot which will show my notification and make the Actor react horrified by what the ghost just told them. I added my custom loot to the loot_list that already existed and then used the TDESC again to add a response for the actor.

<V n="outcome" t="single">
<U n="single">
<U n="actions">
<L n="loot_list">
<T>11036<!--Rel_Gain_Small--></T>
<T>24123<!--Loot_SocialContext_Friendship_Gain--></T>
<T>36121<!--Skill_Loot_Dynamic_Small_ChildrenOnly_Social--></T>
<T>10954<!--Loot_ForSocialsSocialMotiveMedium--></T>
<T>14478579884990279592<!--ChippedSim_GhastlyGhosts:Loot_Notification_Speech_DeathType--></T>
</L>
<V n="response" t="enabled">
<V n="enabled" t="individual">
<U n="individual">
<L n="animations">
<U>
<U n="animation">
<T n="factory">28379<!--Socials_Responses_Miscellaneous_Horrified--></T>
</U>
<E n="target">Actor</E>
</U>
</L>
</U>
</V>
</V>
</U>
</U>
</V>

Adding the interaction to the Sims

Adding new interactions to Sims normally requires some scripting or the XML injector. Since I already have a script that adds a custom trait to all ghosts in game I can use something called provided_mixers in the trait tuning. This allows me to add new mixer interaction to the chat SuperInteraction that will be available on all Sims with my custom ghost trait.

<L n="provided_mixers">
<U>
<T n="key">13998<!--sim_Chat--></T>
<L n="value">
<T>10323265223929627753<!--ChippedSim_GhastlyGhosts:Interaction_mixer_Social_Sim_Ghost_Ask_About_Death.--></T>
</L>
</U>
</L>

--

--