MV 1.6.1
I need an event to be moving towards player (from any direction) and then change speeds based on distance.
ex.
-Event if more then 5 tiles away from player has a speed of 5,
-Event if is more than 2 but less than 5 tiles away from player has a speed of 4,
-Event if equal to 2 stops.
-then reverses the process as player moves away.
plugins help get the event to stop, but i cant seem to figure out a way to reverse the process with just plugins. ive done yanfly/mog/various other sensorswitches.
I would love to be able to run a conditional script based on distance!
so far some lunatic server help was given in a few different forms:
Math.pow((Math.pow(($gamePlayer.screenX() - $dataMap.events(e).screenX()), 2) + Math.pow(($gamePlayer.screenY() - $dataMap.events(e).screenY(), 2))),0.5) > (48 * 5)
Math.pow(Math.pow($gamePlayer.x - $gameMap.events()[e].x, 2) + Math.pow($gamePlayer.y - $gameMap.events()[e].y, 2),0.5) > 5
I've tried both these methods, without any luck. The Bottom script turns on the events self switch no matter what distance, so i believe it its in the right direction.
Any ideas?
I need an event to be moving towards player (from any direction) and then change speeds based on distance.
ex.
-Event if more then 5 tiles away from player has a speed of 5,
-Event if is more than 2 but less than 5 tiles away from player has a speed of 4,
-Event if equal to 2 stops.
-then reverses the process as player moves away.
plugins help get the event to stop, but i cant seem to figure out a way to reverse the process with just plugins. ive done yanfly/mog/various other sensorswitches.
I would love to be able to run a conditional script based on distance!
so far some lunatic server help was given in a few different forms:
Math.pow((Math.pow(($gamePlayer.screenX() - $dataMap.events(e).screenX()), 2) + Math.pow(($gamePlayer.screenY() - $dataMap.events(e).screenY(), 2))),0.5) > (48 * 5)
Math.pow(Math.pow($gamePlayer.x - $gameMap.events()[e].x, 2) + Math.pow($gamePlayer.y - $gameMap.events()[e].y, 2),0.5) > 5
I've tried both these methods, without any luck. The Bottom script turns on the events self switch no matter what distance, so i believe it its in the right direction.
Any ideas?