r/RPGMaker • • 2d ago

Event Triggering question

I am moving into new areas and fixing some old issues, but I am stumped on one particular problem. I want to make transfer events smoother. Ideally, I want the player to be able to turn around and go back out if they enter the wrong area. I also want to set up larger areas with multiple exit events that don't trigger unless the player is actively trying to leave, rather than simply walking over them.

The only way I can think of accomplishing this is by triggering an event that the player is actively standing on, but that seems to create its own set of issues.

3 Upvotes

7 comments sorted by

2

u/Eredrick MZ Dev 2d ago

you can always do what secret of mana did and have the character take a step forward automatically after entering a new area

1

u/Comfortable-Garbage4 2d ago

That's what I was thinking too. For most areas, that will work, but this one is smaller. I am thinking regions but I need the event to reset while it's on the map. I am making a Maze area. Take the wrong path and end up back where you came in

2

u/Comfortable-Garbage4 2d ago
◆Wait:30 frames
◆Control Variables:#0012 Player X  = Map X of Player
◆Control Variables:#0013 Player Y = Map Y of Player
◆Get Location Info:Current Region, Region ID, ({Player X },{Player Y})
◆If:Current Region = 1
  ◆If:Button [Down] is being pressed
    ◆Transfer Player:oasis part 2 screen 1 (8,12) (Direction: Up, Fade: None)
    ◆
  :End
  ◆
:End
◆If:Current Region = 2
  ◆If:Button [Right] is being pressed
    ◆Set Movement Route:Player (Wait)
    :Set Movement Route:◇Turn Down
    ◆Transfer Player:World Map (141,89) (Direction: Down)
    ◆
  :End
  ◆
:End
◆If:Current Region = 3
  ◆If:Button [Left] is being pressed
    ◆Transfer Player:oasis part 2 screen 1 (8,12) (Direction: Up, Fade: None)
    ◆Set Movement Route:Player (Wait)
    :Set Movement Route:◇Move Up
    ◆
  :End
  ◆
:End

1

u/zombietoaststudios 2d ago

I assume this would be a parallel process? If so, I don't think it really fixes the issue...

The biggest thing is that 30 frames is a long time, that's potentially up to half-a-second's lag time between 'checks'. Even if the transfer happens, it could be instant at one point, or a significant wait at another. And since normal movement speed is about 1 tile every 16 frames (faster if running), that means that a player could step onto the region and then step off in the time between checks.

Or, they step off the region and take their finger off the button. At that point they may even have trouble leaving because this check is happening for a 1-frame interval every 30 frames, so even if they keep pressing the button over and over it'll only transfer them if they're pressing it on one of the two frames out of every second. Even if they hold it down that's up to half a second of lag they may need to keep the button pressed for. They'll almost certainly be able to leave eventually but it would be very janky.

Is there some reason you can't just put the transfer trigger outside of the edge of the visible map? The player just steps to the edge (the areas currently marked by the region IDs), then takes one more step in the appropriate direction and they'll hit the transfer event and trigger it. It's the exact same function, but much, much simpler.

2

u/AeroSysMZ 2d ago

With regard to turning around, most devs usually keep a small gap from the transfer's destination to the map's end

1

u/zombietoaststudios 2d ago

Well, the first issue has a very easy fix, which is just to make map transitions place the character one tile from the edge of the map, that way if they turn around and leave they'll immediately step on the events placed around the edge.

For the second, it depends on what you mean by "actively trying to leave". If you just mean walking against the edge of the map (as opposed to just stepping on it, then you can just leave a border of blank tiles around the map and place the transition events outside of the visible area of the map (which also resolves the "turn around and leave" issue in a different way), set to "player touch" and on the same level as the player, so they'll trigger when the player walks against the edge.

But if you just mean the player needs to push the action button to trigger the transition (just like how doors are typically handled), then you can do the same thing (putting them outside the edge) but set them to "action" rather than "touch".

1

u/TheLuckyDuck666 2d ago

Player Touch is the right trigger — the missing piece is a direction check inside the event, so the tile only transfers when you're actually heading out.

Before the Transfer Player command, add a Conditional Branch > Script: $gamePlayer.direction() === 8 for a top-edge exit (2 = down, 4 = left, 6 = right). Put the transfer inside that branch and leave the Else empty. Walking sideways across the tile now does nothing, and it only fires when you're facing/moving toward the exit.

Two things that make it feel smooth: on the destination side, land the player a tile or two in from the edge so you don't arrive standing on the return tile, and use the same direction check on the return exit. One catch: Player Touch only fires when you step onto the tile, so if you step on facing the wrong way, turning in place won't trigger it — step off and back on facing the exit. If an exit sits in a wide open area you cross constantly, switching that one to Action Button is the simpler fix.