Check if an event can move in a certain direction?

So you can check if any event on the map can pass through any tile on the map.
let me understand, the x and y are the coordinates where we start checking in 4 directions if there is passable tiles right? and the event ID is the id of the event that we are checking if it can pass.
in 1st case: so let's assume that we have the function without event ID, we can know it an event in x and y position if he can pass in 4 directions, the only benefit possible in this case is to check passabilty in other map (I don't know even if this is possible or useful btw)
in 2nd case: let's assume that we have the function without coordinates, we can get the coordinates from event ID and we can check passability then even if it is on other map, that is what doesn't make sense, so there is two odds, the first is that there is an other purpose of having both event ID and coordinates, the second that it is just a mistake from the developers (I do not consider this possibility)
What you did wrong was writing "events". The function is "event". $gameMap.event(6). Or if you're using events, you need to give it an index: $gameMap.events()[6]. Either way will work, but you can't call canPass just on $gameMap.events().

let me understand, the x and y are the coordinates where we start checking in 4 directions if there is passable tiles right? and the event ID is the id of the event that we are checking if it can pass.
in 1st case: so let's assume that we have the function without event ID, we can know it an event in x and y position if he can pass in 4 directions, the only benefit possible in this case is to check passabilty in other map (I don't know even if this is possible or useful btw)
in 2nd case: let's assume that we have the function without coordinates, we can get the coordinates from event ID and we can check passability then even if it is on other map, that is what doesn't make sense, so there is two odds, the first is that there is an other purpose of having both event ID and coordinates, the second that it is just a mistake from the developers (I do not consider this possibility)

I'm not sure what your cases mean, to be honest. You can't call the function without an event, and to access an event the code needs to know its ID--either as a specific value or derived from a variable. The benefit is so that the event can check whether it's able to move in a given direction. Why would that be anything to do with other maps?

As for your second case, I think you may have misunderstood how events work. Yes, you can get the coordinates from the event ID, but passability only applies to the current map. Only the current map is loaded into memory at any given time, so "an event on another map" doesn't actually exist until you're on that map yourself.
What you did wrong was writing "events". The function is "event". $gameMap.event(6). Or if you're using events, you need to give it an index: $gameMap.events()[6]. Either way will work, but you can't call canPass just on $gameMap.events().
Yes it worked when i used "event" instead, I saw your answer in another post, thanks for that.
I'm not sure what your cases mean, to be honest. You can't call the function without an event, and to access an event the code needs to know its ID--either as a specific value or derived from a variable. The benefit is so that the event can check whether it's able to move in a given direction. Why would that be anything to do with other maps?

As for your second case, I think you may have misunderstood how events work. Yes, you can get the coordinates from the event ID, but passability only applies to the current map. Only the current map is loaded into memory at any given time, so "an event on another map" doesn't actually exist until you're on that map yourself.
but if we are able to get the coordinates from the event ID why do we have to be forced to write the coordinates, the only answer should be to check the passability of a tile that doesn't contain an event on it, then why we don't use only the coordinates to check the passability on a tile whether it has an event or not on it? or why didn't they make two functions, one to check with coordinates only and other with event ID only, what is the benefit of using them both on the same time?
Yes it worked when i used "event" instead, I saw your answer in another post, thanks for that.

but if we are able to get the coordinates from the event ID why do we have to be forced to write the coordinates, the only answer should be to check the passability of a tile that doesn't contain an event on it, then why we don't use only the coordinates to check the passability on a tile whether it has an event or not on it? or why didn't they make two functions, one to check with coordinates only and other with event ID only, what is the benefit of using them both on the same time?
Some events can pass through a tile while others can't. A flying event has properties that make it so it can pass over water while a land event can't. The coordinates youre sending to the function are the tile coordinates, not the event's coordinates.
Some events can pass through a tile while others can't. A flying event has properties that make it so it can pass over water while a land event can't. The coordinates youre sending to the function are the tile coordinates, not the event's coordinates.
That is exactly what I was asking, now that makes sense. (actually that is what i meant when i said before: "aren't the events the same or is there a case where one event can pass and other not from the same position?")
Thanks AquaEcho, that helped me to understand well!
Necro-post notice: @abdo97z

Please start your own thread.

Original thread: https://forums.rpgmakerweb.com/threads/check-if-an-event-can-move-in-a-certain-direction.142111/