Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Networked peds ragdoll and play injured animation when migrated from owner/owner changes when shot #2986

Open
BennoArnautovic opened this issue Dec 7, 2024 · 0 comments
Labels
bug triage Needs a preliminary assessment to determine the urgency and required action

Comments

@BennoArnautovic
Copy link

BennoArnautovic commented Dec 7, 2024

What happened?

Networked peds play dead/ragdoll animation, slide in it over the floor and change owner upon being shot.

Expected result

For ped to behave same as it is being shot by its current owner/to behave same when once set

Reproduction steps

  1. Find 2 players or cl2
  2. Setup command
RegisterCommand("test_ped", function()
    local ped = PlayerPedId()
    local coords = GetEntityCoords(ped)

    local new_data = {
        model = `U_M_Y_Zombie_01`,
        zombie = 0,
        spawn_coords = vector4(coords.x, coords.y, coords.z, GetEntityHeading(ped)),
        times_killed = 1,
    }

    RequestModel(`U_M_Y_Zombie_01`)
    while not HasModelLoaded(`U_M_Y_Zombie_01`) do print("Waiting for model to load") Wait(0) end

    new_data.zombie = CreatePed(26, `U_M_Y_Zombie_01`, new_data.spawn_coords.x, new_data.spawn_coords.y, new_data.spawn_coords.z, new_data.spawn_coords.w, true, true)
    while not DoesEntityExist(new_data.zombie) do print("Waiting for ped to spawn") Wait(0) end

    new_data.network_id = PedToNet(new_data.zombie)
    while not NetworkDoesNetworkIdExist(new_data.network_id) do print("Waiting for network id to exist") Wait(0) end

    SetNetworkIdCanMigrate(new_data.network_id, false)
    SetEntityInvincible(new_data.zombie, false)
    SetEntityMaxHealth(new_data.zombie, 10000)
    SetPedMaxHealth(new_data.zombie, 10000)
    SetEntityHealth(new_data.zombie, 10000)
    SetPedArmour(new_data.zombie, 10000)
    
    SetEntityInvincible(new_data.zombie, false)
    SetPedSeeingRange(new_data.zombie, 150.0)
    SetPedHearingRange(new_data.zombie, 150.0)
    SetPedAccuracy(new_data.zombie, 100.0)
    SetPedVisualFieldMaxAngle(new_data.zombie, 360.0)
    SetPedVisualFieldPeripheralRange(new_data.zombie, 360.0)
    SetPedSuffersCriticalHits(new_data.zombie, false)
    SetBlockingOfNonTemporaryEvents(new_data.zombie, true)
    SetPedCanRagdoll(new_data.zombie, false)
    SetPedCanRagdollFromPlayerImpact(new_data.zombie, false)
    SetPedRagdollOnCollision(new_data.zombie, false)
    NetworkDisableProximityMigration(new_data.network_id)
    
    SetPedConfigFlag(new_data.zombie, 147, true)
    SetPedConfigFlag(new_data.zombie, 148, true)
    SetPedConfigFlag(new_data.zombie, 430, true)
    SetPedConfigFlag(new_data.zombie, 2, true)
    SetPedConfigFlag(new_data.zombie, 403, true)

    SetPedConfigFlag(new_data.zombie, 231, false)
    SetPedConfigFlag(new_data.zombie, 232, false)
    SetPedConfigFlag(new_data.zombie, 233, false)
    SetPedConfigFlag(new_data.zombie, 234, false)
    SetPedConfigFlag(new_data.zombie, 289, false)

    TaskCombatPed(new_data.zombie, ped, 0, 16)

    local last_owner = 0
    while DoesEntityExist(new_data.zombie) do
        local owner = GetPlayerServerId(NetworkGetEntityOwner(new_data.zombie))
        if owner ~= last_owner then
            last_owner = owner
            new_data.owner = owner

            print("Owner changed to: " .. owner, "Can ped ragdoll?", CanPedRagdoll(new_data.zombie))
        end
        
        TaskCombatPed(new_data.zombie, ped, 0, 16)
        Wait(0)
    end
end, false)
  1. Run the command
  2. Hit spawned zombie few times
  3. make other player hit zombie (entity owner will probably change)
  4. zombie will fall on ground and play animation even if ragdoll and other stuff is disabled. Most of the times he will slide in that animation

Importancy

Unknown

Area(s)

FiveM, OneSync, Natives

Specific version(s)

Fivem/tested from 9875 to 11895,

Additional information

Video 1: https://streamable.com/ifsuf8
Video 2: https://streamable.com/udsm63

@BennoArnautovic BennoArnautovic added bug triage Needs a preliminary assessment to determine the urgency and required action labels Dec 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug triage Needs a preliminary assessment to determine the urgency and required action
Projects
None yet
Development

No branches or pull requests

1 participant