Quote:
Originally Posted by callimuc
I'm sure he ment how to find players within a certain range, not how to get the range. You could do that the following way using findNearestPlayers():
PHP Code:
function attackPlayers(from_x, from_y, distance_max) {
for (temp.pl: findNearestPlayers(temp.from_x, temp.from_y) {
temp.dx = temp.pl.x - temp.from_x;
temp.dy = temp.pl.y - temp.from_y;
temp.distance = (dx^2 + dy^2) ^ 0.5; //calculate distance
echo("Distance to " @ temp.pl.account @ ": " @ temp.distance);
if (temp.distance > temp.distance_max) continue; //ignore players that are further away than you want them to be
//do stuff to the players within the given range
}
}
|
I may be doing it wrong.. but the way I did it seems so much simpler...
in the action-
PHP Code:
triggeraction(player.x + 1.5 + vecx(player.dir) * 4, player.y + 2 + vecy(player.dir) * 4, "Lighthurt", player.dmg, player.z+3, player.z-3);
in the hurt function-
PHP Code:
if (player.z < params[1]){
if (player.z > params[2]){