📃Usage
Here's how to use the export
Export
-- npcName = "string"
-- reputation.show = boolean or nil, reputaion.amount = number
-- question = "string"
-- options = table
-- id = "string"
-- label = "string"
-- closeDialogue = boolean
-- nextDialogue = table
exports["Forosty-Dialogue"]:openDialogue(ped, {
npcName = npcName,
reputation = { show = show, amount = amount },
question = question,
options = {
{
id = id,
label = label,
closeDialogue = closeDialogue,
nextDialogue = {
question = question,
options = {
{ id = id, label = label, closeDialogue = closeDialogue },
}
}
},
{ id = id, label = label, closeDialogue = closeDialogue }
}
}, function(option)
if option.id == id then
print(option.id)
end
end)
Example usage
-- This creates an npc and instantly starts a dialogue with him on resource start
CreateThread(function()
local model = `a_m_m_skater_01`
RequestModel(model)
while not HasModelLoaded(model) do
Wait(1)
end
local pedCoords = vec4(-1530.7135, -531.3727, 71.2972, 307.1406)
local npcPed = CreatePed(1, model, pedCoords.xyzw, false, false)
SetEntityInvincible(npcPed, true)
FreezeEntityPosition(npcPed, true)
exports["Forosty-Dialogue"]:openDialogue(npcPed, {
npcName = "Old Librarian",
reputation = { show = true, amount = 90 },
question = "Welcome to the library! Do you need help finding a book?",
options = {
{
id = "yes",
label = "Yes, please help me.",
closeDialogue = false,
nextDialogue = {
question = "Great! Which section are you interested in?",
options = {
{ id = "history", label = "History", closeDialogue = true },
{ id = "science", label = "Science", closeDialogue = true },
}
}
},
{ id = "no", label = "No, thank you.", closeDialogue = true }
}
}, function(option)
if option.id == "history" then
print("Librarian: Follow me to the history section.")
elseif option.id == "science" then
print("Librarian: Science section is right this way.")
elseif option.id == "no" then
print("Librarian: Very well, feel free to browse around.")
end
end)
end)
Last updated