Thread:Randomouscrap98/@comment-27239291-20140818173742/@comment-9531161-20140818174833

Use the distance formula between the two sprite locations. If you have the sprite locations on hand, you can just do:

DIST=SQRT(POW(XN-XP,2)+POW(YN-YP,2))

Where XP and YP are the X and Y coordinates of the player, and XN and YN are the coordinates of the NPC. If you don't have the locations, you can use SPREAD to get the X and Y locations of the sprites, then calculate the distance between them using the above formula.