Replies: 10 (Who?), Viewed: 352 times.
Lab Assistant
Original Poster
#1 Old 3rd Oct 2021 at 12:38 PM
Default Create PlantSim In CAS, a problems.
Hello everyone, I ran into a problem when creating a mod, this is that the hair, the beards and eyebrows does not change its color, to the one that which PlantSim should have. here is a piece of code i changed.
Screenshots
Advertisement
Forum Resident
#2 Old 4th Oct 2021 at 9:48 PM
I don't have anything useful to add on the modding side of things, but I'm curious. How on earth did you get PlantSims to show up in CAS in the first place, as a chooseable lifestate and everything?

I would've thought something like that would've been hard-coded or at the very least very difficult to implement.

You have been chosen. They will come soon.
Instructor
#3 Old 5th Oct 2021 at 1:55 PM
I'm pretty excited to see a mod released that would let me create PlantSims in CAS. Is that what you're doing there? I also don't know what could be causing the recolor problems. When you edit a PlantSim in CAS using MasterController, those bits recolor just fine.

Echo Weaver's Simblr: http://echoweaver.tumblr.com/
A portrait in stubbornness - Playing the same legacy since 2009
Sample a Brave Legacy: http://sims3sample.illation.net
Lab Assistant
Original Poster
#4 Old 6th Oct 2021 at 12:06 PM
Quote:
Originally Posted by Jathom95
I don't have anything useful to add on the modding side of things, but I'm curious. How on earth did you get PlantSims to show up in CAS in the first place, as a chooseable lifestate and everything?

I would've thought something like that would've been hard-coded or at the very least very difficult to implement.
.
Sorry, but I'm too lazy to search for this now, you can search it in my posts because I have already provided the code here.
Quote:
Originally Posted by echoweaver
I'm pretty excited to see a mod released that would let me create PlantSims in CAS. Is that what you're doing there? I also don't know what could be causing the recolor problems. When you edit a PlantSim in CAS using MasterController, those bits recolor just fine.

The problem is that when you select PlantSim in CAS, the color of hair, eyebrows and beard remains what it was, and not green or blue or whatever, there is not this filter in the life mode, only the color of the eyes changes to yellow.
Forum Resident
#5 Old 6th Oct 2021 at 5:02 PM
Quote:
Originally Posted by whiteman-Dara
.
Sorry, but I'm too lazy to search for this now, you can search it in my posts because I have already provided the code here.

Erm... this was the first I've heard of anyone doing something like this. I'm not a modder so I was curious how it was possible. I thought lifestates weren't possible to add to the game. I didn't even realize anything prior had been posted about it.

You have been chosen. They will come soon.
Scholar
#6 Old 7th Oct 2021 at 4:07 AM
Something in the Plant Sim code. The beard should become green right? And you should have the plant sim hair style. No other occult style changes hair style or color. Werewolves do get body hair though. That could help. I think checking the plant sim code for hair and Werewolf code for body hair is the way to go.

If you like my mods. Consider supporting me on Patreon

Check out my website for updates on my mods and other work PuddingFace.Net

Check out my Youtube channel for tutorials(modding tutorials) and other content Youtube

Follow me on
Twitter
Instagram
Pinterest
Tumblr
Lab Assistant
Original Poster
#7 Old 7th Oct 2021 at 7:15 AM
Quote:
Originally Posted by PuddingFace
Something in the Plant Sim code. The beard should become green right? And you should have the plant sim hair style. No other occult style changes hair style or color. Werewolves do get body hair though. That could help. I think checking the plant sim code for hair and Werewolf code for body hair is the way to go.

Hi, PuddingFace. Not green, but the color of the hair plantSim, no, but mummies and symbots cannot be created in CAS because of the skin tone, and their hairstyle intersects with the scalp. It won't help with the werewolf body hair, the body hair is applied because of the occultwerewolf class and the color is really applied random.
Lab Assistant
DELETED POST
Original Poster
7th Oct 2021 at 4:18 PM
This message has been deleted by whiteman-Dara. Reason: Error
Virtual gardener
staff: administrator
#8 Old 11th Oct 2021 at 2:12 PM Last edited by Lyralei : 12th Oct 2021 at 10:45 AM. Reason: accidentally wrote "new new"...
Quote:
Originally Posted by whiteman-Dara
Hi, PuddingFace. Not green, but the color of the hair plantSim, no, but mummies and symbots cannot be created in CAS because of the skin tone, and their hairstyle intersects with the scalp. It won't help with the werewolf body hair, the body hair is applied because of the occultwerewolf class and the color is really applied random.


