Jump to content

» «


2 replies to this topic
  • Scypher

    Player Hater

  • Members
  • Joined: 24 Nov 2017
  • United-Kingdom


Posted 13 January 2018 - 04:03 PM



So i am trying to work out how to get the outfits into my menu

I have random outfit in but no clue on how the person can choose which outfit



  • Bob_74

    Square Civilian

  • Members
  • Joined: 05 Jan 2018
  • None


Posted 13 January 2018 - 05:39 PM

Its quite tedious to do, I'll try to explain but I haven't done this since a long time...


You'll mostly need to work with PED_COMPONENT_VARIATION.


It works like this (http://www.dev-c.com...62b14f48d29de80):

void SET_PED_COMPONENT_VARIATION(Ped ped, int componentId, int drawableId, int textureId, int paletteId) // 0x262B14F48D29DE80 0xD4F7B05C

ped = you player's character

componentId = the part you want to change (Torso, hands, feets, ...)

drawableId = the ID of the clothe

textureId = the ID of the texture (most clothes have many textures, ie: a t-shirt can be green, red, with a decal, ...)

paletteId = I don't really know about this one, seems like it is related to the ped and not the clothes


Go to Native DB and check this function comment to have the list of component ID.


----- Example -----

You want to list every t-shirts.

We will use the ComponentID n°3 (PED_VARIATION_TORSO).



To get every drawable variations (= model) of this component, you use (http://www.dev-c.com...7561561732a7842):

int GET_NUMBER_OF_PED_DRAWABLE_VARIATIONS(Ped ped, int componentId) // 0x27561561732A7842 0x9754C27D



Now, you will have the number of t-shirts models available for you character.

Let's say the function returned "5" and the player wants to chose the shirt model n°2.



You'll need to get the amount of textures this shirt has (http://www.dev-c.com...f7156a3142a6bad):

int GET_NUMBER_OF_PED_TEXTURE_VARIATIONS(Ped ped, int componentId, int drawableId) // 0x8F7156A3142A6BAD 0x83D9FBE7

PED::GET_NUMBER_OF_PED_TEXTURE_VARIATIONS(PlayerPed, 3, 2); // 3 = TORSO, 2 = Shirt model n°2


Now, you now how many different textures the shirt can have (let's say "10").

The player wants to use the texture n°6.



I'm not sure of this part...

The only missing part is now the palette ID (http://www.dev-c.com...3dd5f2a84b42281):

int GET_PED_PALETTE_VARIATION(Ped ped, int componentId) // 0xE3DD5F2A84B42281 0xEF1BC082


I think you should use this value directly in PED_COMPONENT_VARIATION (let's say it returned 0).


Make the character wear it

And only now, you can call the native that displays the shirt on the character:

PED::SET_PED_COMPONENT_VARIATION(PlayerPed, 3, 2, 6, 0) // 0x262B14F48D29DE80 0xD4F7B05C


The player should now see the beautiful shirt on his character!



About accessories

Hats, glasses, watches and some other accessories are usable with an other function:

void SET_PED_PROP_INDEX(Ped ped, int componentId, int drawableId, int TextureId, BOOL attach) // 0x93376B65A266EB5F 0x0829F2E2

attach = is the object attached to the character (true) or does it fall if he is punched (false)


You proceed the same way as other clothes (how many drawable variations, how many textures for each, etc.)




If you want to make the menu simpler at first (for debugging), you should let the player select the ID himself.

Like this:

  | - Drawable (select from 0 to GET_NUMBER_OF_PED_DRAWABLE_VARIATIONS)
  | - Texture (select from 0 to GET_NUMBER_OF_PED_TEXTURE_VARIATIONS)
  | - Palette (maybe try from 0 to GET_PED_PALETTE_VARIATION?)

You do this for every componentID.

And call SET_PED_COMPONENT_VARIATION at each modification, so you'll see what it does directly.




Hope this helped! :)

  • Scypher likes this

  • Scypher

    Player Hater

  • Members
  • Joined: 24 Nov 2017
  • United-Kingdom


Posted 13 January 2018 - 07:23 PM

Thank you very much Bob

1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users