Skip to content

isPedNativeTaskReady

Client-side

Check whether a living, streamed ped has its GTA AI brain back and is ready for a native task call. This is useful just after stream-in or a cutscene rebuild, when the element exists before GTA has finished recreating its intelligence.

Complete example

-- client.lua: wait up to five seconds after a scene
local function sendWhenReady(ped, destination, attempt)
attempt = attempt or 1
if not isElement(ped) or attempt > 100 then return end
if not isPedNativeTaskReady(ped) then
return setTimer(sendWhenReady, 50, 1, ped, destination, attempt + 1)
end
assert(setPedNavigateTo(ped, destination, "run"))
end
sendWhenReady(actor, Vector3(2495, -1680, 13.5))

Syntax

bool isPedNativeTaskReady(ped thePed)

GTA task mapping

NATIVE GTA BEHAVIOR
No CTask is created

This creates no CTask and has no SCM opcode. It checks that GTA has recreated the ped intelligence object required by the script-command task path.

Arguments

thePedped

Ped whose local GTA task system should be checked.

Returns

true when the ped is alive, streamed in, has a native GTA instance, and that instance has ped intelligence; false otherwise.

Ownership and lifecycle

Low-level ped task calls require the client that simulates the living, streamed ped. Driving tasks also require control of the streamed vehicle. They do not create lifecycle handles; the optional native-task-runtime adds server-owned route epochs and reconstruction for drive_to routes. Gang-tag ownership is resource-exclusive, survives object streaming and recreation, and is released automatically when the owner stops.

Important behavior
  • This is a readiness check, not a task-completion event. true says nothing about whether an existing task has started, finished, or reached its destination.
  • Normal ownership rules still apply to the task call that follows. A true result does not make this client the ped syncer.
  • After a stream-in or file-cutscene transition, retry on a later frame while this returns false instead of repeatedly submitting a task that cannot yet be installed.

OOP aliases

  • ped:isNativeTaskReady()

Where this comes from

RELATED SA:O APIS

Continue exploring

Read the system guide →