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!
Field Researcher
Original Poster
#1 Old 10th Apr 2014 at 9:28 PM Last edited by fer456 : 10th Apr 2014 at 9:30 PM. Reason: Title corrected
How to make a makeup appear with scripting
Hi folks, again me :

I am having a few problems in the creation of a script to make a makeup appears. The makeup that I want to appear are in the section of "Special makeup" in CAS, and am also trying to make how to makeup appear in different layers, i.e. they overlap in different layers.
He was trying to set up to appear automatically when a buff and that disappears when another buff and after the passage of time, without any set time, randomly. However, I do not understand how to find this configuration in Sims3.Gameplay.Utilities.

And the biggest problem I've had has been that of compatibility. In some cases, in which happen very frequently, the code cause an exploit in the game. In a lot of cases, are triggered several makeup at the same time, and one of them disappears, since I work with several makeovers, scripting should be processed, and that causes me and error, thing that I have not been able to resolve

Can someone help me with a code more or less effective?
Advertisement
Forum Resident
#2 Old 13th Apr 2014 at 2:42 AM
I'm gonna spit out some copy and pasted ugly and raw code here.
This is for applying age weathering but can be modified for any CASPart (they all basically work the same).
Code removes all existing CASParts of the given type and applies the defined one.

I'm sorry I only have this sort of one-trick-pony stuff at hand.

simDescription is the SimDescription object of the Sim we want to work on.
Code:
// define the list of CAS parts to apply
List<CASPart> partlist = new List<CASPart>();
partlist.Add( new CASPart(new ResourceKey(0xF387CAEE25622240L, 0x034AEECB, 0))); //this is the CASPart we are going to apply

bool apply = true // false removes all CASParts the type definded below


// lets go and apply it to our sim:
                SimBuilder builder = new SimBuilder();

                List<BodyTypes> btypes = new List<BodyTypes>();

                btypes.AddRange(new BodyTypes[] { BodyTypes.AgeWeathering });   // here is the CASPart type. the enum offes tons of selections
                ulong uniformComponentMask = 0L;
                foreach (BodyTypes types in btypes)
                {

                    uniformComponentMask |= ((ulong)1L) << ((int)types);
                }
                simDescription.RemoveBodyTypeFromAllOutfits(btypes);
                OutfitUtils.SetOutfit(builder, simDescription.GetOutfit(OutfitCategories.Everyday, 0), simDescription, uniformComponentMask);

                if (apply)
                {

                    foreach (CASPart caspart in partlist)
                    {


                        OutfitUtils.AddPartAndPreset(builder, caspart, true);
                    }

                }
                SimOutfit outfit = new SimOutfit(builder.CacheOutfit(simDescription.SimDescriptionId + "_genHair"));
                simDescription.ApplyBodyTypeToAllOutfits(outfit, uniformComponentMask, simDescription.SimDescriptionId + "_genHair");

Find my Mods: Here at MTS, over at Simlogical
Field Researcher
Original Poster
#3 Old 18th Apr 2014 at 2:32 PM
Quote: Originally posted by Consort
I'm gonna spit out some copy and pasted ugly and raw code here.
This is for applying age weathering but can be modified for any CASPart (they all basically work the same).
Code removes all existing CASParts of the given type and applies the defined one.

I'm sorry I only have this sort of one-trick-pony stuff at hand.

simDescription is the SimDescription object of the Sim we want to work on.
Code:
// define the list of CAS parts to apply
List<CASPart> partlist = new List<CASPart>();
partlist.Add( new CASPart(new ResourceKey(0xF387CAEE25622240L, 0x034AEECB, 0))); //this is the CASPart we are going to apply

bool apply = true // false removes all CASParts the type definded below


// lets go and apply it to our sim:
                SimBuilder builder = new SimBuilder();

                List<BodyTypes> btypes = new List<BodyTypes>();

                btypes.AddRange(new BodyTypes[] { BodyTypes.AgeWeathering });   // here is the CASPart type. the enum offes tons of selections
                ulong uniformComponentMask = 0L;
                foreach (BodyTypes types in btypes)
                {

                    uniformComponentMask |= ((ulong)1L) << ((int)types);
                }
                simDescription.RemoveBodyTypeFromAllOutfits(btypes);
                OutfitUtils.SetOutfit(builder, simDescription.GetOutfit(OutfitCategories.Everyday, 0), simDescription, uniformComponentMask);

                if (apply)
                {

                    foreach (CASPart caspart in partlist)
                    {


                        OutfitUtils.AddPartAndPreset(builder, caspart, true);
                    }

                }
                SimOutfit outfit = new SimOutfit(builder.CacheOutfit(simDescription.SimDescriptionId + "_genHair"));
                simDescription.ApplyBodyTypeToAllOutfits(outfit, uniformComponentMask, simDescription.SimDescriptionId + "_genHair");


Thank you!
Back to top