[Release] core_npc Simply Add NPCs to your server

I created this script for my server and decided to release it to the internet. It simply allows you to add NPC peds to your server in a simple way, and adding any animation that the game allows.

You can specify the ped, the ped hash and the animation that the ped will “play” when it is spawned.

NPC Peds can easily be added into the config.lua, and you can use the example below:

And there, you are done! You just need to follow the guide installation guide on the repo, and you can ask for help here or open an issue on the repo.

Repo Link: GitHub - michaelrosstarr/core_npc: A simple way to add NPC's to your server

Happy FiveM’ing!

Images coming soon of the peds in action!

Currently working on:

  • Integration w/ bt-target

Update Log

v1.0.2 Update

  • Optimized 3D text draw and draw distance checking

Thanks to @SirBombay for contributing towards this update!
Download here

6 Likes

this does not delete the NPC when you are not close to them?

1 Like

Will defs work on this for the next update!

1 Like

Configs for aggression and ped voice, and this would be EXACTLY what i’ve been looking for for the better part of this year! :clinking_glasses:

2 Likes

Just use DeletePed(nameOfPed) when #(math vector) is not close

2 Likes

Yeah, I am going to push an update today. Thanks :+1:

No idea, but the best place to start is looking through FiveM developer docs…

Made a PR

1 Like

v1.0.2 Update

  • Optimized 3D text draw and draw distance checking

Thanks to @SirBombay for contributing towards this update!

1 Like

and how to put an object in his hands, for example, he drinks coffee, I prescribe animation, but there is no coffee in his hands?

Hi i try to put this into config.lua but i got error:

attempt to perform arithmetic on a nil value (globa ‘z’)

Code:

{255.74, 223.57, 106.29, 219.42, 0xC99F21C4,"ig_bankman", "Banker", "mini@strip_club@idles@bouncer@base"},

Did you find a solution?

nope i just find another script on github

I guess it will be because of the lines

CreateThread(function()
while Config.displayText do
local pos = GetEntityCoords(PlayerPedId())
Wait(0)
for _, v in pairs(Config.Peds) do
local distance = #(pos - vec3(v[1], v[2], v[3]))
if (distance < Config.displayDistance) then
DrawText3D(x, y, z + 1, Config.displayColor … v[7], 1.2, 1)
end
end
end
end)

because these are the old lines

Citizen.CreateThread(function()
while Config.displayText do
local pos = GetEntityCoords(GetPlayerPed(-1), true)
Citizen.Wait(0)
for _,v in pairs(Config.Peds) do
x = v[1]
y = v[2]
z = v[3]
if(Vdist(pos.x, pos.y, pos.z, x, y, z) < 20.0)then
DrawText3D(x,y,z+1, “~g~”…v[7], 1.2, 1)
end
end
end
end)

Has the integration with b-target / q-target been done yet?