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!
Scholar
Original Poster
#1 Old 27th Jan 2022 at 3:41 AM
Default Changing a Sim's Gender outside CAS
Anyone know how to do that? Can we do it by spawning in like a clone sim with opposite gender? In that case how to spawn a newly made sim? I've been having some trouble with that.

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
Advertisement
Space Pony
#2 Old 27th Jan 2022 at 5:17 PM
Hello PuddingFace,

if you want to clone a sim you can use the following code:
Code:
                        SimDescription simDescription = new SimDescription(SimToClone.SimDescription);
			simDescription.CopyGhostInfo(SimToClone.SimDescription);
			if (SimToClone.OccultManager != null && SimToClone.OccultManager.HasAnyOccultType())
			{
				SimInfo.SimOccultInfo simOccultInfo = SimToClone.OccultManager.GetSimOccultInfo();
				if (simOccultInfo != null)
				{
					OccultTypes occultType = simOccultInfo.OccultType;
					if (occultType > OccultTypes.None)
					{
						simDescription.OccultManager.AddOccultType(occultType, false, false, false);
					}
				}
			}
                       SimToClone.Household.Add(simDescription);
                       simDescription.Gender = OppositeofSimToClone;  //assign the opposite gender here
                       Sim sim = simDescription.Instantiate(Vector3.OutOfWorld, simDescription.DefaultOutfitKey, true, false);
                       sim.GreetSimOnLot(SimToClone.LotCurrent);
		       sim.SetPosition(SimToClone.Position); //Better Find a good place nearby

Scholar
Original Poster
#3 Old 28th Jan 2022 at 2:28 AM
@Battery Thank you! I had managed to clone but now I will try to change the gender.

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
Scholar
Original Poster
#4 Old 28th Jan 2022 at 9:32 AM
I had to use

Code:
SimDescription simDescription = Genetics.MakeDescendant(null, Actor.SimDescription, Actor.SimDescription.Age, Actor.IsMale ? CASAgeGenderFlags.Female : CASAgeGenderFlags.Male, 0f, new Random(), false, false, false);


instead of changing the gender later and I did it! A gender swapped clone was spawned.

@Battery Do you know how to destroy a sim. Like just remove him from the game. I want to replace the original sim with this clone.

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
Forum Resident
#5 Old 30th Jan 2022 at 9:58 PM
This bit is I believe from the code that makes a sim sculpture (It actually clones the sim, makes the clone pose, generates the sculpture and then destroys the clone)

Code:
Household.NpcHousehold.RemoveTemporary(simDescription);  // dunno if necessary to remove from household
            sim.Destroy();
            Simulator.Sleep(0u); // dunno if necessary
            simDescription.Dispose();


I have no idea if this works for you. You might run into problems if your clone has a different ID than the original.

Here's a thought: Perhaps you could try modifying the gender flag of the sim (and age flag to an earlier age), then trigger a birthday spin/age transition. Should be quick to test with MasterControllers Trigger Age Transition.

Find my Mods: Here at MTS, over at Simlogical
Back to top