Need Help With Passabillity

Hello folks, I have seen these in the Script Call List:
$game_map.passable?(X, Y, D)
$game_player.passable?(x, y, d)
$game_map.events[event_id].passable?(x, y, d)

But I don't think any of these is what I need. I have been experimenting with these since last night and I think my problem is that I'm not standing next to the tile being checked. My goal is a system of checking a tile at $gameVariables.value(x) and $gameVariables.value(y) coordinates, that the player is NOT STANDING NEXT TO, and determine which directions that tile can be entered from and exited from. Seems like no matter what I do I get "Unexpected end of input."
Take a look at Game_CharacterBase and see how it tests. It uses the $gameMap.roundXWithDirection and $gameMap.roundYWithDirection functions.

$game_map and $game_player are VX and VX Ace identifiers. I'm not surprised you got an error when trying to run them. MV uses $gameMap and $gamePlayer. In this case though, because you don't want to base it on the player's position, you're not interested in $gamePlayer.
I realize I'm no expert but the scripts from above came from this very site, from the RMMV Script Call List

https://forums.rpgmakerweb.com/index.php?threads/rpg-maker-mv-script-call-list.46456/

I do see now that it says vxace in the top right but it came from the MV script call forum, posted by a level 99 staff member. thank you, I will see what I can do with new information.
Column B is what you need to type into the editor, not column A. So to check whether a tile is passable, you need to use $gameMap.isPassable(x, y, direction)
I am trying to check each tile, one direction at a time. I'm no longer getting the error but the conditional returns false no matter what the coordinates. do you see anything wrong with this?


◆If:Script:$gameMap.isPassable($gameVariables.value(18), $gameVariables.value(19), 2)
◆Text:None, Window, Bottom
:Text:Tile at x=\V[18], y=\V[19] can be exited downward
◆
:End
Are you sure it's returning false? How do you know? That text not appearing COULD mean it's returning false, or it could mean that your event isn't even being run. The only way you can be sure it's returning false is to add an Else statement and make something happen in the 'false' block of the condition.

Please show a screenshot of the event - include the entire event window.
thank for responding. I know its false because the first part of the event plays out, then at the end I have one conditional for each direction and nothing happens.
Really need to see your event if you want us to continue helping you.
upload_2017-5-8_0-15-24.png




The first text appears, with the correct coordinates. after that nothing.
where did you update the gamevariables?
If they're not filled with data, they're 0 and that means the passability will always be checked for corrdinate 0,0

So whatever is wrong is probably with the update of those values
Your whole event looks okay to me - if the first line of text is showing, and the correct values in variables 18 and 19 are being displayed, then the others SHOULD work, as long as the map IS passable from that tile in other directions.

