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

Event to make a ragdolled ped get up again (unragdoll) #2290

Closed
mcNuggets1 opened this issue Nov 28, 2023 · 17 comments
Closed

Event to make a ragdolled ped get up again (unragdoll) #2290

mcNuggets1 opened this issue Nov 28, 2023 · 17 comments

Comments

@mcNuggets1
Copy link

There currently does not seem to be any functionality to either ragdoll someone properly without them getting up again automatically after some time (SetPedToRagdoll) or get up from being ragdolled at all!

There is just one variable for time in SetPedToRagdoll THAT can't be reset, even though I was thinking, ResetPedRagdollTimer would do that.
SetPedToRagdoll also twitches the ragdoll, every time, it is applied again.

Calling ClearPedTasks does nothing on a ragdolled player, ClearPedTasksImmediately t-poses the player for a bit and the returns to the base idle animation. (No get up animation whatsoever here)

I would suggest exposing more natives regarding ragdolling or giving some type of way to unragdoll a player atleast.

@Yum1x
Copy link

Yum1x commented Dec 5, 2023

Sounds like a feature request not a issue ¯_(ツ)_/¯

@Disquse
Copy link
Contributor

Disquse commented Dec 6, 2023

I believe you can use RESET_PED_RAGDOLL_TIMER to make ped get out of ragdoll state earlier.

@mcNuggets1
Copy link
Author

I believe you can use RESET_PED_RAGDOLL_TIMER to make ped get out of ragdoll state earlier.

That does not work.

@gottfriedleibniz
Copy link
Contributor

gottfriedleibniz commented Feb 2, 2024

I think clever use of RESET_PED_RAGDOLL_TIMER can still achieve what you are trying to capture: A way to ragdoll indefinitely, or until some condition is met (e.g., no longer knocked out), that allows a proper exiting of the CTaskNMRelax (iirc) task. Hand-waving a bit:

SetPedToRagdoll(PlayerPedId(), 100, 200, 0, false, false, false)
while SomeCondition do
   Wait(0)
   ResetPedRagdollTimer(PlayerPedId())
end

@mcNuggets1
Copy link
Author

ResetPedRagdollTimer does not do anything. It does not stop the last ragdoll timer, the player still gets up after the time configured in SetPedToRagdoll in my tests.

@gottfriedleibniz
Copy link
Contributor

Can you provide an example as to how you are running/testing this?

@mcNuggets1
Copy link
Author

mcNuggets1 commented Feb 28, 2024

SetPedToRagdoll(ped, 1000, 1000, 0, false, false, false) in a 0 wait loop, as otherwise it just does not work. Any value above 10~ seconds also seems to be ignored.
After the loop has ended, I call ResetPedRagdollTimer.

I also found out, that SetPedToRagdoll has instances, in which other players do see the player as standing.

@tens0rfl0w
Copy link
Contributor

tens0rfl0w commented Feb 28, 2024

Using

local timeToRagdoll = 10000
local ped = PlayerPedId()
local ragdoll = true
SetPedToRagdoll(ped, 10, 10, 0, false, false, false)
CreateThread(function()
    while ragdoll do
        Wait(0)
        ResetPedRagdollTimer(ped)
    end
end)
Wait(timeToRagdoll)
ragdoll = false

works perfectly fine for me and achieves exactly what you're asking for.

ResetPedRagdollTimer does not reset the end time of the ragdoll task, but rather resets the start time, making this an infinite task when repeatedly called. (This is also intended to be called every frame)

@mcNuggets1
Copy link
Author

Ah I totally misunerstood the function, it now makes much more sense. Thanks for clarifying that!

@mcNuggets1
Copy link
Author

I tried using it.
It did work for the local player, but for other players the ragdoll is twitching, trying to get up, etc.

@mcNuggets1
Copy link
Author

mcNuggets1 commented Mar 3, 2024

FiveM_cl2_b2944_GTAProcess_gjbQrQtf5V.mp4

It shows this to other players.

@tens0rfl0w
Copy link
Contributor

Works perfectly fine for me. However, if you're trying to reset the ragdoll timer on a remotely owned ped this won't work for obv reasons. This only works on the local player ped or peds the client has network ownership of (working around this limitation in code should be easy though, e.g. network events/state bags/...).

2024-03-04.12-01-11.mp4

@mcNuggets1
Copy link
Author

mcNuggets1 commented Mar 25, 2024

As soon as you hit the ped, it begins twitching and trying to get up, if you dont run EnableBoundAnkles (or whatever).
Even when activated, the player still twitches for others and sometimes for themselves.
Calling SetPedToRagdoll every frame sort of fixes that, but introduces new issues such as desyincing.
I would make a video, but I dont have any software for it, currently.

@mcNuggets1
Copy link
Author

Also the networking is completely broken for ragdolls.
It shows a completely false position sometimes.

@AvarianKnight
Copy link
Contributor

That isn't a bug, physics for peds are completely client sided so where they rag-doll will be different for every client.

@mcNuggets1
Copy link
Author

That isn't a bug, physics for peds are completely client sided so where they rag-doll will be different for every client.

The position of the ped is still corrected for a certain period of time. It just stops after some time.

@mcNuggets1
Copy link
Author

mcNuggets1 commented Jul 1, 2024

NetworkCreateSynchronisedScene needs the player to be not ragdolled to be executed properly.
Here we have a usage for an Unragdoll native now.
ClearPedTasksImmediately takes up to 100ms to properly do it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants