How do i save player outfit in script?
-
I'm trying to play a cutscene in my script but the outfit of my character gets overwritten, i was wondering how can i save my component variation before that happens? I though the there would be a GET_PED_COMPONENT_VARIATION in functions but there is none
-
also found this GetVariantComponent but dont know how to use it
-
@M8T I normally save the outfit in Menyoo and then pick the values from the xml file, or edit in VS with the xml open.
I'm going to give you a more complicated example I use for the MP female. Often the order of functions is important. I found this by very painful trial and error. This only applies for advanced features such as changing the face, adding beards, blemishes, skin tones, etc. Remember that there are components and props so different functions. I'm using natives, don't know the SHVDN equivalents.
There is also a function to save the outfit as its default, but this doesn't work well with poorly designed addons - the default might be headless!Ped Ped1 = World.CreatePed(PedHash.FreemodeFemale01, Game.Player.Character.GetOffsetPosition(new Vector3(0, 1, 0)));
CurrentPed = Ped1;
{ EquipCurrentPed(); }
//PedComps -Component Variation
Function.Call(Hash.SET_PED_COMPONENT_VARIATION, CurrentPed, 0, 39, 0, 2); //'FACE
Function.Call(Hash.SET_PED_COMPONENT_VARIATION, CurrentPed, 1, 0, 0, 2); //'BEARD OR MASK
Function.Call(Hash.SET_PED_COMPONENT_VARIATION, CurrentPed, 2, 10, 0, 2); //'HAIR
Function.Call(Hash.SET_PED_COMPONENT_VARIATION, CurrentPed, 3, 45, 0, 2); //'SHIRT/TORSO
Function.Call(Hash.SET_PED_COMPONENT_VARIATION, CurrentPed, 4, 15, 0, 2); //'LEGS/PANTS
Function.Call(Hash.SET_PED_COMPONENT_VARIATION, CurrentPed, 5, 0, 0, 2); //'HANDS GLOVES
Function.Call(Hash.SET_PED_COMPONENT_VARIATION, CurrentPed, 6, 0, 0, 2); //'SHOES
Function.Call(Hash.SET_PED_COMPONENT_VARIATION, CurrentPed, 7, 23, 0, 2); //'BOWTIE/SCARVES
Function.Call(Hash.SET_PED_COMPONENT_VARIATION, CurrentPed, 8, 10, 0, 2); //'ACCESSORIES
Function.Call(Hash.SET_PED_COMPONENT_VARIATION, CurrentPed, 9, 0, 0, 2); //'TASKS OR IS IT REALLY MASKS??
Function.Call(Hash.SET_PED_COMPONENT_VARIATION, CurrentPed, 10, 6, 0, 2); //'TEXTURES
Function.Call(Hash.SET_PED_COMPONENT_VARIATION, CurrentPed, 11, 15, 0, 2); //'TORSO2
//PedProps (Accessories in Menyoo)
Function.Call(Hash.SET_PED_PROP_INDEX, CurrentPed, 2, 18, 0, 1); // ear pieces
Function.Call(Hash.SET_PED_PROP_INDEX, CurrentPed, 6, 2, 0, 1); // watches
//FacialFeatures, 0-19, values float between -1 and 1, default is 0
Function.Call(Hash._SET_PED_FACE_FEATURE, CurrentPed, 0, -0.4); // nose width
Function.Call(Hash._SET_PED_FACE_FEATURE, CurrentPed, 6, 0.6); //
Function.Call(Hash._SET_PED_FACE_FEATURE, CurrentPed, 18, 1); //
Function.Call(Hash._SET_PED_FACE_FEATURE, CurrentPed, 19, 1); //
//Blend Data
Function.Call(Hash.SET_PED_HEAD_BLEND_DATA, CurrentPed, 28, 23, 0, 26, 27, 0, 0.0455F, 1.009F, 0.0F, true);
Function.Call((Hash)0x48F44967FA05CC1E, CurrentPed, 1, 5, 0.8); //beard
Function.Call((Hash)0x497BF74A7B9CB952, CurrentPed, 1, 1, 0, 0); //beard colour
Function.Call(Hash.SET_PED_HEAD_OVERLAY, CurrentPed, 8, 0, 0.63); //lipstick
Function.Call(Hash._SET_PED_HEAD_OVERLAY_COLOR, CurrentPed, 8, 2, 0, 0); //mandatory, 2 for lip colortype (not the specific color, just the parameter)
Function.Call((Hash)0x48F44967FA05CC1E, CurrentPed, 10, 8, 0.7); //chest hair
Function.Call((Hash)0x497BF74A7B9CB952, CurrentPed, 10, 1, 0, 0); //mandatory
Function.Call(Hash.SET_PED_HEAD_OVERLAY, CurrentPed, 11, 0, .8);//body blemish
Function.Call(Hash._SET_PED_HEAD_OVERLAY_COLOR, CurrentPed, 11, 1, 0, 0); //mandatory
//this code has to come later, if put higher will not run
Function.Call(Hash._SET_PED_HAIR_COLOR, CurrentPed, 7, 0); //'Additional Hair
Function.Call(Hash._SET_PED_EYE_COLOR, CurrentPed, 4, 0); //'Additional Eye
-
@M8T and sorry you asked for the get.
Function.Call(Hash.SET_PED_COMPONENT_VARIATION, Game.Player.Character, 0, Function.Call<int>(Hash.GET_PED_DRAWABLE_VARIATION, CurrentPed, 0), Function.Call<int>(Hash.GET_PED_TEXTURE_VARIATION, CurrentPed, 0, 2));
Function.Call(Hash.SET_PED_COMPONENT_VARIATION, Game.Player.Character, 1, Function.Call<int>(Hash.GET_PED_DRAWABLE_VARIATION, CurrentPed, 1), Function.Call<int>(Hash.GET_PED_TEXTURE_VARIATION, CurrentPed, 1, 2));
Function.Call(Hash.SET_PED_COMPONENT_VARIATION, Game.Player.Character, 2, Function.Call<int>(Hash.GET_PED_DRAWABLE_VARIATION, CurrentPed, 2), Function.Call<int>(Hash.GET_PED_TEXTURE_VARIATION, CurrentPed, 2, 2));
Function.Call(Hash.SET_PED_COMPONENT_VARIATION, Game.Player.Character, 3, Function.Call<int>(Hash.GET_PED_DRAWABLE_VARIATION, CurrentPed, 3), Function.Call<int>(Hash.GET_PED_TEXTURE_VARIATION, CurrentPed, 3, 2));
Function.Call(Hash.SET_PED_COMPONENT_VARIATION, Game.Player.Character, 4, Function.Call<int>(Hash.GET_PED_DRAWABLE_VARIATION, CurrentPed, 4), Function.Call<int>(Hash.GET_PED_TEXTURE_VARIATION, CurrentPed, 4, 2));
Function.Call(Hash.SET_PED_COMPONENT_VARIATION, Game.Player.Character, 5, Function.Call<int>(Hash.GET_PED_DRAWABLE_VARIATION, CurrentPed, 5), Function.Call<int>(Hash.GET_PED_TEXTURE_VARIATION, CurrentPed, 5, 2));
Function.Call(Hash.SET_PED_COMPONENT_VARIATION, Game.Player.Character, 6, Function.Call<int>(Hash.GET_PED_DRAWABLE_VARIATION, CurrentPed, 6), Function.Call<int>(Hash.GET_PED_TEXTURE_VARIATION, CurrentPed, 6, 2));
Function.Call(Hash.SET_PED_COMPONENT_VARIATION, Game.Player.Character, 7, Function.Call<int>(Hash.GET_PED_DRAWABLE_VARIATION, CurrentPed, 7), Function.Call<int>(Hash.GET_PED_TEXTURE_VARIATION, CurrentPed, 7, 2));
Function.Call(Hash.SET_PED_COMPONENT_VARIATION, Game.Player.Character, 8, Function.Call<int>(Hash.GET_PED_DRAWABLE_VARIATION, CurrentPed,, Function.Call<int>(Hash.GET_PED_TEXTURE_VARIATION, CurrentPed, 8, 2));
Function.Call(Hash.SET_PED_COMPONENT_VARIATION, Game.Player.Character, 9, Function.Call<int>(Hash.GET_PED_DRAWABLE_VARIATION, CurrentPed, 9), Function.Call<int>(Hash.GET_PED_TEXTURE_VARIATION, CurrentPed, 9, 2));
Function.Call(Hash.SET_PED_COMPONENT_VARIATION, Game.Player.Character, 10, Function.Call<int>(Hash.GET_PED_DRAWABLE_VARIATION, CurrentPed, 10), Function.Call<int>(Hash.GET_PED_TEXTURE_VARIATION, CurrentPed, 10, 2));
Function.Call(Hash.SET_PED_COMPONENT_VARIATION, Game.Player.Character, 11, Function.Call<int>(Hash.GET_PED_DRAWABLE_VARIATION, CurrentPed, 11), Function.Call<int>(Hash.GET_PED_TEXTURE_VARIATION, CurrentPed, 11, 2));
-
@JohnFromGWN i dont understand SET_PED_COMPONENT is to set the clothes not to save them right?
-
@M8T I just replied with the Get Functions. Saving is another story.
I'm not a programmer but I guess you would have to store the outfit in static variables - and that would be a huge shitload of variables given the number of components and possibilities. So an array?
I use get, for example, when I switch the player with another ped model and I want to have the same outfit as the ped model, not its default.
I spawn all my vehicles and peds through c# (lemonui menu) so that they are fully outfitted (peds) or customized (vehicles).
I no longer use my trainer for this. I never save anything unless it is to get the values (menyoo save outfit, save map, save vehicle - all have the values i need in xml).
-
@JohnFromGWN Ok i found out how to do what i was trying to do! Thanks for the help