check if entity exists?

Blitz3D Forums/Blitz3D Beginners Area/check if entity exists?

Is there a way to check if an entity exists before I freeentity(it's not a type, just a reguler object)

if entityhandle > 0 then

Yup just checking if its > 0 should do the trick

When you free entities manually in your game however remember to set them to 0 too

FreeEntity Player
Player = 0

Not quite. When you FreeEntity, the handle does not automatically reset to zero. There's really no way to know if an entity exists or not unless you manually keep track.

sphere = CreateSphere()

... some code
FreeEntity sphere
sphere = 0 //manually reset entity handle to 0


Edit: Looks like CyBeRGoth beat me to it.

Oh no, not this again! *slaps forehead* :)

Actually, I think Halo came up with a user lib that let's you check for this.

Better than having another "i am a noob adn i want 2 rite a mmorpg, but i dnot no where 2 start. pleez hlep."