Peds natives
Most GTA mechanics are one line of code. The hard part is actors that misbehave — stopping to smoke mid-scene, getting hit by a car while you script an arrest, or simply running away. These are the natives that show up again and again in real modding code to keep a scene's actors under control.
Making a ped a real character
SET_BLOCKING_OF_NON_TEMPORARY_EVENTS(ped, true) tells the game not to interrupt the ped with ambient reactions — it won't stop walking to admire a fistfight or flee a scuffle your script started.
When you need it: any choreographed moment where the ped must obey your task queue and nothing else: dragging a body, holding a position while you set up the scene, escorting a suspect. It is the single most frequent native in real modding codebases for a reason — without it, every scene is a coin flip.
Function.Call(Hash.SET_BLOCKING_OF_NON_TEMPORARY_EVENTS, ped.Handle, true);
Function.Call(Hash.SET_PED_KEEP_TASK, ped.Handle, true);
SET_PED_KEEP_TASK(ped, true) is the second half: once the scene ends, reset both, or the ped stays frozen forever.
Config flags
SET_PED_CONFIG_FLAG(ped, flagId, value) toggles dozens of built-in ped behaviors. Real projects use it heavily — for instance giving a ped perfect accuracy, making it ignore attacks, or keeping it facing the player.
When you need it: "turn the extra behaviors off" flags (72/PED_FLAG_EXTRA_LONG_RANGE_WEAPON_ATTACKS, 89/CAN_BE_TARGETED) and "lock the ped into its task" flags. Each flag needs a reason; don't flip flags speculatively.
Health, injury and the floor
SET_PED_HEALTH, ADD_ARMOUR_TO_PED and SET_PED_CAN_RAGDOLL manage survival; SET_PED_TO_RAGDOLL(ped, time1, time2, ragdollType, ...) triggers a scripted collapse.
When you need it: the moment a scene hands over to damage the wrong way. A suspect you want cuffed but not dead needs health clamped and ragdoll controlled; a takedown needs a real fall, not a teleport to the ground. Check IS_PED_RAGDOLL(ped) before stacking more tasks on a pile of limbs.
Function.Call(Hash.SET_PED_TO_RAGDOLL, player.Handle, 1000, 1000, 0, false, false, false);
Sanity checks before acting
GET_PED_TYPE(ped), IS_PED_HUMAN(ped), IS_PED_GETTING_UP(ped) decide if you may act at all.
When you need it: guarding your own choreography. You cannot escort a ped that is currently getting up from a takedown, and you should not start a conversation with a cop ped. Every real state machine gates its next state on what the ped is actually doing, never on assumption.
What not to do
Mission peds (SET_ENTITY_AS_MISSION_ENTITY — covered in its own fiche) are powerful but sticky: they must be explicitly released, or your scene leaks peds into the world. And never touch peds you did not spawn or claim — another mod's actor is another mod's problem.