Hey, I'm trying to get the distance between 2 objects. I know I could raycast it, but I'm using about 30 enemies, and so having them constantly raycasting to test the distance between them and the player isn't going to work.
THe enemies only have melee attack, and therefore don't need to find range, as they freeroam until the player is too close.
I'm currently using
function enemydistancometer(num)
for i=100 to 100+num
oldx# = object position x(i)
oldy# = object position y(i)
oldz# = object position z(i)
Ooldx# = object position x(2)
Ooldy# = object position y(2)
Ooldz# = object position z(2)
if oldx#<Ooldx+5 and oldz#<Ooldz+5 and oldx#>Ooldx-5 and oldz#>Ooldz-5 then enemy_state(i-99)=3
next i
object i is the enemies and object 2 is the player.
Any ideas?! Help would be greatly appreciated.