[RESOLVED] [XP] Touch trigger on passable tile in a non-passable direction?

Started by Nath, September 04, 2016, 01:07:00 pm

Previous topic - Next topic

Nath

This Events Troubleshooting section seems pretty sparse, but... I have a thing. :P

So here's my situation: I have a place on one map that has a ledge, which can be hopped down from, but not back up onto, as pictured below.

Spoiler: ShowHide


The events shown are set to trigger on Player Touch, and they check for the direction the player is facing, then hop down from the ledge. The lower ones drop 2 squares down, whereas the ones on the right edge drop down one, and right one.

Spoiler: ShowHide


The issue I'm having is that only these circled ones work, because the tile beneath the events are impassable. These ones work perfectly, as intended.

Spoiler: ShowHide


These others do not work, because RMXP expects the player to have to actually walk on top of the tile to trigger it. The player can't actually do that, because the ledge tile doesn't allow walking to and from it's right edge.

Spoiler: ShowHide


Moving the events to the top of the ledge would cause the player to jump as soon as they stand there, rather than having to actually move toward the edge, which is undesirable. My current (and hopefully temporary) fix is to move the events up to the top and have them trigger on the Action Button instead, but this is... suboptimal...

Is there any solution to this that I'm just not clever enough to figure out?

Blizzard

There is a way, but it's a bit of manual work. Once you jump down, turn on the "Through" flag on the 3 events. When you reenter the map depending on where you enter (not the two entrances in the top right), you have to redo that with a parallel process event.

There is also a way to do this more conveniently with a script by using terrain tags.
Check out Daygames and our games:

King of Booze 2      King of Booze: Never Ever
Drinking Game for Android      Never have I ever for Android
Drinking Game for iOS      Never have I ever for iOS


Quote from: winkioI do not speak to bricks, either as individuals or in wall form.

Quote from: Barney StinsonWhen I get sad, I stop being sad and be awesome instead. True story.

Nath

Well, the issue is that I can't jump down in the first place.

I might have to resort to... scripting   D:

EDIT: In the meantime, I solved the issue by using other events (placed on the ledge) to give the jump events impassable graphics when I'm adjacent to them. It's a very silly and inefficient solution, but I'm not quite skilled enough at scripting to know how to use terrain tags, yet.

KK20

Can you try using this code and do what you were normally doing with your events? I changed it so that the game triggers the touch if the direction the player is moving in is impassable along with if the event's location cannot pass through the opposite direction (e.g. checks if player cannot move to the right OR if the event cannot move to the left).

class Game_Event
  #--------------------------------------------------------------------------
  # * Determine if Over Trigger
  #    (whether or not same position is starting condition)
  #--------------------------------------------------------------------------
  def over_trigger?(x = @x, y = @y, d = 0)
    # If not through situation with character as graphic
    if @character_name != "" and not @through
      # Starting determinant is face
      return false
    end
    # If this position on the map is impassable
    if !$game_map.passable?(x, y, d) || !$game_map.passable?(@x, @y, 10 - d)
      # Starting determinant is face
      return false
    end
    # Starting determinant is same position
    return true
  end
end

class Game_Player
  #--------------------------------------------------------------------------
  # * Touch Event Starting Determinant
  #--------------------------------------------------------------------------
  def check_event_trigger_touch(x, y, d = 0)
    # Direction the character is moving
    d = case [@x - x, @y - y]
        when [-1,0] then 6 # Right
        when [1,0]  then 4 # Left
        when [0,-1] then 2 # Down
        when [0,1]  then 8 # Up
        else 0
        end
    result = false
    # If event is running
    if $game_system.map_interpreter.running?
      return result
    end
    # All event loops
    for event in $game_map.events.values
      # If event coordinates and triggers are consistent
      if event.x == x and event.y == y and [1,2].include?(event.trigger)
        # If starting determinant is front event (other than jumping)
        if not event.jumping? and not event.over_trigger?(@x, @y, d)
          event.start
          result = true
        end
      end
    end
    return result
  end
end

Other Projects
RPG Maker XP Ace  Upgrade RMXP to RMVXA performance!
XPA Tilemap  Tilemap rewrite with many features, including custom resolution!

Nintendo Switch Friend Code: 8310-1917-5318
Discord: KK20 Tyler#8901

Join the CP Discord Server!

Nath

Woo! It works perfectly!  :D

KK20's Special Touching script does the trick!  :naughty: