To give a bit of context, I’m working on a script which allows paramedics to revive AI peds which have been killed/incapacitated. I have no issues with the script besides the one I’m currently struggling with. After the ped is revived (Through the use of ResurrectPed(), which works) and all tasks are cleared (So they don’t remain frozen in mid-air). I then set the entity’s coords. This is where it gets kinda odd…
If I set the ped’s coords directly where they were prior to being ‘revived’, they simply fall through the ground. If I set them a bit higher (2.0 for example), the ped falls those 2 meters, hits the ground like he/she made the landing, then continues falling through the ground. I can never get the ped to simply stand on the ground. This is the current code I have:
respawnLoc = GetEntityCoords(revPed) ResurrectPed(revPed) SetEntityHealth(revPed, 200) SetEntityCoords(revPed, respawnLoc.x, respawnLoc.y, respawnLoc.z + 1.0) ClearPedTasksImmediately(revPed)
What I’ve tried:
- Re-arranging all the various functions to see any differences
- Freezing the ped in place for a moment (This makes the ped stay on the ground, but even setting them directly on the ground, the ped will fall over and eventually hold their stomach and die)
- Changing the Z value (No effect on falling through ground)
So I guess my question is… How can I ‘teleport’ an AI ped and not have them fall through the ground and/or fall on the ground in agony?
I will try to attach footage if I can get it.