Hi there! You are currently browsing as a guest. Why not create an account? Then you get less ads, can thank creators, post feedback, keep a list of your favourites, and more!
Test Subject
Original Poster
#1 Old 5th Dec 2021 at 1:48 PM Last edited by mingos : 5th Dec 2021 at 9:07 PM.
Default Menstrual Cycle Initialization
I'm currently writing a mod based off of KW's reproductive cycle system. I started first with menstrual cycle but I have been having trouble initializing the mod within the game. In fact, the loading screen hangs when I uncomment out the new class initialization.

I've tried writing it with alarms, and now went back to way KW does with set hourlys for each phase. At this point, I'm not sure what else to do.

My Questions:

What else could I be doing to make the mod work?

Is there something that I'm missing about class initialization in C# and in mods?

Also, it's currently being written as a script mod.
Advertisement
Virtual gardener
staff: administrator
#2 Old 5th Dec 2021 at 4:15 PM
Heya Mingos!

For all questions it would be nice to have the source code in some way (a package file or a dll file would be enough ) as i'm not too sure how much you've changed from when we discussed the mod on discord
Test Subject
Original Poster
#3 Old 5th Dec 2021 at 9:09 PM
Package in question.
Attached files:
File Type: zip  mod_men.zip (6.3 KB, 31 downloads)
Scholar
#4 Old 10th Dec 2021 at 10:14 AM
@mingos Hmm what happens if instead of On World Load you placed this code in an interaction?

Code:
try
		{
			Sim[] objects = Sims3.Gameplay.Queries.GetObjects<Sim>();
			for (int i = 0; i < objects.Length; i = checked(i + 1))
			{
				if (!simsWithGenderManager.ContainsKey(objects[i].SimDescription.SimDescriptionId))
				{
					if (objects[i].IsFemale && objects[i].IsHuman)
					{
						simsWithGenderManager.Add(objects[i].SimDescription.SimDescriptionId, new GenderFemale(objects[i].SimDescription.SimDescriptionId, objects[i].SimDescription.TeenOrAbove));
					}
					if (objects[i].IsMale && objects[i].IsHuman)
					{
						simsWithGenderManager.Add(objects[i].SimDescription.SimDescriptionId, new GenderMale(objects[i].SimDescription.SimDescriptionId, objects[i].SimDescription.TeenOrAbove));
					}
				}
			}
		}
		catch (Exception exception)
		{
			Debug.ShowException(exception);
			Debug.WriteLog(exception);
		}


I am wondering if maybe too much is going on during load time and that's why there's a crash. BTW which loading screen causes this crash/hang? The initial one or the second one when you load new game or save game?

If you like my mods. Consider supporting me on Patreon
Check out my website for updates on my mods and other work PuddingFace.wixsite.com
Check out my Youtube channel for tutorials(modding tutorials) and other content Youtube

Follow me on Twitter Instagram Pinterest Tumblr
Test Subject
Original Poster
#5 Old 13th Apr 2022 at 11:11 PM
Quote: Originally posted by PuddingFace
@mingos Hmm what happens if instead of On World Load you placed this code in an interaction?

Code:
try
		{
			Sim[] objects = Sims3.Gameplay.Queries.GetObjects<Sim>();
			for (int i = 0; i < objects.Length; i = checked(i + 1))
			{
				if (!simsWithGenderManager.ContainsKey(objects[i].SimDescription.SimDescriptionId))
				{
					if (objects[i].IsFemale && objects[i].IsHuman)
					{
						simsWithGenderManager.Add(objects[i].SimDescription.SimDescriptionId, new GenderFemale(objects[i].SimDescription.SimDescriptionId, objects[i].SimDescription.TeenOrAbove));
					}
					if (objects[i].IsMale && objects[i].IsHuman)
					{
						simsWithGenderManager.Add(objects[i].SimDescription.SimDescriptionId, new GenderMale(objects[i].SimDescription.SimDescriptionId, objects[i].SimDescription.TeenOrAbove));
					}
				}
			}
		}
		catch (Exception exception)
		{
			Debug.ShowException(exception);
			Debug.WriteLog(exception);
		}


I am wondering if maybe too much is going on during load time and that's why there's a crash. BTW which loading screen causes this crash/hang? The initial one or the second one when you load new game or save game?


Sorry for the delayed reply; I took your comment and thought more about the architecture of the mod.

Right now, I have it as onlt I can add new uterus classes to the sims via a debug interaction. With the help of alarm handlers and the SimClock, each new uterus class can keep track of it's own time and change the class state when it hits a certain sim hour.

However, right now the issue I'm facing is that the alarm handlers are going faster than the SimClock, missing the times to change over to remove the previous alarms, and failing to change each instance's state.

What I was thinking was implementing a global alarm handler to be the clock for all instances of the uterus class. However, I'm curious on what other modders have done in the past.

Thoughts?
Back to top