Script modding: Modifying a specific social interaction

Talk nerdy to us here.
Post Reply
User avatar
Echoweaver
Reactions:
Posts: 391
Joined: January 11th, 2012, 6:00 pm

Script modding: Modifying a specific social interaction

Post by Echoweaver » October 31st, 2020, 11:18 am

This doesn't directly apply to NRaas, but there's a decent chance it will when I get my skills up. This seemed like one of the best places to find folks who are skilled in script modding and still involved in the community.

After, what, 12 years playing this game, I decided to dip into script modding. I started with something that I thought would be simple and then, of course, hit something that I can't find in a tutorial.

I made some kelp recipes (https://modthesims.info/showthread.php?t=648901). I would like to modify the "Discuss Kelp Recipes" social interaction with mermaids to include a chance to learn one of these recipes. I think to do that, I need an event listener for this interaction.

The closest EventType I found was kSocialInteraction, which covers a lot of ground. I assume there's a way to drill down to which SPECIFIC social interaction has occurred.

It's also possible, of course, that I have completely misinterpreted the tutorials I'm working with, and I'm barking up the wrong tree :).

This is the framework I've built so far. Can someone point me in the right direction?

Code: Select all

namespace Echoweaver.Sims3Game.DiscussKelpRecipes
{
public class DiscussKelp
{
[Tunable]
protected static bool kInstantiator = false;

private static readonly Random rollDice = new Random();
private static readonly object syncLock = new object();

static DiscussKelp()
{
World.sOnWorldLoadFinishedEventHandler += new EventHandler(OnWorldLoadFinishedHandler);
}

public static void OnWorldLoadFinishedHandler(object sender, System.EventArgs e)
{
EventTracker.AddListener(EventTypeId.kSocialInteraction, new ProcessEventDelegate(OnSocialInteraction));
}

public static ListenerAction OnSocialInteraction(Event e)
{
if (-- How do I determine which social interaction?? --) {
LearnKelpRecipe(...);
}
return ListenerAction.Keep;
}

public static bool LearnKelpRecipe(...)
{
if(actor.SkillManager.HasElement(SkillNames.Cooking))
{
int dieRoll = 0;
lock(syncLock)
{
// 1 in 6 chance you might learn a recipe
dieRoll = rollDice.Next(1, 6);
}

if (dieRoll == 6) // 6 is the winning number
{
// Check Cooking Skill level and which kelp recipes actor already knows
}
}

}
}
A study in blockheaded stubbornness: Playing the same legacy since 2009.
Sample a Brave Legacy: http://sims3sample.illation.net http://echoweaver.tumblr.com

User avatar
Echoweaver
Reactions:
Posts: 391
Joined: January 11th, 2012, 6:00 pm

Script modding: Modifying a specific social interaction

Post by Echoweaver » October 31st, 2020, 3:30 pm

I got an answer to this over at MTS. :)
A study in blockheaded stubbornness: Playing the same legacy since 2009.
Sample a Brave Legacy: http://sims3sample.illation.net http://echoweaver.tumblr.com

Post Reply