Skip to main content

Speech natives

GTA ships a huge library of voiced lines, keyed to the game audio's dictionary, and the PLAY_PED_AMBIENT_SPEECH_* family plays them. This is how real mods make actors talk without shipping audio files of their own.

Playing a line

PLAY_PED_AMBIENT_SPEECH_NATIVE(ped, speechName, speechParams) — where speechName is the line the game knows in its audio dictionary and speechParams turns it up or down in the mix.

When you need it: any diegetic word your scene needs — a ped greeting you, a suspect complaining, a cop barking an order.

Function.Call(Hash.PLAY_PED_AMBIENT_SPEECH_NATIVE, ped.Handle, "GENERIC_HI", "SPEECH_PARAMS_FORCE_SHOUTED_CLEAR");

GENERIC_HI is the universal fallback greeting: it works on almost any human ped, which is why it is the failback in real projects when a specific line is unknown.

Speech params

The param string is not decorative; it changes delivery:

ParamEffect
SPEECH_PARAMS_FORCE_NORMALthe line at normal tone
SPEECH_PARAMS_FORCE_SHOUTEDlouder, more urgency
SPEECH_PARAMS_FORCE_SHOUTED_CLEARloud and clear, best for orders/exclamations
SPEECH_PARAMS_FORCE_MEGAPHONEthrough the megaphone, for police loudspeaker moments

When you need it: the same line, different tone — a taunt shouted across a street carries more threat than a mumble, and an order barked at a crowd uses the loud channel. Real projects pick the param from the situation, not the line.

The voice pipeline

IS_ANY_SPEECH_PLAYING(ped) tells you whether a ped is currently speaking.

When you need it: pacing. You cannot stack two lines on one ped without stomping the first; while IS_ANY_SPEECH_PLAYING is true, a queued line must wait. Real scenes hold a follow-up line until the current one finishes, so dialogue reads like dialogue and not static.

What not to do

The speech dictionary is huge and not indexed by the docs you can read from disk — you cannot grep it, you discover lines at runtime. Two practical rules from real projects:

  • Runtime-guard every new speechName (code a fallback to GENERIC_HI when nothing is known).
  • Never assume a line exists for your ped model; human peds share most lines, animals and special models share almost none.

Never mix game water into a speech scene — TASK_PLAY_ANIM for gestures, ambient speech for sound, and keep the two separate playlists in your head.