Jump to content

Problems creating my script mod


Recommended Posts

Posted

Hi guys, I'm posting this as a last ditch attempt to try and preserve the remains of my sanity!

I'm trying to get into modding the Sims 3 - however I've run into probably the most baffling and frustrating problem I could've done.

 

I've been following the Pure Scripting Tutorial on modthesims and my first instance of the mod works perfectly. I create a script that pauses the game on load. However the problem arises when I change the code to literally ANYTHING other then: 

 

private static void OnWorldLoadFinished(object sender, EventArgs e)
{
    Sims3.Gameplay.Gameflow.SetGameSpeed(Gameflow.GameSpeed.Pause, Sims3.Gameplay.Gameflow.SetGameSpeedContext.GameStates);
}

Even if the only change is changing this code to 

 

private static void OnWorldLoadFinished(object sender, EventArgs e)
{
    StyledNotification.Show(new StyledNotification.Format("Mod loaded!", StyledNotification.NotificationStyle.kSimTalking));
}

and use the correct referencing "using Sims3.UI", the mod stops working. The strangest thing is when I add the notification code after the pause command, the mod also stops working. I can't even progress further into the tutorial because the mod doesn't work if I change it.

Does anyone have insight into this issue?

Posted

Do you guys wanna hear a joke? For a whole WEEK I've been stuck on this issue. I've recreated the entire projects multiple times, I've repackaged and recreated the .dll more times then I can remember. I tried every conceivable fix. I thought there was a library problem with my visual studio, sims 3 or even windows 10 installation.

 

Turns out the problem was that I was copy + pasting code between the different versions of my projects and my initial mistake was being carried over, which was...

 

I let VS autocomplete this line as World.OnWorldLoadFailedEventHandler += new EventHandler(Mod.OnWorldLoadFinished);

Instead of World.OnWorldLoadFinishedEventHandler += new EventHandler(Mod.OnWorldLoadFinished);

 

Advice to other programmers, read your code properly ?

Posted

Glad you figured it out. If you hadn't, I was going to suggest looking at NRaas 'saver' plug-in. There is an option in the settings to pause on save and pause on load, so when loading a save as one starts a game , the game IS paused.

Posted
9 hours ago, landess said:

Glad you figured it out. If you hadn't, I was going to suggest looking at NRaas 'saver' plug-in. There is an option in the settings to pause on save and pause on load, so when loading a save as one starts a game , the game IS paused.

This was more an exercise in modding, rather then for the functionality of that particular script; as I want to start creating my own mods. But thanks for the reply anyway!

Archived

This topic is now archived and is closed to further replies.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...