Entity does not exist.. ?

Blitz3D Forums/Blitz3D Beginners Area/Entity does not exist.. ?

RifRaf(Posted 2004) [#1]
Hi all.. why do i somtimes get an Entity does not exist" error with this code.

If CountCollisions(car(ac)) Then
;ERROR ON THE FOLLOWING LINE SOMETIMES
If GetEntityType(CollisionEntity(car(ac),1))=2 Then
Do some stuff here
endif
endif


napole0n(Posted 2004) [#2]
One of the objects you're trying to pass has no type defined?


Zethrax(Posted 2004) [#3]
One of the objects you're trying to pass has no type defined?


Nope, that would give an 'Object does not exist' error.

You obviously must be supplying an invalid entity handle to 'CollisionEntity(car(ac),1))'. Either the handle was never set or the entity has been deleted and the handle is no longer valid.

Try checking the contents of the 'car(ac)' array (assuming it's an array) for a zero value which would indicate that the handle was never set. Otherwise, try setting the entity handle stored in 'car(ac)' to zero when you delete that entity and then test for a non-zero value before executing any operations involving the stored handle.