- Joined
- Dec 25, 2017
- Messages
- 69
- Reaction score
- 164
- First Language
- Russian
- Primarily Uses
- RMMV
Hi! Programming for me is like some alien language so I need some help with script calls.
I want to create a common event that will check if an event with id "1" is close to the player (it's a common event because I need to check this on several maps). I've found two versions of a script call that are a little different (it goes into conditional branch -- script):
1. Math.abs($gamePlayer.x - $gameMap._events[1]._x) + Math.abs($gamePlayer.y-$gameMap._events[1]._y) <= 3;
2. Math.abs($gameMap.event(1).x - $gamePlayer.x) + Math.abs($gameMap.event(1).y - $gamePlayer.y) <= 3
Which one is the correct one for a common event? And what is the difference between $gameMap.event(1).y and $gameMap._events[1]._y ??
I want to create a common event that will check if an event with id "1" is close to the player (it's a common event because I need to check this on several maps). I've found two versions of a script call that are a little different (it goes into conditional branch -- script):
1. Math.abs($gamePlayer.x - $gameMap._events[1]._x) + Math.abs($gamePlayer.y-$gameMap._events[1]._y) <= 3;
2. Math.abs($gameMap.event(1).x - $gamePlayer.x) + Math.abs($gameMap.event(1).y - $gamePlayer.y) <= 3
Which one is the correct one for a common event? And what is the difference between $gameMap.event(1).y and $gameMap._events[1]._y ??

