Unset as Mission Entity

Once you set a ped as a mission entity, they become dumb and do only what you tell them to do. However, I would like them to resume their normal behavior once I am done with them.

I have explained a little bit here ( Network IDs/Unique Identifiers ). I would like them to go back to how they were as if I had never set them as a mission entity. I have thought of spawning a new ped, but wouldn’t that just automatically set them as a mission entity or something like it?

If anyone can help, it would be so greatly appreciated. Been trying to solve this for ages.

Instead of setting as mission entity I assign a default task and set that task in a loop. The loop only breaks when I assign another task or when I’m done with the ped and it resumes doing normal ped things.

That sounds like a great idea and solves one of my problems. However, the other part of the problem is that I need to get that specific ped ID to other clients. The IDs are not the same on every client. The only way I know possible to get the same ped on all clients is to set as a mission entity and send the network ID, etc. (From the topic I linked above).

Do you know if there is any other way around that?

Edit: Did a quick look over the native db. Which native would be used to retain that default task? PED::SET_PED_KEEP_TASK, I assume?

The IDs are not the same but the location is. So you can pass the location of a ped instead of a handle or ID. Then:


local function GetEntityAtCoords(pos)
    local thisRay = CastRayPointToPoint(pos.x, pos.y, pos.z, pos.x, pos.y, pos.z, 10, 0, 0)
    local A,B,C,D,Ent = GetRaycastResult(thisRay)
    return Ent 
end
1 Like

Can’t believe I didn’t even think of that. Such a simple thing to do. Thank you.

Is that the proper native to use in my previous post?

I don’t know, I didn’t use that native.

What native do you use to keep the “default” task?

So when I interact with a ped, the “default task” stand still is in a loop. The loop runs while the task is default. I assign a different task (like hands up), which breaks the loop. When I’m done with the different task, I set task back to default which continues the loop. When I’m done with my interaction I break out of the loop to let the ped go about its business.

Ok, that makes sense. I’ll give it a shot when I get home. Thanks.