Attaching an entity with AttachEntityToEntity
, then later using DetachEntity
will cause the resource to lose ownership of the entity when using “use_experimental_fxv2_oal”.
Using DoesEntityBelongToThisScript
without oal will return 1
each time.
With oal, it will return true
the first two times.
CreateThread(function()
local model = `hei_prop_heist_thermite`
RequestModel(model)
Wait(0)
local entity = CreateObject(model, 0.0, 0.0, 0.0, true, true, false)
SetModelAsNoLongerNeeded(model)
print(DoesEntityExist(entity), DoesEntityBelongToThisScript(entity, true))
AttachEntityToEntity(entity, PlayerPedId(), GetPedBoneIndex(PlayerPedId(), 28422), 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, false, false, false, false, 2, true)
print(DoesEntityExist(entity), DoesEntityBelongToThisScript(entity, true))
Wait(500)
DetachEntity(entity, true, true)
print(DoesEntityExist(entity), DoesEntityBelongToThisScript(entity, true))
DeleteEntity(entity)
end)
DeleteEntity fails since the script does not own the entity.