Toggling Passage of Tiles with a specific Region ID, based on a Switch

● ARCHIVED · READ-ONLY
Started by Josephkhland 3 posts View original ↗
  1. I have been trying to make a spell which summons a small familiar that you can move around the map. For achieving that I am making an actor with the name "Familiar" appear in front of the Player, before taking control of it and roaming around the world. When I want to cancel the spell I just use a skill of the Familiar actor that gets me back to playing with the first Actor, from the point he was at.

    So what I am trying to do now is make it possible, for while playing around as the familiar, to walk over tiles that it wasn't previously possible to pass through.

    I don't want the familiar to be able to pass through everything so I can't just put on a "THROUGH" Flag on the player.


    I was thinking whether it was possible to alter the impassibility of a tile, based on its region ID and a switch.

    For example once a switch is on, all the tiles with a region ID of 5 to become passages, overriding the tile-set impassibility or passability .

    Thank you for reading. If anyone would be able to help me with this I would be really grateful.
  2. Maybe you could treat the familiar as a vehicle? Out of the box, you can make your familiar able to cross water or able to fly. However, this doesn't have a ton of control and might not be right for what you're trying to do.

    So plugins might be the only other option. I can't think of any plugin that does what you're suggesting, though I know Yanfly has one that lets you change stuff like this. (Though not dynamically, like you need.)

    EDIT: Somehow I thought you were talking about MV. That's what I get for clicking on one of the new threads over in the side bar on the main page without checking its subforum. :kaosigh:
  3. I was thinking that possibly writing a script that would override the default method for "Check Passage"

    Game_Map: Check Passage Method
    #--------------------------------------------------------------------------
    # * Check Passage
    # bit: Inhibit passage check bit
    #--------------------------------------------------------------------------
    def check_passage(x, y, bit)
    all_tiles(x, y).each do |tile_id|
    flag = tileset.flags[tile_id]
    next if flag & 0x10 != 0 # [☆]: No effect on passage
    return true if flag & bit == 0 # [○] : Passable
    return false if flag & bit == bit # [×] : Impassable
    end
    return false # Impassable
    end

    Which is Later Called by this Method
    #--------------------------------------------------------------------------
    # * Determine Passability of Normal Character
    # d: direction (2,4,6,8)
    # Determines whether the tile at the specified coordinates is passable
    # in the specified direction.
    #--------------------------------------------------------------------------
    def passable?(x, y, d)
    check_passage(x, y, (1 << (d / 2 - 1)) & 0x0f)
    end

    So perhaps a script that if a specific Switch is ON, then it would check the Region ID of the tile and return true or false, based on it. But if the Switch is OFF it would keep using the default way to check passage. I am not very familiar with Ruby but if I were to write it in a way possibly

    Some kind of badly written fake code.
    if ($game_switches[65] == true)
    {
    #command that checks the region id of the tile whose passability needs to be determined
    if (regionID == 5) return true;
    else return false;
    }
    else #uses the default method