After several searches, I’ve been able to put together bits and pieces of generic entity code. This is what I have gathered:
AddCSLuaFile( "cl_init.lua" )
AddCSLuaFile( "shared.lua" )
local phys = self:GetPhysicsObject()
if phys:IsValid() then phys:Wake() end
function ENT:Touch( ply )
if ( ply:IsValid() and ply:IsPlayer() ) then
In my gamemode code, I have this item spawn. Currently, it just … floats (whereas other entities drop to the ground). Also, I added the ENT:Touch hoping this would work for simulating a player ‘picking up’ an item. Right now, the player just walks through the item, nothing happens.
I don’t know anything about scripting entities and I’ve found no tutorials on the subject. Any thoughts on making this work?