Log in to reply
 

How to Change a Ped's Clothing with C#?



  • Hello. I wonder if you can help me about my question. How can I change a ped model's clothing with C#? I'm spawning the ped in game but I want to change his clothes. Thank you.



  • @ekmuz
    void SET_PED_COMPONENT_VARIATION(Ped ped, int componentId, int drawableId, int textureId, int paletteId)



  • @ekmuz Here is actual code I wrote, that shows you different components

    public void SpawnTranny()
            {
                Ped Ped1 = World.CreatePed(PedHash.FreemodeFemale01, Game.Player.Character.GetOffsetPosition(new Vector3(0, 1, 0)));
                CurrentPed = Ped1;
               
                //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
            }
    


  • @JohnFromGWN thank you. And how can I copy a ped's all clothes and store it in an .ini file? (i know how to store it but i don't know how to copy :( )



  • @ekmuz sorry, don't understand what you're trying to do. If you want to store different outfits you do that in your code. If you want to return the clothes a ped is wearing you use a get function.

    If you want the user to modify the ini that won't work because the code is meaningless if you're just looking at numbers.



  • @JohnFromGWN sorry i didn't explain very well. I want to get all of the clothes (including props, facial details...) a ped is wearing and then copy them to another same-modeled ped. which function should i use?



  • @ekmuz get function

    Game.Player.ChangeModel(CurrentPed.Model); 
             Function.Call(Hash.CHANGE_PLAYER_PED, Game.Player.Character, CurrentPed, true, true);
                //var Int1 = Function.Call<int>(Hash.GET_PED_DRAWABLE_VARIATION, CurrentPed, 3);
                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, 8), 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));
                
                //props, you can increase if needed. Ear Pieces 2, watches 3, bangles 4
                Function.Call(Hash.SET_PED_PROP_INDEX, Game.Player.Character, 0, Function.Call<int>(Hash.GET_PED_PROP_INDEX, CurrentPed, 0), Function.Call<int>(Hash.GET_PED_PROP_TEXTURE_INDEX, CurrentPed, 0, 2)); //hat
                Function.Call(Hash.SET_PED_PROP_INDEX, Game.Player.Character, 1, Function.Call<int>(Hash.GET_PED_PROP_INDEX, CurrentPed, 1), Function.Call<int>(Hash.GET_PED_PROP_TEXTURE_INDEX, CurrentPed, 1, 2)); //glasses
    
                Game.Player.Character.IsInvincible = true;
                Game.Player.Character.Weapons.Give(WeaponHash.CombatPistol, 5000, true, true); //true has to belcase
                Game.Player.Character.Weapons.Give(WeaponHash.Unarmed, 1, false, true);
            }
    


  • @JohnFromGWN so, i'll use "GET_PED_DRAWABLE_VARIATION" for component_variations.
    and "GET_PED_PROP_INDEX" for prop_indexes.
    that's ok. but I need to know how to get what is below the "//Blend Data" line you shared with me in your first answer. I'm sorry for bothering you.



  • @ekmuz only the MP peds will have blend data and i never mod them except the example i provided. I've never used the get blend but if the native exists you'll see it in the native database or from intellisense.


Log in to reply
 

Looks like your connection to GTA5-Mods.com Forums was lost, please wait while we try to reconnect.