> For the complete documentation index, see [llms.txt](https://tgiann.gitbook.io/tgiann/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://tgiann.gitbook.io/tgiann/scripts/tgiann-npc-guide/configs/config.lua.md). Agents can also search and read this documentation through its [MCP server](https://tgiann.gitbook.io/tgiann/~gitbook/mcp).

# config.lua

NPC definitions: model, position, interaction distances, dialogue lines, cooldown, story order, camera, voice and browser TTS settings. Every text field accepts a plain string or a language table. `tts.lang` and `tts.voiceHint` accept a language table too, so the browser voice follows the player's language.

```lua
tgiCoreExports = exports["tgiann-core"]
config = tgiCoreExports:getConfig()

config.langs = {}

-- Every text field (name, title, lines, stories) is either a plain string or a language table { tr = "...", en = "..." }.
-- The player's language picks the text; a missing language falls back to the default language.
-- Lines and stories carry an `id`: with voice.mode = "files" the audio file is sounds/<npc>/<lang>-<id>.ogg
-- (e.g. sounds/elder/tr-greet_1.ogg, sounds/outlaw/en-queue.ogg). Missing files fall back to browser TTS.

---@type GuideConfig
config.npcGuide = {
    -- Prints debug logs to the console.
    debug = false,

    -- NPCs. `id` is saved per player and keys the story list in configs/configTips.lua.
    npcs = {
        -- Legal side: jobs, licenses, businesses, life in the city.
        {
            id = "elder",
            -- Shown on the name plate.
            name = { tr = "Yaşlı Adam", en = "Old Man" },
            title = { tr = "Şehrin hafızası", en = "The city's memory" },
            model = "a_m_o_genstreet_01",
            coords = vector4(332.24, -219.04, 54.09, 12.37),
            -- Idle scenario while nobody talks to him.
            scenario = "WORLD_HUMAN_STAND_IMPATIENT",
            -- Interaction prompt distances (m).
            maxDistance = 3.0,
            pressDistance = 1.8,
            -- The ped is spawned when the player comes closer than this (m) and removed when they leave.
            spawnDistance = 100.0,

            -- What this NPC says. One line is picked at random from each list.
            lines = {
                greetings = {
                    { id = "greet_1", tr = "Hoş geldin evlat, otur şöyle. Ne öğrenmek istersin?",                         en = "Welcome kid, sit down. What do you want to know?" },
                    { id = "greet_2", tr = "Bak sen, yine geldin. Gel, yanıma otur da biraz konuşalım.",                  en = "Look who is back. Come, sit with me, let us talk a while." },
                    { id = "greet_3", tr = "Bu şehirde herkes koşturur, bir sen durup dinliyorsun. Söyle bakalım evlat.", en = "Everyone in this city runs around, you are the only one who stops to listen. Go on, kid." },
                },
                goodbyes = {
                    { id = "bye_1", tr = "Git bakalım evlat, yolun açık olsun. Aklında tut dediklerimi.", en = "Off you go, kid, safe travels. Keep my words in mind." },
                    { id = "bye_2", tr = "Hadi, seni tutmayayım. Başın sıkışınca beni bulursun.",         en = "Go on, I will not keep you. You know where to find me when you are in trouble." },
                },
                thinking = {
                    { id = "think_1", tr = "Hmm, dur bakayım...",        en = "Hmm, let me think..." },
                    { id = "think_2", tr = "Şimdi, sana ne anlatsam...", en = "Now, what should I tell you..." },
                },
                -- Said instead of a greeting while the player is still on cooldown.
                waitGreetings = {
                    { id = "wait_1", tr = "Yine mi sen evlat? Dilim yoruldu, biraz soluklanayım.",  en = "You again, kid? My tongue is tired, let me catch my breath." },
                    { id = "wait_2", tr = "Otur bakalım ama yeni bir şey bekleme, daha vakit var.", en = "Sit if you like, but do not expect anything new, it is too soon." },
                },
                -- %s = remaining time, e.g. "1h 5m".
                cooldown = { id = "cooldown", tr = "Yorgunum evlat, %s sonra tekrar gel.", en = "I am tired, kid. Come back in %s." },
                nothingLeft = { id = "nothing", tr = "Sana anlatacak yeni bir şeyim kalmadı evlat.", en = "I have nothing new to tell you, kid." },
            },

            -- Seconds a player must wait between two new stories from this NPC (default 1 hour).
            cooldown = 1800,
            -- "sequential": stories are told in config order. "random": a random untold story each time.
            order = "random",
            -- Typewriter speed of the dialogue (ms per character).
            typeSpeed = 28,

            -- Camera that frames the NPC while the conversation is open.
            camera = {
                enabled = true,
                -- Offset from the ped, relative to its heading (x = right, y = forward, z = up).
                offset = vector3(0.55, 1.35, 0.62),
                fov = 38.0,
                transitionMs = 700,
            },

            -- Voice of this NPC.
            --   mode = "files"   -> plays sounds/<folder>/<lang>-<id>.ogg (or .mp3) for every line and story
            --   mode = "browser" -> browser text to speech (settings in `tts`)
            --   mode = "off"     -> silent
            -- fallbackToBrowser: when a file is missing, use browser TTS for that line.
            voice = {
                mode = "files",
                folder = "sounds/elder",
                fallbackToBrowser = true,
            },

            -- Browser text to speech settings (mode = "browser" or file fallback). /npcguidevoices lists the installed voices.
            tts = {
                enabled = true,
                -- BCP 47 tag of the browser voice, per player language. A plain string uses the same voice for every language.
                lang = { tr = "tr-TR", en = "en-US" },
                rate = 0.88,
                pitch = 0.65,
                -- Part of a voice name to prefer, e.g. "Google" or "Microsoft". "" = first voice of the language. Can also be a language table.
                voiceHint = "Google",
            },
        },

        -- Illegal side: robberies, queue, police, escapes. The old man points the player here.
        {
            id = "outlaw",
            name = { tr = "Köprü Altı Pablo", en = "Pablo from under the bridge" },
            title = { tr = "Eski soyguncu", en = "Retired robber" },
            model = "a_m_m_tramp_01",
            coords = vector4(3.28, -1215.07, 26.7, 261.52),
            scenario = "WORLD_HUMAN_SMOKING",
            maxDistance = 3.0,
            pressDistance = 1.8,
            spawnDistance = 100.0,

            lines = {
                greetings = {
                    { id = "greet_1", tr = "Seni yaşlı adam mı yolladı? Otur, etrafa bakma. Ne bilmek istiyorsun?", en = "Did the old man send you? Sit down, stop looking around. What do you want to know?" },
                    { id = "greet_2", tr = "Köprünün altında konuşulanlar köprünün altında kalır. Söyle bakalım.",  en = "What is said under the bridge stays under the bridge. Go ahead." },
                    { id = "greet_3", tr = "Yine sen. Para kokusu mu aldın? Kulağını aç.",                          en = "You again. Smelled money, did you? Listen close." },
                },
                goodbyes = {
                    { id = "bye_1", tr = "Hadi git, görüşmedik bile. Dikkatli ol.",    en = "Go on, we never talked. Be careful." },
                    { id = "bye_2", tr = "Yakalanırsan adımı anma. Yolun açık olsun.", en = "If they catch you, you never heard my name. Good luck." },
                },
                thinking = {
                    { id = "think_1", tr = "Dur, sesini alçalt...",           en = "Hold on, keep it down..." },
                    { id = "think_2", tr = "Bak şimdi, bunu kimse bilmez...", en = "Now listen, nobody knows this..." },
                },
                waitGreetings = {
                    { id = "wait_1", tr = "Az önce konuştuk, unuttun mu? Fazla konuşan yanar.", en = "We just talked, or did you forget? Talk too much and you burn." },
                    { id = "wait_2", tr = "Sık gelme buraya, göze batarsın. Sonra uğra.",       en = "Do not come around this often, you draw eyes. Stop by later." },
                },
                cooldown = { id = "cooldown", tr = "Bugünlük bu kadar, %s sonra gel. Fazla konuşan yanar.", en = "That is it for now, come back in %s. Talk too much and you burn." },
                nothingLeft = { id = "nothing", tr = "Bildiğim her şeyi anlattım. Gerisi sende.", en = "I told you everything I know. The rest is on you." },
            },

            cooldown = 3600,
            order = "random",
            typeSpeed = 24,

            camera = {
                enabled = true,
                offset = vector3(0.55, 1.35, 0.62),
                fov = 38.0,
                transitionMs = 700,
            },

            -- Voice of this NPC.
            --   mode = "files"   -> plays sounds/<folder>/<lang>-<id>.ogg (or .mp3) for every line and story
            --   mode = "browser" -> browser text to speech (settings in `tts`)
            --   mode = "off"     -> silent
            -- fallbackToBrowser: when a file is missing, use browser TTS for that line.
            voice = {
                mode = "files",
                folder = "sounds/outlaw",
                fallbackToBrowser = true,
            },

            -- Browser text to speech settings (mode = "browser" or file fallback). /npcguidevoices lists the installed voices.
            tts = {
                enabled = true,
                lang = { tr = "tr-TR", en = "en-US" },
                rate = 0.95,
                pitch = 0.5,
                voiceHint = "Google",
            },
        },
    },
}
```
