I tried looking around but I only found scripts that keep the event at a distance from the player
in particular I would like the event when I am at a certain distance, to approach the player and once touched to start a battle
how big is the distance you want, is it like, a whole plain or something more narrow?
var D=4, d=Math.sqrt(Math.pow($gamePlayer.x-this.x,2)+Math.pow($gamePlayer.y-this.y,2)); this._inseguendo=this._inseguendo||(d<=D); if(this._inseguendo) { this.setMoveSpeed(4); this.setMoveFrequency(5); this.moveTowardPlayer(); } else { this.setMoveSpeed(3); this.setMoveFrequency(4); this.moveRandom(); }
solved I leave it here in case it helps someone, it is set so that when you are 4 squares from the actor, the actor starts to come towards you
the character will move randomly until you enter the radius of the 4 squares, also changing the speed during the chase
thanks for sharing the solution, you wanted something like in pokemon but with a radius?