#Need help with synced scenes

1 messages · Page 1 of 1 (latest)

sonic flax
#

Trying to make some synced scene work
The synced scene comes from the casino heist and is the small safe.

Now I do this in a custom MLO which also has this safe.
It finds the safe with GetClosestObjectOfType but i cant seem to make it work with the animation and my offset in not infront of the safe but i get teleported offcenter

Now i tried to get help form chatgpt but that didnt seem to work 🤣

Code in second message

#
function MiniSafeAnim(heading)
    local animDict = "anim_heist@arcade_property@arcade_safe_open@male@"
    if GetGender() == 1 then
        animDict = "anim_heist@arcade_property@arcade_safe_open@female@"
    end
    
    RequestAnimDict(animDict)
    while not HasAnimDictLoaded(animDict) and timeout > 0 do
        Wait(50)
    end
    local ped = PlayerPedId()
    local targetPosition = GetEntityCoords(ped)
    local targetRotation = GetEntityRotation(ped)

    local door = GetClosestObjectOfType(targetPosition.x, targetPosition.y, targetPosition.z, 5.0, -1992154984, false, false, false)
    if not DoesEntityExist(door) then
        print("Safe door not found!")
        return
    end
   NetworkRequestControlOfEntity(door)
    SetCurrentPedWeapon(ped, GetHashKey("WEAPON_UNARMED"), true)
    SetEntityAsMissionEntity(door, true, true)
    FreezeEntityPosition(ped, true)
    local netScene = NetworkCreateSynchronisedScene(
        targetPosition.x, targetPosition.y, targetPosition.z, 
        targetRotation.x, targetRotation.y, targetRotation.z, 
        2, false, false, -1, 0, 1.0
    )
    NetworkAddPedToSynchronisedScene(ped, netScene, animDict, "safe_open", 1.5, -4.0, 1, 16, 1148846080, 0)
   NetworkAddEntityToSynchronisedScene(door, netScene, animDict, "safe_open_safedoor", 1.0, 1.0, 1)

    NetworkStartSynchronisedScene(netScene)
    Wait(GetAnimDuration(animDict, "safe_open") * 1000)

    local netScene2 = NetworkCreateSynchronisedScene(
        targetPosition.x, targetPosition.y, targetPosition.z, 
        targetRotation.x, targetRotation.y, targetRotation.z, 
        2, false, false, -1, 0, 1.0
    )
    NetworkAddPedToSynchronisedScene(ped, netScene2, animDict, "safe_close", 1.5, -4.0, 1, 16, 1148846080, 0)
    NetworkAddEntityToSynchronisedScene(door, netScene2, animDict, "safe_close_safedoor", 1.0, 1.0, 1)
   NetworkStartSynchronisedScene(netScene2)
   Wait(GetAnimDuration(animDict, "safe_close") * 1000)
    FreezeEntityPosition(ped, false)
end
frigid tartan
#

Have you found the solution?

proven pond