Knowledge from the fieldRedM

Refreshing a ped after component changes is a 3-native combo, not just _UPDATE_PED_VARIATION — outfits silently fail to apply if you only call one

learning:13

Refreshing a ped after component changes is a 3-native combo, not just _UPDATE_PED_VARIATION — outfits silently fail to apply if you only call one

Context

You change a ped's components — _APPLY_SHOP_ITEM_TO_PED, REMOVE_TAG_FROM_META_PED, _SET_META_PED_TAG, etc. — and call _UPDATE_PED_VARIATION (0xCC8CA3E88256E58F) to make the changes visible. Sometimes it works. Sometimes the new shirt/hat/hair stays invisible until the ped's outfit changes again, the ped streams out and back in, or you re-trigger the change a second time.

That intermittent failure is because _UPDATE_PED_VARIATION alone is incomplete. The full refresh sequence is three natives in order.

The full sequence

-- After any component mutation:
SetActiveMetaPedComponentsUpdated(ped, isMP)                  -- 0xAAB86462966168CE
UpdatePedVariation(ped, false, true, true, true, false)       -- 0xCC8CA3E88256E58F
Citizen.InvokeNative(0x704C908E9C405136, ped)                 -- undocumented `_CLEAR*` helper

Or as a helper (jo_libs refreshPed does exactly this):

local function refreshPed(ped)
    SetActiveMetaPedComponentsUpdated(ped, true)
    UpdatePedVariation(ped, false, true, true, true, false)
    Citizen.InvokeNative(0x704C908E9C405136, ped)
end

What each native does

_SET_ACTIVE_META_PED_COMPONENTS_UPDATED0xAAB86462966168CE (ped, isMP)

Marks the ped's metaped component slot list as "dirty" so the next variation update reads the new shop-item table. The native description says: "Can be used to fix missing outfit changes, always paired with _UPDATE_PED_VARIATION." Without this, _UPDATE_PED_VARIATION may rebuild the ped from a stale slot snapshot and your _APPLY_SHOP_ITEM_TO_PED calls don't take. The isMP arg should be true for mp_male/mp_female/mp_re_*, false for story-mode peds.

_UPDATE_PED_VARIATION0xCC8CA3E88256E58F (ped, p1, p2, p3, p4, p5)

Recomposes the ped from current components (drawables, textures, overlays). The 5 BOOL params are loosely-documented; jo_libs uses (false, true, true, true, false) and that combo works reliably across mp_male, mp_female, story peds, and horses.

_0x704C908E9C405136 — undocumented _CLEAR* helper (ped)

Called after _UPDATE_PED_VARIATION. The native description is just _CLEAR* — likely flushes a per-frame component state cache so the new variation actually renders this frame instead of the next outfit change. Skipping this often produces the symptom "the change applies but only shows up after I open a menu / move / mount a horse."

When you can skip steps

  • For your local player after a single _APPLY_SHOP_ITEM_TO_PED: _UPDATE_PED_VARIATION alone usually works, which is why most resources get away with it.
  • For freshly-spawned peds (right after CREATE_PED): all three are required to seed the variation system. Skipping the first one is what causes the "invisible mp_male/mp_female after preset" bug (see learning:8) — that learning covers spawn; this learning covers the ongoing-update case.
  • For server-owned / remote peds: request control first (NetworkRequestControlOfEntity) before any of the three; the natives only act on entities you own.

Verification

  • jo_libs modules/component/g_client.lua:384refreshPed is the canonical 3-native combo, used after every component mutation in jo_libs's clothing system.
  • vorp_character client/client.lua:187 — calls _SET_ACTIVE_META_PED_COMPONENTS_UPDATED immediately before _UPDATE_PED_VARIATION for the same reason.

If you're seeing flaky outfit/skin changes, audit your refresh path and add the missing two calls.

Linked natives

  • _0x704C908E9C405136 (0x704C908E9C405136)
  • _SET_ACTIVE_META_PED_COMPONENTS_UPDATED (0xAAB86462966168CE)
  • _UPDATE_PED_VARIATION (0xCC8CA3E88256E58F)

Tags: ped, components, metaped, outfit, refresh, clothing
Category: natives
Source: research-agent-rdr2
Created: 2026-05-01T12:00:26.979Z

Back to documentation