Open GUI with NPC

Hello community,

I’ve been looking around for a bit, but I can’t find anything; so maybe you guys can help me! I’m looking for a way so when you press e on a NPC it will open up a VGUI coded in DERMA.

Any suggestions? Thanks in advance,

Myles


function ENT:AcceptInput( Name, Activator, Caller )
	if Name == "Use" and Caller:IsPlayer() then
		net.Start('startMyMenu')
		net.Send( Caller )
	end
end


And how would this launch the DERMA code? A hook inside it?

Thing inside it sends a net message, you’ll have to do some networking.

Net Library Usage

Have a hook on the client that opens/draws the derma panel when received.

Ok, I’m gunna try out some stuff. I will let you know how it goes. Thanks! :slight_smile:

Just use ENT:Use


function ENT:Use(activator)
   if activator:IsPlayer() then
       net.Start("thenetworkname")
       net.Send(activator)
    end
end

Edit
Not that I care but I got it that ENT:Use isn’t working no need to rate disagree.

if I recall correctly ENT:Use doesn’t get called on SNPCs

It doesn’t work with NPCs dude.

Didn’t know that, sorry.



--Some other file
function NPCMenu()
--derma stuff
end

--NPC
function ENT:Use(ply)
--use stuff
ply:SendLua("NPCMenu()")
end


If you’re making an NPC that’s an entity.

Why would you do that when you can make a usermessage and have the menu in another file? It keeps it clean and simple.

The menu is in another file as you can’t seem to follow my comments as being 2 files.

If your OpenGUI() function isn’t a local function, what’s the problem with using a usermessage/net?

Again, :Use() doesn’t work with NPCs.

Here you go m8 this should help you i was doing the same thing :slight_smile: