Event activation upon enering certain distance

Hi!


I am trying to activate this event, when my player goes near it.


I have set up variables:


variable1 = player x (on map)


variable2 = player y (on map)


variable3 = event x (on map)


variable4 = event y (on map)


I want to make a script for conditional branch which would subtract one variable from another and gives absolute number(if answer is ,,-'' it makes it positive)


I tried doing it this way. $game_variables[1] - $game_variables[3] = 3.abs


but it activates even when this isn't true. Same method would go for y coordinates.


I tried using a proximity detection script, but that caused me errors, maybe because I have other scripts in my game as well, that might be interrupting each other.


Event.png
Hmm, put the event where your character is going. 
where did you read the variables? that parallel process isn't updating them.


Additionally, the result of the operation needs to have the abs applied, not the three - 3.abs is always three and that ignores the possibility of the calculation becoming negative.


And third, common events CANNOT be moved because they don't exist on maps - you'll need to target the move route on the map event, not on the common event.

Original thread: https://forums.rpgmakerweb.com/threads/event-activation-upon-enering-certain-distance.60600/