• Do not use Discord to host any images you post, these links expire quickly! You can learn how to add images to your posts here.
  • Eevee Expo's webhost has been having technical issues since Nov. 20th and you might be unable to connect to our site. Staff are also facing issues connecting, so please send a DM to Cat on-site or through Discord directly for faster service!
Resource icon

v20.1 Flexible ladders 2023-03-30

This resource pertains to version 20.1 of Pokémon Essentials.
Pokémon Essentials Version
v20.1 ➖
The issue at hand
You're creating a cave and letting the player transfer to another area using a ladder. Then you change your map including the location of the ladders and... oops, now you have to adapt all the transfer events.

What it does
Using this, you can easily transfer the player between two "paired" events without having to specify where you want the player to go (so no "Transfer Player" event command or similar). It makes transfers more flexible because you can simply change the location of your paired events and the transfer is adapted automatically. The player always ends up one tile below the paired event.

How to make it work
This small code snippet automates transfers. All you need is a pair of ladders and an event for each of the ladders with the names "Ladder1do" and "Ladder1up". You can use infinite ladder pairs (Ladder2do, Ladder2up, etc...). The trigger method of the events should be "Player Touch". Inside each event, you put a script command "pbLadder". Then, add this code above Main:

Ruby:
Expand Collapse Copy
def pbLadder

  # Identify name and number of ladder event the player is touching
  interp = pbMapInterpreter
  this_event = interp.get_self
  name = this_event.name.to_s
  no = name[/\d+/].to_s
  
  # Determine corresponding ladder (up/down)
  corr = name.include?("do") ? "up" : "do"

  # Search for the corresponding ladder on map
  event = $game_map.events.values.find { |e| 
    e.name.include?("Ladder") && e.name.include?(no) && e.name.include?(corr) 
  }
 
  # Transfer to corresponding ladder
  if event
    pbSEPlay("Door exit", 100)
    pbFadeOutIn {
      $game_temp.player_new_map_id    = $game_map.map_id # Stay on the same map
      $game_temp.player_new_x         = event.x
      $game_temp.player_new_y         = event.y + 1
      $game_temp.player_new_direction = 2
      $scene.transfer_player
      $game_map.autoplay
      $game_map.refresh
    }
  end
    
end

Limitations
I'm talking about ladders in a cave because the script is currently limited to paired events on the same map (so your entire cave needs to be on one map). So with this, you can't transfer the player in between maps. But I believe this could be easily added. I'm not a professional coder however. So, you could even use this for all transfers in your game (for example also for transfers into and out of houses). All you need is to pair events logically using their names. Also, it's currently limited to 9 event pairs because it just checks if a number is included in the event name (so if you use for example the number 15 in your event name, it will assume that that's ladder 1). But again, this can also easily be adapted to work with even more events.
Credits
None (maybe some ChatGPT)
  • Like
Reactions: TechSkylander1518
Author
SunriseStudios
Views
1,330
First release
Last update

Ratings

0.00 star(s) 0 ratings

More resources from SunriseStudios

Back
Top