How Do I Make a "Border Exit" Without Plopping a Bunch of Event Squares?

Davtwan

Greenhorn
Member
Joined
Feb 7, 2020
Messages
3
Reaction score
4
First Language
English
Primarily Uses
RMMV
I am currently running a "practice project" to learn how to use RPG Maker MV (currently v1.62). The starting town has no fencing around it due to the fact that it is a mostly destroyed town. However, to prevent confusion, I would have to make sure all the borders of the map lead to the overworld and not just the path.

I have tried to make the x and y coordinates of the player into variables so that when the player is at a certain variable (such as the one that would be y = 0), then the event will warp them into the overworld. For example, when the player touches the left edge of the map, then he'd warp to the overworld on the square that's left of the town square. However, the universal exit event has ended up making the player unable to move, probably because the auto-running event never truly "finishes."

I'm thinking of maybe using a script instead of a variable instead, but I don't know what the right $Game_Player that has the current x and y coordinates are. Is there a way to make the borders of a map into an exit with one event square, or am I just better off cutting my losses and fencing the town?
 
Last edited:

ImaginaryVillain

High Cultist of the Sporkle
Veteran
Joined
Jun 22, 2019
Messages
894
Reaction score
5,385
First Language
Absurdism
Primarily Uses
RMMZ
Place this code in a parallel event (using the script command) on the map where you want the border to act as a transfer. Replace mapId with the Id of the map you want to transfer to, and the x, y with the x,y where you want the player to end up at.


edit: The Pastebin insert messes up the code as well... Hmm... Just make certain line 1, and the line with no number below it are on the same line.
 

Shaz

Global Moderators
Global Mod
Joined
Mar 2, 2012
Messages
42,091
Reaction score
14,629
First Language
English
Primarily Uses
RMMV
Autorun event takes away control from the player. If you want something that runs continually in the background, make it a parallel process event instead. Make sure you put a Wait 10 Frames at the start of the event, because there's no way you need to check the player's location 60 times a second.
 

Davtwan

Greenhorn
Member
Joined
Feb 7, 2020
Messages
3
Reaction score
4
First Language
English
Primarily Uses
RMMV
Place this code in a parallel event (using the script command) on the map where you want the border to act as a transfer. Replace mapId with the Id of the map you want to transfer to, and the x, y with the x,y where you want the player to end up at.

Autorun event takes away control from the player. If you want something that runs continually in the background, make it a parallel process event instead. Make sure you put a Wait 10 Frames at the start of the event, because there's no way you need to check the player's location 60 times a second.

Thanks, you two. I feel silly realizing it's literally just the x and y values without any additional info I saw in the javascript library. I combined both your advice into one to make things easier to edit if I ever need to change the exit.

Exit-Script.png

For now it works as a north exit, but I'll see if I can combine more exits on the same event. If not, then four exits won't hurt that much.

Edit: Fantastic! The event doesn't seem confused by additional conditioning branches.
 

Shaz

Global Moderators
Global Mod
Joined
Mar 2, 2012
Messages
42,091
Reaction score
14,629
First Language
English
Primarily Uses
RMMV
Yes, you can combine them all, using nested conditions.

Code:
Wait 10 Frames
If Script: $gamePlayer.y === 0
  Transfer (to above map)
Else
  If Script: $gamePlayer.y === $dataMap.height - 1
    Transfer (to below map)
  Else
    If Script: $gamePlayer.x === 0
      Transfer (to left map)
    Else
      If Script: $gamePlayer.x === $dataMap.width - 1
        Transfer (to right map)
      End
    End
  End
End
 

Davtwan

Greenhorn
Member
Joined
Feb 7, 2020
Messages
3
Reaction score
4
First Language
English
Primarily Uses
RMMV
Yes, you can combine them all, using nested conditions.

Oh shoot. Thanks for reminding me. I didn't use the Else branches the first time around. That sounds more stable to do, so I'll definitely do that.
 

Bex

Veteran
Veteran
Joined
Aug 2, 2013
Messages
1,502
Reaction score
411
First Language
German
Primarily Uses
RMMV
In your Parallel Event, use the Eventcommand Conditional Branch and put this into the Scriptline:
$gamePlayer.regionId() === 1
if yes: Teleport

Now Paint Region 1 everywhere on the Map boarders where you want the Player to trigger the Teleport.

This could also be done with 100% Eventing, but Scriptsnippets are awesome, the RMMV Sciptcall list helped me with it.
 

Latest Threads

Latest Posts

Latest Profile Posts

For every amazing step of the way I make, I find myself in a moment where I feel really stupid for not knowing something. I probably shouldn't though, but still, it sometimes feels more obvious than perhaps it is
Just spent $174 on Shining the Holy Ark on the Saturn. Good lord.
My brain when designing quests:
There is piano, it needs help --> The organ (yes organ now) is missing a component! --> Where the heck am I supposed to put this missing piece!??! --> Add an entire new mini dungeon specifically created to house this new piece. --> Connect this brand new mini dungeon to an already designed dungeon with background information about the town it's found it.

Me: :LZYhuh:
Rising of the Shield Hero!
Sheesh, Guys, don't think you can throw easy prices like $25/$50 on potions/ethers then have monsters pay you $75 for killing them (never understood that concept btw lol) and think it'll all work out!!! Just realized my prcies vs payout left my players unable to get decent stuff without some serious farming from the start, i'm about to call H&R Block to help my MC get his stimulus check just to buy new armor :LZSlol:

Forum statistics

Threads
111,097
Messages
1,058,235
Members
144,296
Latest member
Sharei
Top