Network IDs/Unique Identifiers

I’m trying to get the ID of a ped and pass it to other clients. I’ve tried using PedToNet, NetworkGetNetworkIdFromEntity, and NETWORK_REGISTER_ENTITY_AS_NETWORKED but everything just returns false.

I thought of using decorators and searching for the ped with one since there is DoesVehicleExistWithDecorator, but sadly there isn’t one for a ped. At least not one named similarly.

I’ve searched through discord chat and the forums, but came up empty. Anybody have any idea what to do just to pass a unique identifier for an entity/ped to another client?

Was the ped created by your script? If not, you might have to register-as-mission-entity.

Its not spawned by the script – just a random ped. Setting it as a mission entity does work. Thank you.

Now, when I do that, they ignore everything. Is there any way to unset them from being a mission entity after some time? I have tried setting as no longer needed (both the entity and ped native), but they keep ignoring everything and don’t resume wandering around after I stop them. They also ignore police sirens, which I don’t want them to do.

TASK_WANDER? No idea if this’ll migrate to other players, though.

that’s odd

From what I have seen, if a ped is set as a mission entity, they keep doing whatever current task they have (wandering for example). Their task can also be changed to just stand there by my script and the game engine won’t take it back over and make them wander again. They literally ignore everything unless a script tells them to do it. I like that, however, I only want it temporarily. TASK_WANDER does work, but they still don’t react to anything else.

There’s no way to remove that status of being a mission entity?

I use this to set it:

    SetEntityAsMissionEntity(poPed, true, true)

I have tried these to remove it, no luck:

SetEntityAsMissionEntity(poPed, false, false) Citizen.InvokeNative(0xB736A491E64A32CF, Citizen.PointerValueInt(poPed)) Citizen.InvokeNative(0x2595DD4236549CE3, Citizen.PointerValueInt(poPed))