fxmanifest per Vestiti Custom
INFO
Configurazione finale per una risorsa di abbigliamento custom.
| Obiettivo | Dettagli |
|---|---|
| Cosa imparerai | • Struttura finale di una risorsa vestiti • Configurazione fxmanifest.lua • Script Lua per applicare vestiti a player e NPC • Errori comuni e checklist di verifica finale |
| Prerequisiti | • Aver completato le guide precedenti (modellazione, export, meta) • Conoscenza base di Lua per FiveM |
Struttura Finale
custom_clothes/
├── fxmanifest.lua
├── client.lua
└── stream/
├── mp_m_freemode_01_tshirt_01.ydd ← Maglietta
├── mp_m_freemode_01_tshirt_01.ytd ← Texture maglietta
├── mp_m_freemode_01_pants_01.ydd ← Pantaloni
├── mp_m_freemode_01_pants_01.ytd ← Texture pantaloni
├── mp_m_freemode_01_shoes_01.ydd ← Scarpe
├── mp_m_freemode_01_shoes_01.ytd ← Texture scarpe
├── mp_m_freemode_01_hat_01.ydd ← Cappello
├── mp_m_freemode_01_hat_01.ytd ← Texture cappello
└── mp_m_freemode_01_hat_01.pedvariation.meta ← (se vuoi varianti)
fxmanifest
-- fxmanifest.lua
fx_version 'cerulean'
game 'gta5'
author 'TuoNome'
description 'Vestiti Custom - Polizia Nightfall'
version '1.0.0'
> [!TIP]
>
> Non serve dichiarare `data_file` per i vestiti normali — i file `.ydd` e `.ytd` nella cartella `stream/` vengono caricati automaticamente da FiveM. Il `data_file` è necessario solo per file meta come `pedvariation.meta` o `shop_ped_apparel.meta`.
-- I file .ydd e .ytd in stream/ sono caricati automaticamente
-- Il PedVariation.meta (se presente) si carica da solo
-- Non servono data_file particolari per i vestiti
client_script 'client.lua'Client Lua — Applicare i Vestiti
-- client.lua
-- Applica i vestiti custom al giocatore
RegisterCommand('uniform', function()
local playerPed = PlayerPedId()
-- Applica componente per componente
-- SetPedComponentVariation(ped, componentId, drawableId, textureId, paletteId)
-- Torso: maglietta (Component 3)
SetPedComponentVariation(playerPed, 3, 0, 0, 0)
-- Pantaloni (Component 4)
SetPedComponentVariation(playerPed, 4, 0, 0, 0)
-- Scarpe (Component 6)
SetPedComponentVariation(playerPed, 6, 0, 0, 0)
-- Cappello (Prop 0)
SetPedPropIndex(playerPed, 0, 0, 0, true)
-- Occhiali (Prop 1)
SetPedPropIndex(playerPed, 1, 0, 0, true)
print('^2[VESTITI] Uniforme applicata!')
end, false)
-- Comando per rimuovere i vestiti (torna a default)
RegisterCommand('strip', function()
local playerPed = PlayerPedId()
for id = 0, 11 do
SetPedComponentVariation(playerPed, id, 0, 0, 0)
end
for id = 0, 6 do
ClearPedProp(playerPed, id)
end
print('^2[VESTITI] Outfit rimosso!')
end, false)WARNING
Attenzione: Se il vestito è invisibile sul giocatore ma il comando non dà errori, verifica che il DrawableId nello script corrisponda esattamente all’indice definito in
pedvariation.meta. Un numero sbagliato dà un capo vuoto (invisibile).
Risorsa per NPC con Vestiti
-- client.lua (NPC con vestiti custom)
Citizen.CreateThread(function()
local model = GetHashKey('mp_m_freemode_01')
RequestModel(model)
while not HasModelLoaded(model) do
Citizen.Wait(100)
end
local coords = GetEntityCoords(PlayerPedId())
local npc = CreatePed(0, model, coords.x + 3, coords.y + 3, coords.z, 0.0, true, false)
-- Applica vestiti all'NPC
SetPedComponentVariation(npc, 3, 0, 0, 0) -- Maglietta
SetPedComponentVariation(npc, 4, 0, 0, 0) -- Pantaloni
SetPedComponentVariation(npc, 6, 0, 0, 0) -- Scarpe
SetPedPropIndex(npc, 0, 0, 0, true) -- Cappello
SetEntityAsMissionEntity(npc, true, true)
TaskWanderStandard(npc, 10.0, 10)
end)Errori Comuni
| Problema | Causa | Soluzione |
|---|---|---|
| Vestito invisibile | DrawableId errato o YDD mancante | Controlla stream/ e il numero drawable |
| Texture bianca/checker | YTD mancante o non caricato | Re-export con texture |
| Capo non segue il corpo | Weight painting errato | Ripesa il capo nel corpo |
| Clipping visibile | Spessore insufficiente | Aumenta spessore del capo |
| Crash cambiando outfit | YDD danneggiato | Ricontrolla export da Blender |
Verifica Finale
- I file
.ydde.ytdsono instream/ - I drawableId nel
SetPedComponentVariationcorrispondono ai file - Il comando
/uniformapplica i vestiti correttamente - Il capo segue le animazioni del ped
- Non c’è clipping visibile
TIP
✅ Modulo Vestiti completato! Passa al Modulo 06 — Veicoli Custom.
Torna alla: Indice Generale