entity exists?

Blitz3D Forums/Blitz3D Beginners Area/entity exists?

gellyware(Posted 2003) [#1]
Is there any way to check to see if an entity exists? I am having some problems because I am making a dynamic particle engine and updating some of the elements gives an error sometimes saying entity doesnt exist. How can I check to see if exists before continuing with the function>?


FlameDuck(Posted 2003) [#2]
Use types.


gellyware(Posted 2003) [#3]
I am using a type. The problem is, in the type I have an entity. The entity sometimes fails due to the dynamic engine. Since the entity is moving towards another entity, sometimes when I dynamically change a value, the entity it is moving towards really doesnt exist, so I need a way to check if the destination entity exists, if it doesent , i need to remove the entity that is headed for it :)


semar(Posted 2003) [#4]
The entity sometimes fails due to the dynamic engine

Can you be more specific here ? What does it mean 'the entity fails' ???

Usually, an entity has a number associated. If you check that number you should be right:
if my_entity > 0 then 
;entity exists
else
;entity does not exist
endif


Note:
If you have a type element which has a field that you use as an entity pointer, and you want to delete that element type, then you should free the entity first, and then delete the type:

FreeEntity mytype\entity ;first release the entity
delete mytype ;then delete the type element