How do NRaas mods override things without being core mods?

Talk nerdy to us here.
Post Reply
User avatar
AgnesProudbottom
Reactions:
Posts: 7
Joined: January 24th, 2016, 6:00 pm

How do NRaas mods override things without being core mods?

Post by AgnesProudbottom » January 25th, 2016, 1:22 pm

​Hi, I am new to hacking TS3 but not new to programming. I am fascinated by the NRaas mods and want to further tweak them to get the game to do my bidding (mwahaha).

I have all the NRaas code from GitHub, have decompiled the core in both IL and reconstituted C# (thanks to ILSpy), understand the basics of SimPe and modding — but apparently my knowledge is very basic indeed.

I was hoping somebody could answer some basic questions. I have had my head immersed in the NRaas code for weeks now, trying to run down calls and figure out what is pointing where and doing what, and for the life of me it still eludes me how exactly this works. My questions:

How is Woohooer (for example) not a core mod? It seems to override the basic script of the game with regard to romantic relationships, and I don’t understand how it can do that without actually modding the core. For example, the RelationshipEx class contains a whole new CalculateAttractionScore function which the game apparently uses instead of the one in the core’s Sims3.Gameplay.Socializing. Similarly, how does it re-enable certain interactions for teens, or romantic interactions between close relations, without modding the core? (For that matter, I don’t understand how StoryProgression can do what it does — provide a completely new engine for StoryProgression — without modding the core.)

I think if I understood this basic fact, I could be well on my way to doing some cool things.

User avatar
Chain_Reaction
Site Admin
Reactions:
Posts: 7620
Joined: December 30th, 2011, 6:00 pm
Answers: 82
Contact:

Post by Chain_Reaction » January 26th, 2016, 7:53 am

The basic concept is these mods exploit the games MONO interpreter to get their foot in the door (by using a tuning value to get the mod's main class constructor called - then by it not caring about private fields being referenced publically). From there one exploits the basic structure of the game. You have to be really crafty when modding this way and look for ways into the scripting, be it replacing interactions, replacing alarms, listening for events, using stack traces or just knowing code execution order. You asked how the game runs the CalculateAttractionScore function rather than the one in the core. It does this by using events to run it before EA's and updating the score making EA think it's function has already ran (see AttractionHelper). Some interactions between teens are re-enabled almost simply by editing the ITUN resources that have already been parsed into the core. Most though, including romantic interactions between close relations, operate by replacing their social callbacks (See CommonSocials).

StoryProgression is rather easy. It just calls the shutdown function on EA's and then runs entirely independent.

P.S. Nice username

User avatar
AgnesProudbottom
Reactions:
Posts: 7
Joined: January 24th, 2016, 6:00 pm

Post by AgnesProudbottom » January 27th, 2016, 1:33 pm

Thanks! This is a huge help! I think I am starting to get it. I am sure I will be back with a lot more questions, but let me digest this first and see what I can do with it!

Post Reply