Ped Texture
A powerfull module to manage the ped texture like makeup/tatoo/...
WARNING
Textures can only be apply on networked ped. If you want use it in a script with ped only visible by one player, like character selector, you have to move the player in solo routing bucket and spawn the ped as networked.
Functions
jo.pedTexture.apply()
A function to apply texture on a specific ped
Syntax
jo.pedTexture.apply(ped,layername,data)
Parameters
ped
: integer
The entity ID
layername
: string
The layername of the texture
data
: object
The data of the texture
data.id
: integer - The ID of the texture
ORdata.albedo
: string - The albedo of the texturedata.sheetGrid
: integer - the sheet grid of the texture. default: 0 Optionaldata.opacity
: float 0.0<>1.0 - the opacity of the texture. default: 1.0 Optionaldata.blendType
: integer - the blend type of the texture. default: 1 Optionaldata.palette
: string/integer - The palette of the colors. default: "metaped_tint_makeup" Optionaldata.tint0
: string/integer - The first color Optionaldata.tint1
: string/integer - The second color Optionaldata.tint2
: string/integer - The third color Optional
Example
local ped = PlayerPedId()
local layername = "eyeshadow"
local data = jo.pedTexture.variations.eyeshadow[3].value
data.palette = "metaped_tint_makeup"
data.tint0 = 5
data.tint1 = 10
data.tint2 = 40
jo.pedTexture.apply(ped,layername,data)
jo.pedTexture.getAll()
Return the list of layers in all categories
Syntax
jo.pedTexture.getAll()
Parameters
ped
: integer
The entity ID
Return value
Type: object
Return the list of layer apply on the ped
Example
local ped = PlayerPedId()
local textures = jo.pedTexture.getAll(ped)
print(json.encode(textures))
--Expected output: {heads = {eyeshdow = {...}, foundation = {...}}}
jo.pedTexture.getOverlayAssetFromId()
A function to get the hashname of a texture
Syntax
jo.pedTexture.getOverlayAssetFromId(isMale,layername,id)
Parameters
isMale
: boolean
true
if the texture is for a male,false
otherwise
layername
: string
The layername of the texture
id
: integer
The ID of the texture
Return value
Type: string
Return the hashname of the texture for this ID
Example
local isMale = true
local layername = "eyebrow"
local id = 5
local texture = jo.pedTexture.getOverlayAssetFromId(isMale,layername,id)
print(texture)
--Expected output: mp_u_faov_eyebrow_005
jo.pedTexture.overwriteCategory()
A function to overwrite all the layers of category
Syntax
jo.pedTexture.overwriteCategory(ped,category,overlays)
Parameters
ped
: integer
The entity ID
category
: string
The category of the texture
overlays
: object
The list of layers
Example
local ped = PlayerPedId()
local category = "heads"
local overlays = {
eyeshadow = {sheetGrid = 3, tint0 = 1, tint1 = 45, tint2 = 56},
foundation = {id = 0, palette = "metaped_tint_makeup", tint0 = 78}
}
jo.pedTexture.overwriteCategory(ped,category,overlays)
jo.pedTexture.refreshAll()
A function to refresh the ped texture
Syntax
jo.pedTexture.refreshAll(ped)
Parameters
ped
: integer
The entity ID
Example
local ped = PlayerPedId()
jo.pedTexture.refreshAll(ped)
jo.pedTexture.remove()
A function to remove a texture
Syntax
jo.pedTexture.remove(ped,layername)
Parameters
ped
: integer
The entity ID
layername
: string
The layer name of the texture
Example
local ped = PlayerPedId()
local layername = "eyeshadow"
jo.pedTexture.remove(ped,layername)
Variables
jo.pedTexture.categories
An object to know the on each part of the ped the layername has to be apply
Syntax
jo.pedTexture.categories[layername]
Parameters
layername
: string
The layer name of the texture
Example
local part = jo.pedTexture.categories.eyeshadow
print(part)
--Expected output: heads
jo.pedTexture.variations
A variable with the list of existing texture for peds. The key is the layername and value the list of variations
Syntax
jo.pedTexture.variations[layername] = variations
Parameters
layername
: string
The layername of the texture
variations
: table
the list of variations
variations[x].label
: string - the label of the variationsvariations[x].value
: table - the definition of the variations
Example
local listEyeshadow = jo.pedTexture.variations.eyeshadow
for _,variation in pairs (listEyeshadow) do
print(variable.label)
print(json.encode(variation.value))
end