How do I use this region code to create invisible walls?

● ARCHIVED · READ-ONLY
Started by KonKossKang 5 posts View original ↗
  1. (if $game_player.region_id == n) how can this be used to make invisible walls?Not sure what I did wrong but it's not really working as an invisible wall.

    And if anybody curious there's a dollar sign at the beginning because when I was looking at the ruby stuff they all had that so I just imitated
  2. for starters the if needs to be outside the ()
     

    if ($game_player.region_id == n)then also you might have to show us a larger bit of the code you are trying to write so we can properly help you,
  3. that's all i typed it's for that little section in control variables.I might learn rggs3 first then ruby years from now but I'm not ready for it now.
  4. most probably that line is part of yanfly's script, because it alone does nothing, you'll need a full script for this.


    And in that case, there is no n in the script but a specific number - and if the script is active and you use the region tool in the editor to place that specific region code on a tile, that tile can no longer be moved on by the player (or an event) depending on which part of the script the ID describes.
  5. I've moved this thread to RGSSx Script Support. Please be sure to post your threads in the correct forum next time. Thank you.


    You probably don't want to look at $game_player.region_id because that tells you what region the player is CURRENTLY on. If you want invisible walls, then you're more interested in what region is on the tile the player is facing.


    To do that, you'll have to get the coordinates of the tile the player is facing (there's a $game_map.round_x_with_direction and $game_map.round_y_with_direction that you can use for that), then just call the $game_map.region_id method passing through those coordinates. Then you'd have to change the passable? method of Game_Player and return false if that region id is the one you're interested in (this would still allow NPCs with random movement to go through them, so if you also want to stop that, your method will have to go into Game_CharacterBase and not actually refer to $game_player at all - since you don't want events to move based on whether the player is facing a region 1 tile).


    Note - I don't have Ace in front of me at the moment, so some of those method names might not be quite right. But if you've already looked at scripts, you're capable of searching through those classes to see what the correct names are :)