I'm trying to figure out a way to detect adjacent tokens to a player token, and in the case that there are more than one adjacent enemy tokens (enemy status being based on an attribute, which at least can probably be detected), prompt which one they would like to attack. I was thinking it might be possible to have the player ping on the enemy token that they want to attack, but I'm not sure if there's any way to detect that kind of mouse event. Help?
There isn't a way to detect pings. The basic algorithm will be: For all tokens on the same page and on the same layer, filter to only enemy tokens by represented character's attribute find distances from player token filter on distance < "some threshold" (probably either check horizontal and vertical distance separately for less than ~1 unit) Something else you could do is just have them move their token on top of the enemy they want to attack and have the script check for collisions and move the token back.
The Aaron said: filter on distance < "some threshold" (probably either check horizontal and vertical distance separately for less than ~1 unit) Assuming the game takes place on a grid, ((sqrt(2) + epsilon) * 70) would be less than two squares horizontally or vertically, and more than one square diagonally. =)