You can actually change this, even in CAS

You can really use CASlogic's approach for at least the beard by doing:

Code:
Color[] plantsimHairColors =  new Color[4] {
         new Color(0, RandomUtil.GetInt(80, 200), 0),
         new Color(0, RandomUtil.GetInt(80, 200), 0),
         new Color(0, RandomUtil.GetInt(80, 200), 0),
         new Color(0, RandomUtil.GetInt(80, 200), 0),
};
base.AddStep(new SetAllHairColorStep(BodyTypes.Hair, plantsimHairColors, true , plantsimHairColors[2], true, true));


If you're curious how other CAS changes are made in real time, then the 'RandomizeSimoperation may be helpful, of course, this snippet won't work for in-game (So outside of CAS). For that, I'd check OccultPlantSim.OnAddition

Regarding hiding the scalp and such, that's actually not difficult at all, since SimOutfit includes the ENTIRE sim, including the scalp and eyeballs:

Code:
CASLogic singleton = GetSingleton();
SimBuilder mBuilder = singleton.mBuilder;

// Getting our CASpart outfit string for the Frankenstein sim...
string mSimoutfitName = "";

	string text = "e";
	string text2 = "bodyFrankenSim";
	string text3 = RandomUtil.GetInt(1, 3).ToString();
	string text4 = "LTR"; // This will generate a clean simbot. otherwise do: string.Empty for a dirty one or make it empty anyways if it doesn't work.
	if (singleton.Gender == CASAgeGenderFlags.Male)
	{
		mSimoutfitName  = text + "m" + text2 + "Male" + text4 + text3;
	}
	mSimoutfitName = text + "f" + text2 + "Female" + text4 + text3;

string instanceName = "OccultManager.CreateOutfit_" + mSimoutfitName + "Instance";
ResourceKey key = ResourceKey.CreateOutfitKeyFromProductVersion(mSimoutfitName, ProductVersion.EP2);

SimOutfit simOutfit = new SimOutfit(key);
	if (simOutfit.IsValid)
	{
		mBuilder.UseCompression = true;
		mBuilder.Age = singleton.Age;
                
                // This is what makes the sim's skin invisible/transparent.
                mBuilder.SkinTone = new ResourceKey((ulong)CASSkinTones.NoSkinTone, 55867754u, 0u);
                mBuilder.SkinToneIndex = 0f;

		OutfitUtils.SetAutomaticModifiers(mBuilder);
		OutfitUtils.SetOutfit(mBuilder, simOutfit, null);
		ResourceKey key2 = mBuilder.CacheOutfit(instanceName);
		SimOutfit mFrankensteinOutfit = new SimOutfit(key2);
	}
OutfitUtils.SetOutfit(mBuilder, mFrankensteinOutfit, singleton.mCurrentSimData);
singleton.ExecuteSetOutfit(mFrankensteinOutfit);
singleton.UpdateCurrentSim(false);


And voila! you got yourself a simbot in CAS So it's not impossible, it'\s just not easy to find the right piece of code for it if you're new to CAS excecutions and CASparts really.
Lab Assistant
Original Poster
#9 Old 11th Oct 2021 at 2:49 PM Last edited by whiteman-Dara : 12th Oct 2021 at 9:54 AM.
Quote:
Originally Posted by Lyralei
You can actually change this, even in CAS

You can really use CASlogic's approach for at least the beard by doing:

Code:
Color[] plantsimHairColors =  new Color[4] {
         new new Color(0, RandomUtil.GetInt(80, 200), 0),
         new new Color(0, RandomUtil.GetInt(80, 200), 0),
         new new Color(0, RandomUtil.GetInt(80, 200), 0),
         new new Color(0, RandomUtil.GetInt(80, 200), 0),
};
base.AddStep(new SetAllHairColorStep(BodyTypes.Hair, plantsimHairColors, true , plantsimHairColors[2], true, true));