Do you have any plugins, especially that would affect passage settings, or variable retrieval? I can think of some that would do one or the other. My Linked Variables is one that comes to mind, and there are a number of plugins that alter the way passage settings behave (Yanfly's region restrictions, for example, but there would no doubt be more). Can you provide a list of all the plugins you're using?
Your whole event looks okay to me - if the first line of text is showing, and the correct values in variables 18 and 19 are being displayed, then the others SHOULD work, as long as the map IS passable from that tile in other directions.

Do you have any plugins, especially that would affect passage settings, or variable retrieval? I can think of some that would do one or the other. My Linked Variables is one that comes to mind, and there are a number of plugins that alter the way passage settings behave (Yanfly's region restrictions, for example, but there would no doubt be more). Can you provide a list of all the plugins you're using?


Thanks for your help, I am running zero plugins of any kind, not even the ones that come with MV. I had never used any RPG maker before MV was released and I bought it when I first came out. i have been reading about it and teaching myself ever since then. I have made some pretty epic breakthroughs. one of the first was an improvement on the default doors and chests, and intuitive elevator system. on of the most recent was a large item storage system with toss function. I also have a wallet capacity and inventory capacity limitation and upgrade system and lots more.
If you replace the variables with actual coordinates, does it work? If you move your PC over to that spot, can you walk off it onto those tiles?

You didn't answer Andar's question about how you're setting those variables. I'd like to see the event where that happens as well.
I think I found the first problem. to capture the coordinates I was using
◆Control Variables:#0018 Clicked X = TouchInput.x
◆Control Variables:#0019 Clicked Y = TouchInput.y

I didn't realize until now that the coordinates being stored pixels not tiles. so I still don't know how to capture clicked coordinates but now another problem has arisen as well: I tried what you said and I typed in specific coords that should only be exited upward, and all 4 directions now returned true instead of false.
As for the first problem, you just need to do what the engine does when the player clicks somewhere on the map - it has to convert pixel-on-screen coordinates to tile-on-map coordinates.

Control Variables: #0018 Clicked X = $gameMap.canvasToMapX(TouchInput.x)
Control Variables: #0029 Clicked Y = $gameMap.canvasToMapY(TouchInput.y)

As for the second ... I'm trusting that you've got your passability set correctly on the tile to only allow UP. The problem could be that you've drawn over that tile with another blank tile that has passability in ALL directions. To remove that possibility, use the top left B tile to draw over that same tile again (this will remove both top layers), and then just draw with the original tile you want there. Or if it's just A-ground tiles that you have, draw with the same ground tile again, which will erase any possibly-blank-and-passable B tile you might have had there. Another possibility - only if you've got an older version of the engine, or a map that you made in an older version of the engine - is that the top left B tile has O for passability. It should have a star.

If those don't give you enough information to solve the issue, please post a screenshot of your map, with the tile in question highlighted so it's obvious which one we're talking about, a screenshot of your event with the position hardcoded, and a screenshot of the Tileset tab, with the tileset selected that you're using on that map, the tile itself visible (select the appropriate tab), and the Passage 4-dir button clicked.
ok I think this all is working now. thank you again for helping with this. now I that I can check how selected tile can be walked off I need to check how selected tile can be entered. I can figure out how to check if (x-1, y) can be exited right, if (x+1, y) can be exited left, if (x, y-1) can be exited down, and if (x, y+1) can be exited up. however I understand that event tiles may not be considered in this way. is that right? what can I do?
figured it out myself but my sincere thanks for the help. I'm 99% sure I can do what I want to now, without a plugin.
That goes back to my reference in my original post about $gameMap.roundXWithDirection and $gameMap.roundYWithDirection.

If you have a look at rpg_objects.js and Game_Character, at the passage function (don't remember its exact name and don't have MV with me), you'll see when it's trying to decide whether the character can move to the next tile, it checks if you can pass from the current tile to the next tile in that direction, and it also checks if you can pass from the next tile back to the current tile in the opposite direction.

So this is the kind of logic you could use:

Code:
if $gameMap.isPassable($gameVariables.value(18), $gameVariables.value(19), 2) && $gameMap.isPassable($gameMap.roundXWithDirection($gameVariables.value(18),2), $gameMap.roundYWithDirection($gameVariables.value(19),2), 8) {
  // you can leave the tile downwards, and enter from the tile below going upwards
}

I know you already have a solution, but this is a way to do it without having to calculate the starting point yourself.
well I don't really yet understand how to use the "$gameMap.roundXWithDirection and $gameMap.roundYWithDirection" functions. I see your code I'm going to experiment a bit with it. I don't intend to have any looped maps, so for now I can piece together an event that will do what I need using:

◆If: Script: $gameMap.isPassable($gameVariables.value(x), $gameVariables.value(y), d)
◆Text:None, Window, Bottom
:Text:tile x=\V[x], y=\V[y] can be exited in direction(d)
◆
:End

◆If: Script: $gamePlayer.canPass($gamePlayer.x-(x modifier), $gamePlayer.y-(y modifier), d)
◆Text:None, Window, Bottom
:Text:x=\V[x], y=\V[y] can be entered from direction(d)
◆
:End

Original thread: https://forums.rpgmakerweb.com/threads/need-help-with-passabillity.78219/