Ents go through my npc and dont get detected by ENT:GetClass()
5 replies, posted
So im working on an npc for my addon that basically needs to use ENT:GetClass() to get the class of an ent that is gravity gunned into the npc, The problem is that the ents go through the npc and dont get detected, it will only detect the player.
https://image.prntscr.com/image/nEWHbDZER2_2uYaSu9oVlg.png
Heres the code to my npc serverside script located in, lua>entities>bhm_infodealer>lua>init.lua
AddCSLuaFile( "cl_init.lua" )
AddCSLuaFile( "shared.lua" )
include('shared.lua')
include( "autorun/bhm_config.lua" )
function ENT:Initialize()
self:SetModel( "models/gman_high.mdl" )
self:SetHullType( HULL_HUMAN )
self:SetHullSizeNormal()
self:SetNPCState( NPC_STATE_SCRIPT )
self:CapabilitiesAdd( CAP_ANIMATEDFACE )
self:SetSolid( SOLID_BBOX )
self:SetMoveType( MOVETYPE_VPHYSICS )
self:SetUseType( SIMPLE_USE )
self:DropToFloor()
self:SetMaxYawSpeed( 90 )
local phys = self:GetPhysicsObject()
if (phys:IsValid()) then
phys:Wake()
end
end
function ENT:StartTouch( ENT )
if ENT:GetClass() == "bhm_infocase" then
ENT:Remove()
DarkRP.createMoneyBag( Vector(0, 5, 5), bhm_config.PayoutAmount )
end
end
Heres the code to my shared.lua
ENT.Base = "base_ai" -- This entity is based on "base_ai"
ENT.Type = "ai" -- What type of entity is it, in this case, it's an AI.
ENT.AutomaticFrameAdvance = true -- This entity will animate itself.
ENT.PrintName = "Hacking Info Buyer"
ENT.Author = "BloodyMustache"
ENT.Contact = "Don't"
ENT.Purpose = "Hacking Mod"
ENT.Spawnable = true
ENT.Category = "BloodysComputerHacking"
function ENT:SetAutomaticFrameAdvance( bUsingAnim ) -- This is called by the game to tell the entity if it should animate itself.
self.AutomaticFrameAdvance = bUsingAnim
end
Some help on this issue would be greatly appreciated.
This is what i use for all of my NPC's
function ENT:Initialize()
self:SetModel("Model")
self:SetHullType( HULL_HUMAN )
self:SetHullSizeNormal( )
self:SetNPCState( NPC_STATE_SCRIPT )
self:SetSolid( SOLID_BBOX )
self:CapabilitiesAdd( CAP_ANIMATEDFACE )
self:CapabilitiesAdd( CAP_TURN_HEAD )
self:SetUseType( SIMPLE_USE )
self:DropToFloor()
end
[img]http://prntscr.com/iuu4wj[/img]
still dosent work
function ENT:StartTouch( ENT )
(ENT) could be conflicting with your ENT:StartTouch, try renaming it to something unique
That fixed it, thanks for the help.
Sorry, you need to Log In to post a reply to this thread.