[ESX][QB][Custom Framework][PAID] - zxn-rpgNPC | RPG-like dialogues with NPCs v1.2.0

Hi everyone! Today I’m releasing one of my scripts, which adds a great interactivity to NPCs.
Now it is updated and supports both ESX and QBCore. It also supports custom frameworks based on ESX or QBCore.

Updates

New Update! Version 1.2.0

  • With this update, you can interact with NPCs using qb-target or QBCore’s HelpText with the help of PolyZones.
Preview

Streamable

Features
  • Low Resmon
    1. Near NPC: 0.01-0.02 ms
    2. Otherwise: 0.00 ms
  • Easy to configure
  • Nested dialogues can be set
  • [NEW] Now you can set both job or gang restriction to a NPC
Example Config

You can change the TextUIFunctions if you don’t want to use “zxn-helpText” (which is my another resource). Change [‘open’] and [‘close’] functions accordingly.

Config = {}

Config.newQB = true -- If your QBCore doesn't have export option, change it to false

Config.InteractKey = 38 -- [E] Key, Keys IDs can be found here: https://docs.fivem.net/docs/game-references/controls/#controls

Config.TextUI = true -- If true it'll open/close Help Text within range

Config.TextUIFunctions = {

    ['open'] = function(message, color, pos)

        exports['zxn-helpText']:OpenHelpText(message,  color, pos)  -- You can change this to make it work with your Help Text script

    end,

    ['close'] = function(message)

        exports['zxn-helpText']:CloseHelpText() -- You can change this to make it work with your Help Text script

    end

}

Config.CameraAnimationTime = 1000 -- Camera animation time in msec: 1000 msec = 1 second

Config.NPCs = {
    {
        npc = 'ig_tylerdix', 
        animdict = "mini@strip_club@idles@bouncer@base",
        anim = "base",
        name = 'Bodybuilder',                                       -- NPC name, this has to be unique
        dialog = 'What do you want big boy?',                       -- What ped says
        coordinates = vector3(-1200.24, -1570.85, 3.61),                -- Coordinates of Ped
        heading = 38.38,                                            -- Heading of Ped (needs to be decimals)
        interactionDistance = 2.0,                            -- Maximum distance to interact NPC, suggested maximum distance is 2.5
        options = {                                                 -- Maximum 5 options can be displayed at the moment
            {'Can you teach me some moves?', 'rpgNPC:teachmoves', 'green', 'client'},   -- 'client' for client
 -- 'server' for server (if you write something else it'll be server by default)
            {"Let me ask you something.",
            {
                dialog = "Let's hear what you need.",
                options = {
                    {'I need some meds.', 'rpgNPC:meds', 'input', 'client'},
                    {'Second nested dialog options',
                    {
                        dialog = "Second nested dialog.",
                        options = {
                            {'I need some stuff to eat.', 'rpgNPC:sandwich', 'input', 'client'},
                            {'Just another dialog option but red.', 'rpgNPC:notifRed', 'red', 'client'},
                        },
                    }, 'green', 'client'},
                },
            }, 'white', 'client'},
        },
        jobs = {                                                    -- Jobs that can interact with the NPC
            "police",
            "doctor",
        },
    },
	{
		npc = 'ig_tylerdix',
		animdict = "mini@strip_club@idles@bouncer@base",
		anim = "base",
		name = 'Bodybuilder', 										-- Text under the header
		dialog = 'What do you want big boy?',						-- Text showm on the message bubble 
		coordinates = vector3(-1207.24, -1570.85, 3.61), 				-- coordinates of NPC
		heading = 38.38,											-- Heading of NPC (needs decimals, 0.0 for example)
		interactionDistance = 2.5, 									-- From how far the player can interact with the NPC
		options = {                                                 -- Maximum 5 options can be displayed at the moment
            {'Can you teach me some moves?', 'rpgNPC:teachmoves', 'green', 'client'},   -- 'client' for client
 -- 'server' for server (if you write something else it'll be server by default)
            {"Let me ask you something.",
            {
                dialog = "Let's hear what you need.",
                options = {
                    {'I need some meds.', 'rpgNPC:meds', 'input', 'client'},
                    {'Second nested dialog options',
                    {
                        dialog = "Second nested dialog.",
                        options = {
                            {'I need some stuff to eat.', 'rpgNPC:sandwich', 'input', 'client'},
                            {'Just another dialog option but red.', 'rpgNPC:notifRed', 'red', 'client'},
                        },
                    }, 'green', 'client'},
                },
            }, 'white', 'client'},
        },
		gangs = {									-- Gangs that can interact with the NPC
			"lostmc",
		},
	},
}

If you already have some ped created in other scripts, you can add these peds with a TriggerEvent.

Adding Dialogs (Example)
local coords = vector3(215.45, -808.71, 29.76)
local heading = 30.0
local ped = CreatePed(4, "s_m_m_highsec_04", coords.x, coords.y, coords.z, heading, false, true)
local tempTable = {
	name = "Key master",
        animdict = "mini@strip_club@idles@bouncer@base",
        anim = "base",
	npc = "s_m_m_highsec_04",
	dialog = "What you here for?",
	coordinates = coords,
	heading = heading,
	interactionRange = 2.0,
	options = {
		{'I need another pair of keys', 'vehiclekeys:server:createKeys', 'green', 'server'},	-- 'client' for client
		{'I need to change lock of my car', 'vehiclekeys:server:changeLock', 'red', 'client'},		-- 'server' for server (if you write something else it'll be server by default)
		{"I have questions about my car.", 
			{
				dialog = "Sure, tell me what?",
				options = {
					{'When should I change my oil?', 'garage:client:oilchange', 'white', 'client'},
					{'I want to buy some tires.', 'garage:server:buyTires', 'input', 'server'},
				}
			}, 'white', 'client'},
	},
	jobs = {},
}
TriggerEvent('zxn-rpgNPC:registerNPC', ped, tempTable)

Purchase
Tebex ($6.99 - Tax Excluded)

Check out my other scripts:

Scripts

[QB][PAID] - zxn-multicharacter | EchoRP “inspired” - FiveM Resource Development & Modding / Releases - Cfx.re Community
[QB][FREE] - qb-forgeryoffice | Forging Legal Documents - FiveM Resource Development & Modding / Releases - Cfx.re Community

1 Like

Looks to me like a remake of OkokNPC

1 Like

Thanks for your comment! And yeah actually there were some features that I needed but not included in okokTalk so I coded myself the resource with the features I needed and a nice fresh UI. This was a self project and did its job so I though why I don’t release it? I hope I satisfied your curiosity. Have a nice day!

1 Like

Hello,
I bought the Scripts and I’ve put it on the server (I gave the asset to the other owner bc he pays for the license). The thing is when I start it whitout any edits in the script. It puts out “SCRIPT ERROR: ?:-1: attempt to index a nil value (field ‘zCore’)”

What can I do to fix it?.

Ah and btw nice script. I tried to convert okokTalkToNPC to QB but I am to lazy and to stupid xD. So if the scripts works I will thank you for this awesome script. And btw your UI is better than okok’s :wink:

Updated! Now it has support on ESX and Custom FWs.

How can I use this to give someone an item without having to make a new event in another resource to call back on by this script? The default options don’t even work for me. No item is given for med/sandwich option and the new move doesn’t do anything.

Can you send me a DM with the details of your needs so I can help you :slight_smile:

1 Like

Just now seeing this. I’ll send you a message tomorrow as im not able to sit at my PC and go into detail. Thanks bud!

Awesome script, legend coder - recommend! :smiley:

1 Like