Few questions related mod making

Talk nerdy to us here.
Post Reply
PiotrKFtw
Reactions:
Posts: 7
Joined: July 22nd, 2020, 4:19 pm

Few questions related mod making

Post by PiotrKFtw » July 22nd, 2020, 4:30 pm

Hello devs! Recently i entered modding in Sims 3. Not so long ago found out that the game is in C#.. So i wanted to make a test mod that doesn't alter the game code, i have a few questions..
Since Sims 3 are using custom version of clr/.net i found out that they don't check access modifiers and exception is not thrown when you try access them directly so that bringed me the question, could i just set all private/protected/internal members to public and build the mod like this or is there some way to make visual studio skip the access modifier compilation check? Second regarding game code mod i made, debugging gave me some trouble, with the help of ErrorTrap i logged the following exception, https://prnt.sc/tmtg2x . Could you give me a hint or something to where i can re-assign the StateMachineClient so the error doesn't happen again?
Pre-Last question, what can i do to make debugging easier?
Last question, is there something else i should know? What i want to doIn the final, i want to make a mod to mess with Grim Reaper, edit the code of the game enough to make him "work inside a household", as of current progress i managed to add him to household without him leaving/losing deep voice/losing smoke, save file is not broken but there is still alot more work to do than just that..

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

Few questions related mod making

Post by Chain_Reaction » July 23rd, 2020, 8:26 pm

PiotrKFtw wrote:
July 22nd, 2020, 4:30 pm
could i just set all private/protected/internal members to public and build the mod like this or is there some way to make visual studio skip the access modifier compilation check?
Just build against the modified core DLL's found in my github, they're already set to public.
PiotrKFtw wrote:
July 22nd, 2020, 4:30 pm
Could you give me a hint or something to where i can re-assign the StateMachineClient so the error doesn't happen again?
What exactly were you trying to do there? It looks like grim was processing a soul for the grave, right? Are you trying to use the grim you have in house to do that?
PiotrKFtw wrote:
July 22nd, 2020, 4:30 pm
what can i do to make debugging easier?
Debugging is kinda a nightmare for this game, it's never really going to be easy. Just use notifications heavily and write script error files too if you need to log. If the status of a variable is important to what you're doing, just get it in your face somehow. Even if you don't think you'll need to know how the flow is going at that point in the code, you will be banging your head when you have to shut the game down, add in logging to a variable and wait for it to load yet again.
PiotrKFtw wrote:
July 22nd, 2020, 4:30 pm
i want to make a mod to mess with Grim Reaper, edit the code of the game enough to make him "work inside a household", as of current progress i managed to add him to household without him leaving/losing deep voice/losing smoke, save file is not broken but there is still alot more work to do than just that..
What does just adding him to the household with MC do? I've never tried.

PiotrKFtw
Reactions:
Posts: 7
Joined: July 22nd, 2020, 4:19 pm

Few questions related mod making

Post by PiotrKFtw » July 24th, 2020, 12:51 am

Chain_Reaction wrote:
July 23rd, 2020, 8:26 pm
What exactly were you trying to do there? It looks like grim was processing a soul for the grave, right? Are you trying to use the grim you have in house to do that?
Yeah. After little troubleshooting it turned out to be caused by master controller, mc deleted the drive and i had to reassign to get it to work. Also i had to modify the master controller in order to not EndService when adding Grim Reaper to house hold. After 2 days of working and debugging, here's the current result (progress): https://youtu.be/aKR3FgDez08
Chain_Reaction wrote:
July 23rd, 2020, 8:26 pm
What does just adding him to the household with MC do? I've never tried.
Without modifying mc, adding him to house hold does EndService on him making him lose his function/abilities and cause a new grim reaper to get spawned (which is not what i want to achieve)
Chain_Reaction wrote:
July 23rd, 2020, 8:26 pm
Debugging is kinda a nightmare for this game, it's never really going to be easy. Just use notifications heavily and write script error files too if you need to log. If the status of a variable is important to what you're doing, just get it in your face somehow. Even if you don't think you'll need to know how the flow is going at that point in the code, you will be banging your head when you have to shut the game down, add in logging to a variable and wait for it to load yet again.
Thats what i was afraid of having to do.. Well since you say that i guess there is no other way.. I used the ErrorTrap file logging but as i said, without adding additional code it was just giving cleanup error (which pointed me to wrong direction at first) instead of the driver message.
Chain_Reaction wrote:
July 23rd, 2020, 8:26 pm
Just build against the modified core DLL's found in my github, they're already set to public.
Thanks it will really help me out.

PiotrKFtw
Reactions:
Posts: 7
Joined: July 22nd, 2020, 4:19 pm

Few questions related mod making

Post by PiotrKFtw » July 27th, 2020, 9:47 pm

Is there a way to save something into the game save file? I was looking for some way to save single info but i found that appearantly saving happens in native form..

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

Few questions related mod making

Post by Chain_Reaction » July 28th, 2020, 5:28 am

Sure, these mods save hundreds of options to the save file. The game should automatically save non-static members of any class that has the [Persistable] attribute and has a public constructor with the same name as the class. You can save static members by giving them the [PersistableStatic] attribute. And you can choose not to save a non-static member by giving it the [Persistable(false)] attribute.

PiotrKFtw
Reactions:
Posts: 7
Joined: July 22nd, 2020, 4:19 pm

Few questions related mod making

Post by PiotrKFtw » August 6th, 2020, 12:23 pm

Chain_Reaction post_id=75744 time=1595928483 user_id=2 wrote: Sure, these mods save hundreds of options to the save file. The game should automatically save non-static members of any class that has the [Persistable] attribute and has a public constructor with the same name as the class. You can save static members by giving them the [PersistableStatic] attribute. And you can choose not to save a non-static member by giving it the [Persistable(false)] attribute.
Thanks for help again. Now for (hopefully) the last things and everything should be good to go, where are (which field) Service sims for specific service stored (master controller -> intermediate -> select service uses it to get the count), i would probably find it by myself but i currently have other more important things to do than computer. Is the gameplay.package the same or it differs from 1.69 version?
(Off-Topic) Where can i share the mod?

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

Few questions related mod making

Post by Chain_Reaction » August 6th, 2020, 10:13 pm

PiotrKFtw wrote:
August 6th, 2020, 12:23 pm
where are (which field) Service sims for specific service stored
If I understand the question, you want to know where is the data stored for which Sims belong to a service? It's the mPool field under the base service class.
PiotrKFtw wrote:
August 6th, 2020, 12:23 pm
Is the gameplay.package the same or it differs from 1.69 version?
It's the same, yes.
PiotrKFtw wrote:
August 6th, 2020, 12:23 pm
Where can i share the mod?
You're welcome to make a thread here in chatterbox if you'd like.

PiotrKFtw
Reactions:
Posts: 7
Joined: July 22nd, 2020, 4:19 pm

Few questions related mod making

Post by PiotrKFtw » August 7th, 2020, 10:33 am

Chain_Reaction wrote:
August 6th, 2020, 10:13 pm
If I understand the question, you want to know where is the data stored for which Sims belong to a service? It's the mPool field under the base service class.
Oh so it's this field, i thought it only belongs to a current instance, i was wrong then. Thanks for help again.
Chain_Reaction wrote:
August 6th, 2020, 10:13 pm
It's the same, yes.
Good to know because i thought that my mod is only compatible with steam version because thats where i got sims 3
Chain_Reaction wrote:
August 6th, 2020, 10:13 pm
You're welcome to make a thread here in chatterbox if you'd like.
0
Ok, thanks.

Post Reply