ES-Dialogue is a comprehensive NPC dialogue system for FiveM servers. It allows server owners to create interactive NPCs with custom dialogue options that can trigger various server and client events.
## Features
- Easy to configure NPC spawning
- Interactive dialogue system with multiple response options
- Support for multiple frameworks (QBCore, ESX)
- Dynamic mugshot generation from NPC models
- Customizable NPC appearances and animations
- Event-based interactions for shop systems, quests, and more
2. Installation
Prerequisites
FiveM Server (Not mandatory, but there is a choice of sample config)
QBCore or ESX Framework (Not mandatory, but there is a choice of sample config)
Standalone (The code is actually standalone, you can only select default ESX - QBCore in controls such as item export)
3. Configuration
## 4. NPC System
Locations = {
{
coords = vector3(29.49, -1345.12, 29.5), -- NPC position
id = "market_npc", -- Unique identifier
name = "Shop Owner", -- Display name
avatar = "", -- Custom avatar (optional)
message = "Welcome to my store!", -- Default greeting
color = "#55aaff", -- Theme color
model = "a_m_y_business_03", -- Ped model
heading = 250.0, -- Facing direction
scenario = "WORLD_HUMAN_CLIPBOARD", -- Animation
-- Additional options...
},
-- More NPCs...
}
NPCs are defined in the Config.Locations table. Each NPC can have unique properties:
Configuration
Framework Configuration
ES-Dialogue supports multiple frameworks. Configure your framework in the shared.lua file:
NPCs are defined in the Config.Locations table. Each NPC can have unique properties:
Locations = {
{
coords = vector3(29.49, -1345.12, 29.5), -- NPC position
id = "market_npc", -- Unique identifier
name = "Shop Owner", -- Display name
avatar = "", -- Custom avatar (optional)
message = "Welcome to my store!", -- Default greeting
color = "#55aaff", -- Theme color
model = "a_m_y_business_03", -- Ped model
heading = 250.0, -- Facing direction
scenario = "WORLD_HUMAN_CLIPBOARD", -- Animation
-- Additional options...
},
-- More NPCs...
}
4. NPC System
The NPC will face the player
Text will appear above the NPC
An interaction prompt will be displayed
Pressing E opens
Players can interact with NPCs by approaching them and pressing E. When in range:
NPC Interactions
Custom appearance (model)
Unique position and heading
Idle animations (scenarios)
Interactive text display
Custom dialogue options
ES-Dialogue automatically spawns NPCs defined in your configuration. Each NPC can have:
Creating NPCs
NPC System
5. Dialogue System
Configuring Dialogues
Each NPC can have multiple dialogue options configured throughn text value = "buy_fooifier type =d", -- Unique option identifier type = -- Event type:server "server" or "client" trigger = "servervent to -- Arguments trigger args = { -- Arguments type = action = "ich", buy", item = "sandwich", count = 1 } }, -- More options... }ue options can trigger:
Server events (for purchases, quest progress, etc.)
Events receive the configured args object, allowing for dynamic responses.
7. Examples
exports['es-dialogue']:ShowNPCDialog({
id = "npc_id", -- NPC identifier
name = "NPC Name", -- Display name
avatar = "path/to/avatar", -- Optional
message = "Hello player!", -- Greeting message
color = "#55aaff", -- Theme color
options = { -- Response options
-- Options configuration
}
})
client.lua (exit)
exports['es-dialogue']:CloseNPCDialog()
server.lua (example trigger)
RegisterServerEvent('server:eyestore')
AddEventHandler('server:eyestore', function(args)
local src = source
local Player = Framework.Functions.GetPlayer(src)
-- Handle different item types
if args.type == "food" then
Config.Add(Player, args.item, args.count)
-- Additional item types...
end
end)
shared.lua
{
coords = vector3(29.49, -1345.12, 29.5),
id = "market_npc",
name = "Shop Owner",
message = "Welcome to my store! How can I help you today?",
color = "#55aaff",
model = "a_m_y_business_03",
heading = 250.0,
scenario = "WORLD_HUMAN_CLIPBOARD",
drawText = {
text = "~b~Shop Owner",
yOffset = 1.0,
},
options = {
{
label = "Buy Sandwich",
value = "buy_food",
type = "server",
trigger = "server:eyestore",
args = { type = "food", item = "sandwich", count = 1 },
},
{
label = "Ask About Prices",
value = "ask_prices",
type = "client",
trigger = "fck:client",
args = {}
},
}
}