• Open GUI with NPC
    15 replies, posted
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
[code]function ENT:AcceptInput( Name, Activator, Caller ) if Name == "Use" and Caller:IsPlayer() then net.Start('startMyMenu') net.Send( Caller ) end end [/code]
And how would this launch the DERMA code? A hook inside it?
[QUOTE=MylesTM;46013472]And how would this launch the DERMA code? A hook inside it?[/QUOTE] Thing inside it sends a net message, you'll have to do some networking.
[QUOTE=MylesTM;46013472]And how would this launch the DERMA code? A hook inside it?[/QUOTE] [url=http://wiki.garrysmod.com/page/Net_Library_Usage]Net Library Usage[/url] 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! :)
[QUOTE=Netheous;46013468][code]function ENT:AcceptInput( Name, Activator, Caller ) if Name == "Use" and Caller:IsPlayer() then net.Start('startMyMenu') net.Send( Caller ) end end [/code][/QUOTE] Just use ENT:Use [CODE]function ENT:Use(activator) if activator:IsPlayer() then net.Start("thenetworkname") net.Send(activator) end end[/CODE] [B]Edit[/B] Not that I care but I got it that ENT:Use isn't working no need to rate disagree.
[QUOTE=CoreBase;46015007]Just use ENT:Use [CODE]function ENT:Use(activator) if activator:IsPlayer() then net.Start("thenetworkname") net.Send(activator) end end[/CODE][/QUOTE] if I recall correctly ENT:Use doesn't get called on SNPCs
[QUOTE=CoreBase;46015007]Just use ENT:Use [CODE]function ENT:Use(activator) if activator:IsPlayer() then net.Start("thenetworkname") net.Send(activator) end end[/CODE][/QUOTE] It doesn't work with NPCs dude.
[QUOTE=Netheous;46015171]It doesn't work with NPCs dude.[/QUOTE] Didn't know that, sorry.
[CODE] --Some other file function NPCMenu() --derma stuff end --NPC function ENT:Use(ply) --use stuff ply:SendLua("NPCMenu()") end [/CODE] If you're making an NPC that's an entity.
[QUOTE=LUModder;46016381][CODE] --Some other file function NPCMenu() --derma stuff end --NPC function ENT:Use(ply) --use stuff ply:SendLua("NPCMenu()") end [/CODE] If you're making an NPC that's an entity.[/QUOTE] Why would you do that when you can make a usermessage and have the menu in another file? It keeps it clean and simple.
[QUOTE=shadowslayer9;46016420]Why would you do that when you can make a usermessage and have the menu in another file? It keeps it clean and simple.[/QUOTE] The menu is in another file as you can't seem to follow my comments as being 2 files.
[QUOTE=LUModder;46021679]The menu is in another file as you can't seem to follow my comments as being 2 files.[/QUOTE] If your OpenGUI() function isn't a local function, what's the problem with using a usermessage/net?
[QUOTE=LUModder;46016381][CODE] --Some other file function NPCMenu() --derma stuff end --NPC function ENT:Use(ply) --use stuff ply:SendLua("NPCMenu()") end [/CODE] If you're making an NPC that's an entity.[/QUOTE] Again, :Use() doesn't work with NPCs.
Here you go m8 this should help you i was doing the same thing :) [url]https://maurits.tv/data/garrysmod/wiki/wiki.garrysmod.com/index7853.html[/url]
Sorry, you need to Log In to post a reply to this thread.