- Documentation
- Server functions
- setPedVoice
Function
setPedVoice
Stores a voice bank type and name for a ped (e.g. type "PED_TYPE_GEN" and name "VOICE_GEN_BBDYG1"). The value is for scripts and comes back from getPedVoice; the Definitive Edition game does not change the ped's lines based on it yet. Custom lines can be played with playPedVoiceLine and a client script.
Syntax
bool setPedVoice(ped ped, string voiceType, string voiceName)Arguments
pedped- A player or an NPC.
voiceTypestring- Voice bank type, e.g.
"PED_TYPE_GEN". voiceNamestring- Voice bank name, e.g.
"VOICE_GEN_BBDYG1".
Returns
true on success.
Example
setPedVoice(npc, "PED_TYPE_GEN", "VOICE_GEN_BBDYG1")
Notes
State for scripts. The server stores the voice, but the game does not change the ped's lines based on it yet.
See also
getPedVoiceReturns the voice bank type and name stored withsetPedVoice. Returnsfalsewhen no voice was set.resetPedVoiceRemoves the voice stored withsetPedVoice, i.e. returns the ped to its model's original voice. AfterwardsgetPedVoicereturnsfalse.playPedVoiceLineSends every player theonClientPedVoiceevent with the ped and the line name. The function itself does not play any sound: a client script plays the line, e.g. withplaySound3Dfrom a resource sound file attached to the ped. This lets you build custom NPC dialogue heard by everyone nearby.