RMRK is retiring.
Registration is disabled. The site will remain online, but eventually become a read-only archive. More information.

RMRK.net has nothing to do with Blockchains, Cryptocurrency or NFTs. We have been around since the early 2000s, but there is a new group using the RMRK name that deals with those things. We have nothing to do with them.
NFTs are a scam, and if somebody is trying to persuade you to buy or invest in crypto/blockchain/NFT content, please turn them down and save your money. See this video for more information.
What is the script call for passability of events adjacent to each other?

0 Members and 1 Guest are viewing this topic.

***
Rep:
Level 83
Hello,

I've asked this question elsewhere to no avail, so here's hoping for a reply!

I'm not sure how to check whether an object is blocking the player's movement route (via an autostart movement call). The code I've been using only checks for map passability, not event passability:

 
Code: [Select]
$gameMap.isPassable($gamePlayer.x+1, $gamePlayer.y, $gamePlayer.directionRight)


Any help is appreciated!

***
Rep:
Level 70
RMRK Junior
Im not sure in MV but I'll assume it is similar.  Trouble is that it requires Iterating every Event on the Map.

NOTE: This is the RUBY version.

Spoiler for:
    # Loop all events
    for event in $game_map.events.values
      # If event coordinates are consistent with move destination
      if event.x == new_x and event.y == new_y
        # If through is OFF
        unless event.through
          # If self is event not a Player
          if self != $game_player
            # impassable
            return false
          end
          # With self as the player and partner graphic as character
          if event.character_name != ""
            # impassable
            return false
          end
        end
      end
    end

Thing is that there are easier ways to do it.  The section above is only part of the code that checks for passable.  In XP, it can be called as part of the Player, not the Map.  There are usually two parts of the code, one is for the Map, the other is for the Characters.

if $game_player.passable?(x, y, d)
  # Do stuff here
end

As you can see, its part of the Player, not the Map.  The Map part of passable is also checked by the Player for both Tiles and Events.

As far as the MV code you are looking for, I am absolutely no help, I don't have MV, but hopefully, I can get you pointed in the right direction...
Heretic's Vehicles XP (Boat and Magic Carpet)

Heretic's Collection XP Ver 2.3 - Updated to include Dynamic Lighting, Moving Platforms, Vehicles, and much much more!

***
Rep:
Level 83
Hello Monsieur86,

Thanks for your reply.  I hadn't thought of issuing a movement command and then checking whether the event's x/y coordinates == the expected x/y.  :)

Quote
if $game_player.passable?(x, y, d)
  # Do stuff here
end

As you can see, its part of the Player, not the Map.  The Map part of passable is also checked by the Player for both Tiles and Events.

How would you set up this example using the Map instead of the Player?  Would this be right?:
Code: [Select]
if $game_map.event().passable?(x,y,d)
« Last Edit: August 04, 2016, 03:04:13 AM by flapbat »

***
Rep:
Level 70
RMRK Junior
Hello Monsieur86,

Thanks for your reply.  I hadn't thought of issuing a movement command and then checking whether the event's x/y coordinates == the expected x/y.  :)

Quote
if $game_player.passable?(x, y, d)
  # Do stuff here
end

As you can see, its part of the Player, not the Map.  The Map part of passable is also checked by the Player for both Tiles and Events.

How would you set up this example using the Map instead of the Player?  Would this be right?:
Code: [Select]
if $game_map.event().passable?(x,y,d)

That looks correct.  Sorry, been busy for a few days so late reply.  Did the code above work for you?  I think it may need an Event ID in the $game_map.event(ID GOES HERE) part...
Heretic's Vehicles XP (Boat and Magic Carpet)

Heretic's Collection XP Ver 2.3 - Updated to include Dynamic Lighting, Moving Platforms, Vehicles, and much much more!