How would you go about creating an NPC whose move route would change depending upon a condition such as proximity to the player? And how would you do this with only one event?
Let's make an example where you have an NPC that will try to avoid the player if the player approaches too closely. Let's say that if the player is in a range of five tiles, the NPC will attempt to move away from the player, but if the player is farther away than this then the NPC will just move randomly. The NPC is a person who will show a message when the player interacts with it, triggered by the Action button.
Is it possible to achieve this via the Script... command in the Custom Move Route properties of the NPC event? If so,how is it done? My initial attempt was to try and compare the Player's map coordinates to the Event's map coordinates, but I am unsure how to reference this as self.x and self.y or self.map_x and self.map_y and so forth, but I always receive an error. I've been trying search engines and searching on RMXP websites (well, they're just forums, really) for the past few days now with no success.
Also, while I suspect this would require scripting, I wasn't sure that it would require an entire Script per se, as I figured it would only require minimal basic-level programming, such as an if-then-else statement and some variable referencing.
Thanks for your time.