check if entity exists?

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

D_Town_Tony(Posted 2004) [#1]
Is there a way to check if an entity exists before I freeentity(it's not a type, just a reguler object)


Rob Farley(Posted 2004) [#2]
if entityhandle > 0 then


CyBeRGoth(Posted 2004) [#3]
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


TomToad(Posted 2004) [#4]
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.


big10p(Posted 2004) [#5]
Oh no, not this again! *slaps forehead* :)

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


TomToad(Posted 2004) [#6]
Better than having another "i am a noob adn i want 2 rite a mmorpg, but i dnot no where 2 start. pleez hlep."