Streamed YTYP works only after disconnect / reconnect

Here is the resource used to reproduce the bug : props.zip (1.1 MB)

The YTYP lr_prop_boathousedoor.ytyp is used to put object definitions.

Code used to spawn object :

function SpawnObject(model, coords, cb)

  local model = (type(model) == 'number' and model or GetHashKey(model))

  Citizen.CreateThread(function()

    RequestModel(model)

    while not HasModelLoaded(model) do
      Citizen.Wait(0)
    end

    local obj = CreateObject(model, coords.x, coords.y, coords.z, true, false, true)

    if cb ~= nil then
      cb(obj)
    end

  end)

end

When I first load the game, I try to spawn my object ‘snail’ and nothing happens.

but the YTYP seems to be detected by FiveM :

-- CitizenFX.log
  59406] coll open compcache:/props/lr_prop_boathousedoor.ytyp

Then I hit ESCAPE => Disconnect and I click on localhost menu item

Doing same thing and boom ! object can be spawned :

try adding https://wiki.fivem.net/wiki/Resource_manifest#this_is_a_map to the __resource.lua and see if that fixes it.

Thank you for the reply.

Same problem, I also tried to make a separate resource ‘props_def’ with this_is_a_map ‘yes’ and the ytyp in the stream folder but no luck.

Ok, I solved my problem using data_file ‘DLC_ITYP_REQUEST’, I tried this one a while ago without success because I had the reflex to put data_files outside stream folder, but for this particulat data_file type it HAS TO be in the stream folder.

2 Likes