- Site Map >
- Modding and Creation >
- Sims 3 Creation >
- Modding Discussion >
- Changing a Sim's Gender outside CAS
- Site Map >
- Modding and Creation >
- Sims 3 Creation >
- Modding Discussion >
- Changing a Sim's Gender outside CAS
Replies: 4 (Who?), Viewed: 606 times.
#1
27th Jan 2022 at 3:41 AM
Posts: 1,500
Thanks: 4283 in 41 Posts
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.
Advertisement
Space Pony
#2
27th Jan 2022 at 5:17 PM
Posts: 433
Thanks: 792 in 6 Posts
Hello PuddingFace,
if you want to clone a sim you can use the following code:
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
#3
28th Jan 2022 at 2:28 AM
Posts: 1,500
Thanks: 4283 in 41 Posts
@Battery Thank you! I had managed to clone but now I will try to change the gender.
#4
28th Jan 2022 at 9:32 AM
Posts: 1,500
Thanks: 4283 in 41 Posts
I had to use
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.
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.
#5
30th Jan 2022 at 9:58 PM
Posts: 768
Thanks: 8158 in 12 Posts
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)
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.
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.
Who Posted
|