getAmbientPedCivilianCoupleCandidate
Client-side
Ask GTA for two compatible civilian skins and nearby path positions that can spawn together as a walking couple.
Syntax
table|false, string? getAmbientPedCivilianCoupleCandidate(Vector3 origin)Arguments
originVector3Finite world position around which GTA should look for the couple.
Returns
A couple table with two member records containing model, ped type, position, direction, path interpolation, heading, and civilian metadata; or false plus a bounded miss reason.
Ownership and lifecycle
Candidate queries create nothing. A multiplayer resource must validate each proposal, create and own the real NPCs and vehicles, assign one current syncer, handle ownership changes, and clean up every element. Native AI and event tokens belong to the calling resource and are revoked when that resource stops.
Important behavior
- The function only proposes a pair and creates nothing. The server must validate the result, create both peds together, and assign one simulation owner.
Example
local couple, reason = getAmbientPedCivilianCoupleCandidate(localPlayer.position)if couple then for _, member in ipairs(couple.members) do outputDebugString(("model %d at %.1f, %.1f, %.1f"):format(member.model, member.x, member.y, member.z)) endendWhere this comes from
SOURCECLuaWorldDefs.cppClient/mods/deathmatch/logic/luadefs/CLuaWorldDefs.cpp INTRODUCED / EXTENDED6cb144d8aRead the commit and why the change was made TEST RESOURCE native-ped-traffic test-resources/native-ped-traffic
RELATED SA:O APIS
Read the system guide → Continue exploring
← Back to the SA:O Lua API · How Synchronized NPCs and road traffic works →