If you're curious how other CAS changes are made in real time, then the 'RandomizeSimoperation may be helpful, of course, this snippet won't work for in-game (So outside of CAS). For that, I'd check OccultPlantSim.OnAddition

Regarding hiding the scalp and such, that's actually not difficult at all, since SimOutfit includes the ENTIRE sim, including the scalp and eyeballs:

Code:
CASLogic singleton = GetSingleton();
SimBuilder mBuilder = singleton.mBuilder;

// Getting our CASpart outfit string for the Frankenstein sim...
string mSimoutfitName = "";

	string text = "e";
	string text2 = "bodyFrankenSim";
	string text3 = RandomUtil.GetInt(1, 3).ToString();
	string text4 = "LTR"; // This will generate a clean simbot. otherwise do: string.Empty for a dirty one or make it empty anyways if it doesn't work.
	if (singleton.Gender == CASAgeGenderFlags.Male)
	{
		mSimoutfitName  = text + "m" + text2 + "Male" + text4 + text3;
	}
	mSimoutfitName = text + "f" + text2 + "Female" + text4 + text3;

string instanceName = "OccultManager.CreateOutfit_" + mSimoutfitName + "Instance";
ResourceKey key = ResourceKey.CreateOutfitKeyFromProductVersion(mSimoutfitName, ProductVersion.EP2);

SimOutfit simOutfit = new SimOutfit(key);
	if (simOutfit.IsValid)
	{
		mBuilder.UseCompression = true;
		mBuilder.Age = singleton.Age;
                
                // This is what makes the sim's skin invisible/transparent.
                mBuilder.SkinTone = new ResourceKey((ulong)CASSkinTones.NoSkinTone, 55867754u, 0u);
                mBuilder.SkinToneIndex = 0f;

		OutfitUtils.SetAutomaticModifiers(mBuilder);
		OutfitUtils.SetOutfit(mBuilder, simOutfit, null);
		ResourceKey key2 = mBuilder.CacheOutfit(instanceName);
		SimOutfit mFrankensteinOutfit = new SimOutfit(key2);
	}
OutfitUtils.SetOutfit(mBuilder, mFrankensteinOutfit, singleton.mCurrentSimData);
singleton.ExecuteSetOutfit(mFrankensteinOutfit);
singleton.UpdateCurrentSim(false);


And voila! you got yourself a simbot in CAS So it's not impossible, it'\s just not easy to find the right piece of code for it if you're new to CAS excecutions and CASparts really.

Thank you, this was an example, I was not going to create skinless in CAS, I have a question when change gender or age in CAS will skin invisible remain? Or as a Simbot when age up?
As for PlantSim, I will rewrite the code and Write this you how everything works
Lab Assistant
Original Poster
#10 Old 12th Oct 2021 at 10:06 AM
Upset , in fact, in the simo files, each plantSimoutfit has its own hair color for every gender or age, and there are about 30 of them, and it's not a fact that a random hair color will suit a random plantSimoutfit.
Virtual gardener
staff: administrator
#11 Old 12th Oct 2021 at 10:41 AM
Quote:
Originally Posted by whiteman-Dara
Thank you, this was an example, I was not going to create skinless in CAS, I have a question when change gender or age in CAS will skin invisible remain? Or as a Simbot when age up?


I'm guessing that it will turn pitch black if you were to do that currently, as CAS doesn't have anything (yet) to check "hey this sim is a SimBot!" and just gets some random clothing/hair etc. It's the same problem that triggers the grim reaper to turning into a human when you age him up

Now what you may be able to do (and they do this for fairies and CAS-compatible occults) to just check what their occult is when you age them up IN Cas, or when entering cas.

All the operations that you see in CAS logic are, what I'd consider 'event listeners but cooler'. With that I mean, they always get 'triggered' if you add the step in your code and voila, it's doing stuff for you!

Anyways! Sorry for the rambling! I think really your own concern might be once the simbot ages into an elder in CAS, but even for that they have an 'operation' you could expand on and add the Simbot code for (Or better yet, I'd just make the snippet I shared into it's own function and then all you do is just call that function when you detect the sim is a SIMbot and aged up )
Back to top