Entity suddenly went missing.

I can’t spawn an entity I’ve been working with for 2 hours!

Any idea why?

If you’re trying to view the entity client-side; if it hasn’t been in the client PVS yet, the client will see it as nil.

A good example, my elevators are spawned in by the map content script I wrote.

When I join in the server, if I’m not close and I try getting the data for that entity, it’ll say entity x is null; once I’m close-by it’ll tell me that the class is func_brush, etc etc…

Make sure you set the PVS to TRANSMIT_ALWAYS if you’re spawning something on the server which the client absolutely NEEDS to know about.

Also, if you created it while in game (you made the folders) you’ll need to reset the server for it to see it as a valid entity.

Thanks, but I’m a bit confused because I tried another entity and it works.


[editline]2nd February 2014[/editline]

Thanks Sparky, but it was working fine until I’ve did a restart. Now my entity is NULL for some reason.

If it was working and you did a restart and then it wasn’t working then maybe there’s just an error - do you see any when the server starts?

I meant NULL instead of nil; NULL means empty entity.

Are you spawning it near your location? does landmine exist as a folder in entities/ or as a single file.lua in that folder? Show us some of the code; it may be a typo which is causing it to not spawn.

I’m glad you pointed that out Sparky! That fixed it.


Thanks Ace. The problem was a local variable in the code, I removed local.