[B]Quoted from my original post quite a while ago[/B]
Well, it is pretty simple in theory. You have to create an entity using the model of the NPC you want. Then you create a command that opens a derma panel, and run this function when 'use' is pressed on that entity.
In order to do this you make a directory with the entity's name you want to make. then create 3 lua files inside, cl_init, shared, and init. In init you have to initialize your entity with
[lua]function ENT:Initialize( )
self.Entity:SetModel( "" )
self.Entity:SetHullType( HULL_HUMAN )
self.Entity:SetUseType( SIMPLE_USE )
self.Entity:SetHullSizeNormal( )
self.Entity:SetSolid( SOLID_BBOX )
self.Entity:CapabilitiesAdd( CAP_MOVE_GROUND | CAP_OPEN_DOORS | CAP_ANIMATEDFACE | CAP_USE_SHOT_REGULATOR | CAP_TURN_HEAD | CAP_AIM_GUN )
self.Entity:SetMaxYawSpeed( 5000 )
local PhysAwake = self.Entity.Entity:GetPhysicsObject( )
if PhysAwake:IsValid( ) then
PhysAwake:Wake( )
end
end[/lua]
Then with
[lua]function ENT:AcceptInput( name, activator, caller )[/lua]
you put the command that it will run when you press 'use'
then you create a command.
In cl_init you write the function to create the Derma panels you want to appear when you press 'use'
[URL="http://wiki.garrysmod.com/?title=Guide_to_Derma"]heres[/URL] a good tutorial on how to use the basic components of derma panels
then create a console command for this function ex:
[lua]concommand.Add("nameofcommand",nameoffunction)[/lua]
then finally in shared you do this to set information about the entity
[lua]ENT.Base = "base_ai"
ENT.Type = "ai"
ENT.PrintName = ""
ENT.Author = ""
ENT.Contact = ""
ENT.Purpose = "t"
ENT.Instructions = ""
ENT.AutomaticFrameAdvance = true -- i'm honestly not sure what this does, but just include it. You could look it up on the wiki if you want to find out.
function ENT:SetAutomaticFrameAdvance( bUsingAnim )
self.AutomaticFrameAdvance = bUsingAnim
end
[/lua]
[B]Hope this is a big help to you Slick![/B]
I'm guessing you've got a working NPC Shop?
Hey heavy whats your steam name?
[QUOTE=Slick;22280267]Hey heavy whats your steam name?[/QUOTE]
(Click on the steam icon under his avatar)
I've added you to steam Slick, it should come up as a friend invite from LuckyLuke
But if it hasnt arrived, add storewars123
Sorry, you need to Log In to post a reply to this thread.