NPC Shop?

Yeah i am following this tutorial on how to make a NPC shop for my gamemode.

But i don’t get how to have the NPC spawn on start up to a certain position? Any help please? :slight_smile:

And i would very much like details cause i really like to learn so i don;t have to ask again. Thank you

[lua]
local NPCShop = ents.Create(“npc_shop”)
NPCShop:SetPos(Vector(0,0,0)) – sets the position
NPCShop:Spawn() – spawns the npc_shop entity[/lua]

Two quick questions

One


local NPCShop = ents.Create("npc_shop")   
NPCShop:SetPos(Vector(0,0,0)) -- sets the position  
NPCShop:Spawn() -- spawns the npc_shop entity  

That goes in the init.lua folder right
and two, how would i find the x/y position on the map?

Yes.

Stand where you want the npc to be and type Getpos in console, round all the values down and round the angles to the nearest 45 degrees.

Question 1: Yes
Question 2: Stand where you want your NPC and type “getpos” in the console.

Okay so im new to the whole get pos thing…

setpos -982.699768 -1086.329590 -79.968750;setang -0.000017 -1.476585 0.000000

Whats what?

bring it into vector form:

[lua]
NPC:SetPos(Vector(-983,-1086,-80))
NPC:SetAngles(Vector(0,0,0))
[/lua]

Okay this is in my init.lua file now

function NpcShop()
local NPCShop = ents.Create(“npc_shop”)
NPCShop:SetPos(Vector(-982,-1086,-80)) – sets the position
NPCShop:SetAngles(Vector(0,0,0))
NPCShop:Spawn() – spawns the npc_shop entity
end

EDIT:Still doesn’t want to show up…

[lua]
function NpcShop()
local NPCShop = ents.Create(“npc_shop”)
NPCShop:SetPos(Vector(-982,-1086,-80)) – sets the position
NPCShop:SetAngles(Vector(0,0,0))
NPCShop:Spawn() – spawns the npc_shop entity
end
hook.Add(“InitPostEntity”,“shop”,NpcShop)
[/lua]

[lua]function NpcShop()
local NPCShop = ents.Create(“npc_shop”)
NPCShop:SetPos(Vector(-982,-1086,-80)) – sets the position
NPCShop:SetAngles(Angle(0,0,0))
NPCShop:Spawn() – spawns the npc_shop entity
end
hook.Add(“InitPostEntity”,“shop”,NpcShop)
[/lua]

Okay i have a new question… I am using this as the Derma for the Food Shop

How will i be able to get it to remove the money which is also from here XD

Yeah i know im following tutorials but im not releasing this or anything its just to learn and maybe show off to friends