Entity help

I’m currently working on a little entity, but I need to know if theres a way on how to do these.

  • The ENT cannot be undone
  • The ENT Cannot be picked up
  • The ENT cannot colide with players.

If anybody could give me a small function to add for each one, that would be great.



**You would use this for the nocolliding with players

Eh, I’m looking for a code that I can just simply place. I’m VERY new to lua.

You would have to use Collision groups, hang on, let me see which one would be appropriate


[lua]function ENT:Touch( hitEnt, ent )
if (hitEnt:IsValid() and hitEnt:IsPlayer()) then
ent:SetCollisionGroup(COLLISION_GROUP_WEAPON) --What I read this group nocollides with the player

Quick code I whipped up, untested, but should work.

Thanks, I’ll test it now.

Sorry, only comes back with this error.

lua\entities\sent_secret\init.lua:35: attempt to index local ‘ent’ (a nil value)

It’s defined in the function arguements, it shouldn’t come up nil :confused:

Go look at the wiki page for ent touch then come back and tell me what you did wrong



*** The ENT cannot be undone**
Don’t spawn it through the spawn menu in sandbox. Undoing is an added functionality, not something you have to disable.

*** The ENT Cannot be picked up**



*** The ENT cannot colide with players.**

Or like HeavyMtl123 said set it’s collision group to COLLISION_GROUP_WEAPON upon initializing the entity. (Not everytime touch is called.)

Ah, Thanks so much!

Defining it in the arguments dosent mean it cant be nil, also that code would fuck up anyways(screw up the players collision if not crash)