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
}
}
}
}