Hello again, I just found some models posted on garrysmod.org of the graboid from the Tremors movies, I was going to try my hand at making an npc out of it, but the strangest thing. If I spawn the model as a ragdoll the collision all work just fine. Now if I set the model in the ENT:Initialize() with self:SetModel(), I only get the HitBox for the base bone, I’ve tried many different configurations of setsold and setmovecollide, and many other options. Also I’ve loaded it up in the model viewer and it shows a full collision mesh for it. So any idea what i’m doing wrong? oh and most recently I added the setcollisionbounds and it works, kinda, but it won’t rotate with the model. anyway thanks in advance. Any help is always appreciated.
init.lua
[lua]
AddCSLuaFile( “cl_init.lua” )
AddCSLuaFile( “shared.lua” )
include(‘shared.lua’)
function ENT:Initialize()
self.model = "models/graboid.mdl"
self:SetModel( self.model )
--self:SetHullSizeNormal()
--self:SetHullType( HULL_MEDIUM )
--[[
NPC_STATE_INVALID = -1
NPC_STATE_NONE = 0
NPC_STATE_IDLE = 1
NPC_STATE_ALERT = 2
NPC_STATE_COMBAT = 3
NPC_STATE_SCRIPT= 4
NPC_STATE_PLAYDEAD= 5
NPC_STATE_PRONE= 6
NPC_STATE_DEAD= 7
--]]
self:SetNPCState( NPC_STATE_IDLE )
self:SetHullType(HULL_LARGE)
self:SetHullSizeNormal()
self:SetCollisionBounds(Vector(-160, -25, 2), Vector(115,25,59))
self:SetSolid( SOLID_BBOX )
self:SetMoveType( MOVETYPE_FLY )
self:CapabilitiesAdd( CAP_ANIMATEDFACE |
CAP_TURN_HEAD |
CAP_MOVE_FLY |
CAP_MOVE_GROUND)
--self:SetCollisionBounds( Vector(self:OBBMins()), Vector(self:OBBMaxs()))
--self:SetUseType( SIMPLE_USE )
--self:SetMoveCollide(MOVECOLLIDE_FLY_CUSTOM)
self:AddRelationship("player D_HT 999")
--self:DropToFloor()
self:SetHealth(420)
self:SetMaxHealth(420)
undo.Create("npc_graboid")
undo.AddEntity(self)
undo.SetPlayer(player.GetByID(1))
undo.Finish()
end
function ENT:PhysicsCollide( data, physobj )
print("data: " … tostring(data))
print("physobj: " … tostring(physobj))
print(“YES?”)
end
function ENT:Think()
self:NextThink(CurTime());
return true;
end
function ENT:KeyValue(key, value)
print(tostring(self) .. " with -- Key : " .. key .. " Value : " .. value)
end
function ENT:OnTakeDamage( dmginfo)
print("No, no, no, you can't kill it yet!")
dmginfo:SetDamage(0)
end
function ENT:Touch( ent )
print("We’ve got a touch hook and we are touched by " … tostring(ent))
end
[/lua]