🗣️HRNPCDialogue

NPC dialogue system with custom design

Installation

  • Download the dependency HRLib

  • Download HRNPCDialogue

  • Write this in your server.cfg: start HRLib start HRNPCDialog

Preview

local config = {}

config.turnOff = { -- Choose the different options to turn off on focus
    minimap = true,
    playerVisibility = true
}

config.transitionDuration = 2500 -- In miliseconds

External Connections

Client Export

exports.HRNPCDialog:startDialogue(targetPed, options, createPed)

Callback

HRLib.Callback('HRNPCDialog:startDialogue', targetPed, options, createPed) -- Client side
HRLib.ClientCallback('HRNPCDialog:startDialogue', targetPed, options, createdPed)

Parameters

  • targetPed: integer?

    • the ped, the camera must be focused on

  • options: HRNPCDialgueOptions

    • dialgue settings/options

  • createPed: { model: string|integer, animation: { dict: string, anim: string }?, coords: vector4 }?

    • feature that allows you to create a ped directly with this function

Example

exports.HRNPCDialog:startDialogue(nil, {
    npcName = 'John Smith',
    questions = {
        {
            label = 'Is John Smith a real name?',
            possibleAnswers = {
                {
                    label = 'Yes, it is',
                    closeOnSelect = true,
                    onSelect = function()
                        print('Wrong Answer!')
                    end
                },
                {
                    label = 'No, it isn\'t',
                    closeOnSelect = true,
                    onSelect = function()
                        print('Correct answer!')
                    end
                }
            }
        }
    },
    onCancel = function()
        print('Don\'t you know the name John Smith?')
    end
}, {
    model = 'a_m_m_eastsa_02',
    animation = { dict = 'mini@strip_club@idles@bouncer@base', anim = 'base' },
    coords = vector4(1404.2367, -1565.6797, 56.4536, 91.8913)
})

Last updated