Standalone NPC Interaction, NPC Dialogue, TalkToNPC with ChatGPT

Introducing the best NPC Interaction Script for Fivem!
Our feature-rich solution is the perfect addition to any server looking to upgrade their NPC interaction options.

Here’s what you can expect from our top-of-the-line script:

  • High Performance (Idle 0.0ms Server & Client)
  • Responsive design that looks great on all resolutions (CSS editable)
  • Discord webhook when question is asked
  • Responsive design that looks great on all resolutions
  • Toggle AI for specific questions
  • Clear history function for seamless use
  • Customizable NPC creation with personalized name, actions, and blip
  • Event triggers for an interactive experience

Our customizable configuration options allow you to tailor the NPC Dialogue Script to your exact needs, including:

  • Language settings for both front-end and back-end
  • Ability to add more unique NPCs
  • Customizable help notifications to meet your specific needs

Client:

ES_C = {}

ES_C.language = {
    ['action_to_open'] = 'Press ~INPUT_CONTEXT~ to talk to %s'
}

ES_C.DisplayHelpText = function(str)
    SetTextComponentFormat("STRING")
	AddTextComponentString(str)
	DisplayHelpTextFromStringLabel(0, 0, 1, -1)

    --[[
        You can also include your own HelpText.
        Just remove the functions above and insert your own Trigger.
    ]]
end

ES_C.npcs = {
    {
        ['name'] = 'Apoysus',
        ['location'] = vector3(99.4506, -1318.6749, 29.2915),
        ['npc'] = {
            ['heading'] = 130.6957,
            ['model'] = "g_m_y_ballaeast_01",   
        },
        ['blip'] = {
            ['enabled'] = true,
            ['name'] = 'Test NPC',
            ['sprite'] = 1,
            ['scale'] = 0.8,
            ['colour'] = 50,
            ['display'] = 2
        },
        ['firstmessage'] = 'This is an Test NPC. Script created by Apoysus#0001 discord.gg/essential-studios',
        ['actions'] = {
            {
                -- example with all features included.
                ['title'] = 'Nearest Shop?',
                ['request'] = 'Could you show me the  Nearest Shop?',
                ['response'] = 'Sure i can show you the nearest shop. I marked it on your map.', -- If there is an issue with the OpenAI API, or if a prompt is not included, or if OpenAI is deactivated, then this will be sent.
                ['prompt'] = 'Rewrite following message: Sure i can show you the nearest shop. I marked it on your map. You are Roleplaying. Rewrite it in the language it is given. Act as you have a good mood. Please show that mood in the message. just give me the message! Nothing else. You can add some stuff that fits the message.', -- rephrase prompt. you can use it for other answers.
                ['events'] = {
                    {
                        ['is'] = 'c',
                        ['event'] = 'es_npcdialog:close'
                    }
                },
                ['events_delay'] = 2000 -- Trigger Events 2 sec. after message got generated.
            },
            {
                -- You can choose not to use any event by not including ['events'].
                ['title'] = 'Tell me a joke',
                ['request'] = 'Could you tell me a joke?',
                ['response'] = 'I am currently not availabe for jokes.',
                ['prompt'] = 'Could you tell me a joke?',
            },
            {
                -- You can choose not to use AI-generated text by not including ['prompt'].
                ['title'] = 'What is the Server Name',
                ['request'] = 'Server Name?',
                ['response'] = 'Your Roleplay Server.',
            }
        }
    }
    --[[
        -- template for new npc
        {
        ['name'] = 'Amir',
        ['location'] = vector3(99.4506, -1318.6749, 29.2915),
        ['npc'] = {
            ['heading'] = 130.6957,
            ['model'] = "g_m_y_ballaeast_01",   
        },
        ['blip'] = {
            ['enabled'] = true,
            ['name'] = 'Amir',
            ['sprite'] = 1,
            ['scale'] = 0.8,
            ['colour'] = 50,
            ['display'] = 2
        },
        ['firstmessage'] = 'Hello Stranger! How can i help you today?',
        ['actions'] = {
            {
                ['title'] = 'Tell me a joke',
                ['request'] = 'What is FiveM?',
                ['response'] = 'Idk ask someone else.', -- If there is an issue with the OpenAI API, or if a prompt is not included, or if OpenAI is deactivated, then this will be sent.
                ['prompt'] = 'What is FiveM?',
                ['events'] = {
                    ['is'] = 'c',
                    ['event'] = 'es_npcdialog:close'
                }
            },
        }
    }
    ]]
}

Server:

ES_S = {}

ES_S.openai = {
    ['enabled'] = true,
    ['api_key'] = 'KEY_HERE',
    ['temperature'] = 1,
    ['max_tokens'] = 256,
    ['top_p'] = 1,
    ['frequency_penalty'] = 0,
    ['presence_penalty'] = 0
}

ES_S.discord_webhook = {
    ['enabled'] = true,
    SendDiscordWebhook = function(message, playerName, source, events)
        local embeds = {
            {
                title = 'NPC Dialogue',
                description = message,
                color = 15158332,
                thumbnail = {
                    url = 'https://i.imgur.com/txHlIpt.png'
                },
                fields = {
                    {
                        name = 'Player',
                        value = playerName,
                        inline = true
                    },
                    {
                        name = 'Source',
                        value = source,
                        inline = true
                    }
                }
            }
        }
    
        if events and #events > 0 then
            local eventsField = {
                name = 'Events',
                value = '',
                inline = false
            }
            for i, event in ipairs(events) do
                eventsField.value = eventsField.value .. '- `' .. event.is .. '` ' .. event.event .. '\n'
            end
            table.insert(embeds[1].fields, eventsField)
        end
    
        PerformHttpRequest("WEBHOOK_HERE", function(statusCode, response, headers)
        end, 'POST', json.encode({username = 'NPC Dialogue', embeds = embeds}), {['Content-Type'] = 'application/json'})
    end
}

HTML:

{
    "locale": {
        "ui_header": "Dialogue",
        "ui_header_sub": "with",
        "ui_description": "Lorem ipsum dolor sit amet consectetur adipisicing elit. Ducimus reiciendis nam nisi accusamus repellendus error eligendi qui dolor dolorem molestiae.",
        "clear_conversation": "Clear Conversation",
        "exit": "exit"
    },
    "user_icon": "ri:user-4-fill"
}

Compatible with Everything, Script is Standalone.
The script is protected and secured by Tebex.

Check out our preview to see the NPC Dialogue Script in action.
Click here

And for just 15,00 EUR (including Tebex fees), you can elevate your server’s NPC interaction options with the best script on the market.
Click here

Code is accessible         No
Subscription-based         No
Lines (approximately)      2000+
Requirements               Nothing        
Support                    Yes               
7 Likes

OP request