I want to make it where an event is triggered once the player steps into view of it (when they can see the event on their screen). To be specific, the event is an npc I want to run away whenever they're in the player's eyesight.
Help with Event
RPG Maker MV SupportYou've got quite a lot of options here!
I think, the easiest way would be to use another event that's triggered when the player steps on X space (placing it such that it's the perfect distance of the other event you want)...preferably with a priority of Below Character and Player Touch.
Some other options incase that isn't suitable involve:
-Making the NPC event do whatever movement it does beforehand, and then setting another event to trigger to the NPC Event to Move Away From Player via the Custom Route options, or Set Movement Route as well.
-You could make a parallel process that tracks the players movements, (Player X and Player Y), and use conditional branches to make the NPC Event run away.
-If you really want a "direct line of sight", I believe there is a plug-in from Galv that has line of sight detection.
Just some ideas for thought. : )
I think, the easiest way would be to use another event that's triggered when the player steps on X space (placing it such that it's the perfect distance of the other event you want)...preferably with a priority of Below Character and Player Touch.
Some other options incase that isn't suitable involve:
-Making the NPC event do whatever movement it does beforehand, and then setting another event to trigger to the NPC Event to Move Away From Player via the Custom Route options, or Set Movement Route as well.
-You could make a parallel process that tracks the players movements, (Player X and Player Y), and use conditional branches to make the NPC Event run away.
-If you really want a "direct line of sight", I believe there is a plug-in from Galv that has line of sight detection.
Just some ideas for thought. : )
Do you know how to use IF/"Conditional Branching"?
You can use this method:
Example, check distance with Event 003:
Event Editor.
If the character is less than 5 blocks away from the NPC:
Reference:
RPG MAKER MV / MZ Script Calls - Planilhas Google
Good luck
You can use this method:
$gameMap.distance(x1, y1, x2, y2)Example, check distance with Event 003:
JavaScript:
$gameMap.distance($gamePlayer.x, $gamePlayer.y, $gameMap.event(3).x, $gameMap.event(3).y)
Event Editor.
If the character is less than 5 blocks away from the NPC:
Code:
◆If:Script:$gameMap.distance($gamePlayer.x, $gamePlayer.y, $gameMap.event(3).x, $gameMap.event(3).y) < 5
◆Set Movement Route:This Event (Skip)
:Set Movement Route:◇Move away from Player
◆
:End
Reference:
RPG MAKER MV / MZ Script Calls - Planilhas Google
Good luck
T
Thank you, I'll test out that code. I have yet to use If/Conditional Branching but it was bound to eventually get to a point where I needed to do so in order to get the effect I wanted.
Any time!
Take the test and if it works comment here.
Take the test and if it works comment here.
It worked perfectly, exactly as I had in mind! Thank you!
Any time!
Original thread: https://forums.rpgmakerweb.com/threads/help-with-event.137327/