Log in to reply
 

How to spawn ped with custom outfit at startup or on demand



  • I've seen a question about how to startup GTA V with your character in his/her preferred/custom outfit asked a few times and I'll suggest one way to do this without installing any other script mods. I wasn't trying to do this, but was working on something similar, so I thought I would share the learning. It does require a simple script and Menyoo will make it much easier. I hope it can be used for the purpose above as well.

    1. Create your character outfit in Menyoo's Wardrobe.
    2. Save the outfit (it will be an xml file in the Menyoo Stuff, Outfits Folder.
    3. Open the xml file in a text editor.
    4. All your parameters will be in the xml file. Use these parameters to populate native functions.
    5. Run the script from a key and your character will spawn in your selected outfit.
    6. From Menyoo, Object Spooner, F9, steal Peds soul to become that Ped

    In the XML file, your parameters will look like this. This isn't a complete list but covers the major changes. For a complete list of functions, go here:
    https://alloc8or.re/gta5/nativedb/

    Examples:

    1. Props such as glasses and watches, helmets, etc. will be identified by the following tags:
      <PedProps>
      <_0>-1,-1</_0>
      <_1>20,0</_1>
      <_2>-1,-1</_2>
      <_3>-1,-1</_3>
      <_4>-1,-1</_4>
      <_5>-1,-1</_5>
      <_6>25,0</_6>
      <_7>0,0</_7>
      <_8>-1,-1</_8>
      <_9>-1,-1</_9>

    2. Ped parameters/components such as hair, face, torso, clothes, legs, etc, like this:
      <PedComps>
      <_0>18,0</_0>
      <_1>0,0</_1>
      <_2>10,0</_2>
      <_3>131,0</_3>
      <_4>133,0</_4>
      <_5>6,1</_5>
      <_6>19,0</_6>
      <_7>8,0</_7>
      <_8>10,0</_8>
      <_9>0,0</_9>
      <_10>6,0</_10>
      <_11>225,0</_11>
      </PedComps>

    3. Other tags may include hair color, facial features etc. To keep it simple here are some examples.
      <ShapeAndSkinTone>
      <ShapeFatherId>25</ShapeFatherId>
      <ShapeMotherId>18</ShapeMotherId>
      <ShapeOverrideId>0</ShapeOverrideId>
      <ToneFatherId>25</ToneFatherId>
      <ToneMotherId>18</ToneMotherId>
      <ToneOverrideId>0</ToneOverrideId>
      <ShapeVal>0.0954999998</ShapeVal>
      <ToneVal>0.289999992</ToneVal>
      <OverrideVal>0</OverrideVal>
      <IsP>1</IsP>
      </ShapeAndSkinTone>
      <HairColour>4</HairColour>
      <HairColourStreaks>0</HairColourStreaks>
      <EyeColour>1</EyeColour>

    Finally, to put it all together, here are examples of the functions you will use. These are from working VB.NET code, syntax for C# is similar I"m sure, just missing the ; to terminate function.

    In the "component variation" function below, the first integer (from 1 to 11) is the component, the next 2 values come from your xml file, the last integer is left as 2.
    Native.Function.Call(Hash.SET_PED_COMPONENT_VARIATION, Ped1, 0, 18, 0, 2) 'FACE
    Native.Function.Call(Hash.SET_PED_COMPONENT_VARIATION, Ped1, 1, 0, 0, 2) 'BEARD OR MASK
    Native.Function.Call(Hash.SET_PED_COMPONENT_VARIATION, Ped1, 2, 10, 0, 2) 'HAIR
    Native.Function.Call(Hash.SET_PED_COMPONENT_VARIATION, Ped1, 3, 131, 0, 2) 'SHIRT/TORSO
    Native.Function.Call(Hash.SET_PED_COMPONENT_VARIATION, Ped1, 4, 133, 0, 2) 'LEGS/PANTS
    Native.Function.Call(Hash.SET_PED_COMPONENT_VARIATION, Ped1, 5, 6, 1, 2) 'HANDS GLOVES
    Native.Function.Call(Hash.SET_PED_COMPONENT_VARIATION, Ped1, 6, 19, 0, 2) 'SHOES
    Native.Function.Call(Hash.SET_PED_COMPONENT_VARIATION, Ped1, 7, 8, 0, 2) 'EYES
    Native.Function.Call(Hash.SET_PED_COMPONENT_VARIATION, Ped1, 8, 10, 0, 2) 'ACCESSORIES
    Native.Function.Call(Hash.SET_PED_COMPONENT_VARIATION, Ped1, 9, 0, 0, 2) 'TASKS OR IS IT REALLY MASKS??
    Native.Function.Call(Hash.SET_PED_COMPONENT_VARIATION, Ped1, 10, 6, 0, 2) 'TEXTURES
    Native.Function.Call(Hash.SET_PED_COMPONENT_VARIATION, Ped1, 11, 225, 0, 2) 'TORSO2
    Native.Function.Call(Hash.SET_PED_HEAD_BLEND_DATA, Ped1, 25, 18, 0, 25, 18, 0, 0.095499F, 0.29F, 0.0F, 1)
    Native.Function.Call(Hash._SET_PED_HAIR_COLOR, Ped1, 4, 0) 'Additional Hair
    Native.Function.Call(Hash._SET_PED_EYE_COLOR, Ped1, 1, 0) 'Additional Eye
    Native.Function.Call(Hash.SET_PED_PROP_INDEX, Ped1, 1, 20, 0, 1) 'Glasses
    Native.Function.Call(Hash.SET_PED_PROP_INDEX, Ped1, 6, 25, 0, 1) 'Watch

    That's it. Holler if anything is unclear.
    BTW, I think the documentation is wrong when it says component 9 is "Tasks", I have a feeling they meant "Masks". I don't use 9.



  • Task is correct, it's the second accessory slot, also your example is missing more head blend data which i don't know how to apply through scripting myself, that being customization of jaw, nose etc



  • @HeySlickThatsMe Hi. I mentioned in my post that this wasn't a complete list. There are a few other functions I left out.

    Have to admit you lost me on tasks, how can tasks be part of an outfit? Can you give an example?

    As for further customization, you've tried PED::_SET_PED_FACE_FEATURE?
    The 6th item in Menyoo (starts at 0), item 5 below, is for broken nose as an example.
    Native.Function.Call(Hash._SET_PED_FACE_FEATURE, 5, 0.95) 'broken nose
    Note that some functions are SET, others are _SET (the variable is private to the class).

    <FacialFeatures>
    <_0>-0.400000</_0>
    <_1>0.000000</_1>
    <_2>0.000000</_2>
    <_3>0.000000</_3>
    <_4>0.000000</_4>
    <_5>0.950000</_5>
    <_6>0.000000</_6>
    <_7>0.000000</_7>
    <_8>0.000000</_8>
    <_9>0.000000</_9>
    <_10>0.000000</_10>
    <_11>0.000000</_11>
    <_12>0.400000</_12>
    <_13>0.300000</_13>
    <_14>0.400000</_14>
    <_15>0.000000</_15>
    <_16>0.000000</_16>
    <_17>0.000000</_17>
    <_18>0.000000</_18>
    <_19>0.000000</_19>
    </FacialFeatures>



  • If anyone is interested, here is a good reference for PED_HEAD_BLEND_DATA

    https://gtaforums.com/topic/858970-all-gtao-face-ids-pedset_ped_head_blend_data-explained/

    alt text



  • @JohnFromGWN said in How to spawn ped with custom outfit at startup or on demand:

    @HeySlickThatsMe Hi. I mentioned in my post that this wasn't a complete list. There are a few other functions I left out.

    Have to admit you lost me on tasks, how can tasks be part of an outfit? Can you give an example?

    The slot is simply called "Task" not sure why rockstar named it like that, max payne 3 has another slot that is called "jack" for example



  • @HeySlickThatsMe Interesting. In passing, you really do need to customize the MP models because they women are really ugly, particularly when they share the same faces as the men.



  • @JohnFromGWN Hey man! How do I add a fedora hat on a ped? I'm quite confused with all the int parameters like component id, texture id



  • @nightmareexe

    The ped or NPC has to have hats of course.

    For Michael as an example:

    Function.Call(Hash.SET_PED_PROP_INDEX, Game.Player.Character, 0, 12, 0, 2); //hat



  • @JohnFromGWN Thanks a lot man! Is there any way to know if a ped has a hat prop? Sorry man I'm a total noob :persevere:



  • @nightmareexe

    The easiest way to check is with your trainer. For example select your ped in Menyoo and select wardrobe and hats. If there are hats note the number so you can use it in your code. You can also check the meta data, but trainer is good way.



  • @JohnFromGWN Thanks man! I followed your post up top, it was really helpful!



  • This post is deleted!


  • This post is deleted!

Log in to reply
 

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