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.
[RMXP] Events: Move through other events/player but NOT tiles?

0 Members and 1 Guest are viewing this topic.

**
Rep: +0/-0Level 68
RMRK Junior
Hello there. I'm using XP to create a puzzle game and am having an issue with events.

I have events that move around the map. The player (and other events) should be able to pass through these and vise-versa. Simple right? Check the "Through" event option. PROBLEM! Now the event passes through tiles as well, ignoring the layout of the map. I don't want this... is there a way around this? To get that "through" without the event ignoring tile passability?

Thanks!
« Last Edit: January 03, 2012, 01:42:15 AM by modern algebra »

*
my name is Timothy what's yours
Rep:
Level 79
Hello
2014 Best IRC Quote2014 Zero to Hero2014 Most Missed Member2012 Zero To HeroSecret Santa 2012 ParticipantContestant - GIAW 9For frequently finding and reporting spam and spam bots2011 Zero to Hero
Uncheck through and make the priority of the event 'below character'. The character should now be able to walk over them, and they won't be able to walk through unpassable tiles.
it's like a metaphor or something i don't know

**
Rep: +0/-0Level 68
RMRK Junior
There is no option for that, like in 2003. The only options are :

-Move Animation
-Stop Animation
-Direction Fix
-Through
-Always on Top (this doesn't work, only ensures the event will display above any tile)

I think the only solution is a small tweak to the script, but I don't know what to do.

**
Rep:
Level 82
This should work. Just configure the switch. When it is ON, character sprites will not collide with each other, and you don't need to worry about "through" or anything.

Code: [Select]
class Game_Character
 
 
  PASSABLE_SWITCH_ID = 20
  # Characters will not collide with each other as long as the game switch with
  # this ID is ON.

  alias zer0_make_character_passable passable?
  def passable?(x, y, d)
    if $game_switches[PASSABLE_SWITCH_ID]
      # Get new coordinates
      new_x = x + (d == 6 ? 1 : d == 4 ? -1 : 0)
      new_y = y + (d == 2 ? 1 : d == 8 ? -1 : 0)
      # If coordinates are outside of map
      return false unless $game_map.valid?(new_x, new_y)
      # If through is ON
      return true if @through
      # If unable to leave first move tile in designated direction
      return false unless $game_map.passable?(x, y, d, self)
      # If unable to enter move tile in designated direction
      return false unless $game_map.passable?(new_x, new_y, 10 - d)
      # passable
      return true
    else
      return zer0_make_character_passable(x, y, d)
    end
  end
end

**
Rep: +0/-0Level 68
RMRK Junior
Hey, I popped that in the Game_Character class and it does the trick.

Thanks a lot for doing that. Much appreciated!  :lol:

The only problem is I still want to have solid events at the same time.
Is it possible to use this code in place of the normal "through" code option instead of relying on a switch?

I suppose the best solution for me would be to make it so events pass one another (but not tiles) if BOTH of them are set to [Through]...
Example: If event moving to x/y "through" = true AND the event already at x/y "through" = true THEN passibility RETURN true.

I tried another thing. I set the event I wanted to be solid to a tile (with no passability) instead of a character and that worked. The only
issue then was while events couldn't pass it, it could pass through other events still.
« Last Edit: June 21, 2011, 06:00:21 AM by JackHGardner »