Yeah i am following this tutorial on how to make a NPC shop for my gamemode.
[url]http://wiki.garrysmod.com/?title=NPC_Shop_Tutorial[/url]
But i don't get how to have the NPC spawn on start up to a certain position? Any help please? :)
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]
[QUOTE=Cubar;23824059]local NPCShop = ents.Create("npc_shop")
NPCShop:SetPos(Vector(0,0,0)) -- sets the position
NPCShop:Spawn() -- spawns the npc_shop entity[/QUOTE]
Two quick questions
One
[CODE]local NPCShop = ents.Create("npc_shop")
NPCShop:SetPos(Vector(0,0,0)) -- sets the position
NPCShop:Spawn() -- spawns the npc_shop entity [/CODE]
That goes in the init.lua folder right
and two, how would i find the x/y position on the map?
[QUOTE=gameguysz;23824202]Two quick questions
One
[CODE]local NPCShop = ents.Create("npc_shop")
NPCShop:SetPos(Vector(0,0,0)) -- sets the position
NPCShop:Spawn() -- spawns the npc_shop entity [/CODE]
That goes in the init.lua folder right
and two, how would i find the x/y position on the map?[/QUOTE]
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....
[QUOTE=gameguysz;23824708]But i don't get how to have the NPC spawn on start up to a certain position? Any help please? :)[/QUOTE]
[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
[URL]http://wiki.garrysmod.com/?title=Using_SpawnIcons[/URL]
How will i be able to get it to remove the money which is also from here XD
[URL]http://wiki.garrysmod.com/?title=LUA:Money_System_Part_2[/URL]
Yeah i know im following tutorials but im not releasing this or anything its just to learn and maybe show off to friends
Sorry, you need to Log In to post a reply to this thread.