Entitydistance of types

Blitz3D Forums/Blitz3D Programming/Entitydistance of types

cash(Posted 2003) [#1]
Simple I am sure...

My game is a FPS and is moving along quite nicely.
The real issue I am having is that, the enemies are soldiers created using types. All works fine and the basic AI is acceptable. What I cant figure is how to stop the enemies all merging into one when they are chasing the player. Is there a way to use maybe the entitydistance command or something with "Types". What i have tried so far causes them to behave erratically all over the place.

What I thought was IF ENTITYDISTANCE(E\ENEM,E\ENEM)< 50 then do something.

But it doesnt work...I guess it was too easy to assume it would....


jfk EO-11110(Posted 2003) [#2]
you could use collision. But this would require to set Collisions from every enemy to every enemy.

However you will need to compare each enemy with the other enemies. With types this is a bit silly. something like:

for p.struct= each struct
 for p2.struct=each struct
  if p\enemy <> p2\enemy then
   if entitydistance(p\enemy,p2\enemy)<50 then
    ; do something
   endif
  endif
 next
next