Need a base npc entity

Hi facepunch.

Im making a pack as my first lua things, and i need a base entity that is a npc with unlimited health, can anyone supply me with the cl_init, init and shared.lua.

Any help apreciated

Thanks in advance

I don’t think unlimited health is possible, but you can use Gman’s health regen thing, and give it 1000 health.

Only a nuke could break that, and if you remove how the Combine Balls work on it… I think that’d work.

ok, so do you have a base entity?

Of course you can make it unlimited…

And next time, Look on the wiki, its got a whole page about SNPC’s.

would it be -1

[editline]02:13PM[/editline]

Is this ok?

init.lua

[lua] AddCSLuaFile( “cl_init.lua” )
AddCSLuaFile( “shared.lua” )

include(‘shared.lua’)

function ENT:Initialize()

self:SetModel( "models/player/suits/male_07.mdl" ) 
 
self:SetHullType( HULL_HUMAN ); 
self:SetHullSizeNormal(); 
 
self:SetSolid( SOLID_BBOX )  
 
self:CapabilitiesAdd( CAP_ANIMATEDFACE | CAP_TURN_HEAD )
 
self:SetMaxYawSpeed( 0 ) 

self:SetHealth(1337)

end

function ENT:Use()

RunConsoleCommand(“npcshop1”)

end[/lua]

cl_init.lua

[lua] include(‘shared.lua’)

ENT.RenderGroup = RENDERGROUP_BOTH

function ENT:Draw()
self.Entity:DrawModel()
end

function ENT:DrawTranslucent()

self:Draw() 

end

function ENT:BuildBonePositions( NumBones, NumPhysBones )

end

function ENT:SetRagdollBones( bIn )

self.m_bRagdollSetup = bIn 

end

function ENT:DoRagdollBone( PhysBoneNum, BoneNum )

end

[/lua]

shared.lua

[lua] include(‘shared.lua’)

ENT.RenderGroup = RENDERGROUP_BOTH

function ENT:Draw()
self.Entity:DrawModel()
end

function ENT:DrawTranslucent()

self:Draw() 

end

function ENT:BuildBonePositions( NumBones, NumPhysBones )

end

function ENT:SetRagdollBones( bIn )

self.m_bRagdollSetup = bIn 

end

function ENT:DoRagdollBone( PhysBoneNum, BoneNum )

end

[/lua]

Is that ok for a npc base, i dont want it to move but i want it to turn its head and run a console command on the player that uses it

[lua] AddCSLuaFile( “cl_init.lua” )
AddCSLuaFile( “shared.lua” )

include(‘shared.lua’)

function ENT:Initialize()

self:SetModel( "models/player/suits/male_07.mdl" ) 
 
self:SetHullType( HULL_HUMAN ); 
self:SetHullSizeNormal(); 
 
self:SetSolid( SOLID_BBOX )  
self:SetMoveType( MOVETYPE_NONE )  //wont move

self:CapabilitiesAdd( CAP_ANIMATEDFACE | CAP_TURN_HEAD )
 
self:SetMaxYawSpeed( 5000 )  // keep it 5000 just to be safe

end

function ENT:Use( activator )

if ( activator:IsPlayer() ) then

activator:RunConsoleCommand(“npcshop1”)

end
end[/lua]
Use that for init.lua

Now can you help me make a simple derma like the Darkrp f4 menu (infact could you extract that from where ever it is) i can use that as a base

ill look myself but can you look aswell

[editline]04:13PM[/editline]

is this how you get a model button

Do it yourself. You have to learn someday.

XD im looking into it, but how do i make it a button when its just a image panel

[editline]04:52PM[/editline]

I have this

[lua]function shop()
local drugs = {}

    drugs[1] = "models/katharsmodels/contraband/zak_wiet/zak_wiet.mdl"
drugs[2] = "models/katharsmodels/syringe_out/syringe_out.mdl"
drugs[3] = "models/cocn.mdl"
drugs[4] = "models/drug_mod/the_bottle_of_water.mdl"
drugs[5] = "models/ipha/mushroom_small.mdl"
drugs[6] = "models/boxopencigshib.mdl"
drugs[7] = "models/smile/smile.mdl"
drugs[8] = "models/jaanus/aspbtl.mdl"

    local frame = vgui.Create("DFrame")
local IconList = vgui.Create( "DPanelList", frame ) 

frame:Center()
frame:SetSize(220,200)
frame:SetTitle("npc Shop")
frame:MakePopup()

IconList:EnableVerticalScrollbar( true ) 
IconList:EnableHorizontal( true ) 
IconList:SetPadding( 4 ) 
IconList:SetPos(10,30)
IconList:SetSize(200, 160)

for k,v in pairs(drugs) do
local icon = vgui.Create( "SpawnIcon", IconList ) 
icon:SetModel( v )
IconList:AddItem( icon )
icon.DoClick = function( icon ) surface.PlaySound( "ui/buttonclickrelease.wav" ) RunConsoleCommand("gm_spawn", v) end 
end 	

end
[/lua]

What do i add to it to make a command called npcshop1

concommand.Add.

That dosent really help is it?


concommand.Add( "npcshop1", shop )

Please do this for me, then please do that for me…

No! what here have people actually gave me the code for

[editline]06:43PM[/editline]

where would i put my finished shop? in the entity?

You should put it here:

http://lua.org/pil/

Dude, go away! i need help not links to websites that im using for this whole project :aaaaa:

That is almost the ONLY kind of help you will get.
Do this for me, Do that for me.

put it in lua/autorun/

Thank you, now answer my question who here has actually straight up gave me the code

You have all the code above…?

Yes

[editline]10:17PM[/editline]

All I need now is my derma menu to drop a weapon/entity not just a model