So I’ve been trying to make a custom shop NPC using decently simple Lua, the shop would go something like (Press E on entity) (Opens shop in DFrame) (List of bunch of items) I have a small base, but I need help figuring out an issue. The main issue I am having is that once I reload my game, it will no longer have my custom entity in the Q menu under entities This is an issue since I can’t test it. I’m still learning networking since I just started learning Lua a few days ago, but here is what I have (sorry for the bad formatting, I’m new here):
AddCSLuaFile("cl_init.lua") AddCSLuaFile("shared.lua") include("shared.lua") ENT.Type = "ai" ENT.Base = "base_ai" ENT.PrintName = "Test NPC" ENT.Instructions = "This is a test it probably won't work" ENT.Spawnable = true function ENT:Initialize() self:SetModel("models/breen.mdl") self:SetHullType( HULL_HUMAN ); self:SetHullSizeNormal(); self:SetSolid( SOLID_BBOX ) self:SetMoveType( MOVETYPE_STEP ) self:CapabilitiesAdd(CAP_TURN_HEAD + CAP_ANIMATEDFACE) self:SetHullType(HULL_HUMAN) self:SetHullSizeNormal() self:SetUseType( SIMPLE_USE ) self:SetMaxYawSpeed( 5000 ) end util.AddNetworkString("Test") function AcceptInput(name, activator, caller, data) if IsValid( caller ) and caller:IsPlayer() then net.Start("Test") net.Send(ply) end end
include("shared.lua") net.Receive( "Test", function(len, pl)) if ( IsValid( pl ) and pl:IsPlayer() ) then print("Hello") end end
ENT.Type = "ai" ENT.Base = "base_gmodentity" ENT.PrintName = "Test NPC " ENT.Instructions = "This is a test it probably won't work" ENT.Category = "Dark's Custom Remnant Entities" ENT.Spawnable = true
Any help will be greatly appreciated, again, I am new to all of this so if I make a stupid mistake that is probably why.