• The Eevee Expo Game Jam #10 has concluded, congratulations to all participants! Now it's time for the judges to play through the games, and you can play along to vote who deserves the community choice spotlight.
    You can check out the submitted games here!
    Play through the games and provide some feedback to the devs while you're at it!
  • Hi, Guest!
    Some images might be missing as we move away from using embedded images, sorry for the mess!
    From now on, you'll be required to use a third party to host images. You can learn how to add images here, and if your thread is missing images you can request them here.
    Do not use Discord to host any images you post, these links expire quickly!
Marin's Enhanced Staircases

Resource Marin's Enhanced Staircases v1.0

Coolandkar

Exploring Unova
Member
Joined
Oct 4, 2020
Posts
3
I don't have v17 versions of my scripts anymore, as I overwrote those files. I'll see if my GDrive backed this particular script up, but that'll be an exception.
Marin is this the v1.6 script we are looking for? I asked in October 19th but you didn’t reply.
If it is you don’t have to search for it :)

 

Screedledude

Rookie
Member
Joined
Jul 4, 2020
Posts
2
Hello, I made a fix for this script for version 18.1. The newest version of essentials changed how jumps work, and this script thus overwrote the new jump method, causing the player to glide over ledges.
This script change starts at around line 507, with "def screen_Y":

Ruby:
Expand Collapse Copy
  def screen_y
    ret = screen_y_ground # new - required for v18.1 jump mechanic
    real_y = @real_y
    if on_stair?
      if @real_x / Game_Map::X_SUBPIXELS.to_f <= @stair_start_x * Game_Map::TILE_WIDTH &&
         @stair_end_x < @stair_start_x
        distance = (@stair_start_x - @stair_end_x) * Game_Map::REAL_RES_X -
            2.0 * @stair_begin_offset * Game_Map::X_SUBPIXELS
        rpos = @real_x - @stair_end_x * Game_Map::REAL_RES_X - @stair_begin_offset * Game_Map::X_SUBPIXELS
        fraction = 1 - rpos / distance.to_f
        if fraction >= 0 && fraction <= 1
          diff = fraction * (@stair_end_y - @stair_start_y) * Game_Map::REAL_RES_Y
          real_y += diff
          if self.is_a?(Game_Player)
            if SMOOTH_SCROLLING
              @view_offset_y += diff - (@stair_last_increment || 0)
            else
              $game_map.scroll_down(diff - (@stair_last_increment || 0))
            end
          end
          @stair_last_increment = diff
        end
        if fraction >= 1
          endy = @stair_end_y
          if @stair_end_y < @stair_start_y
            endy -= @stair_y_position
          else
            endy -= @stair_y_position
          end
          @y = endy
          @real_y = endy * Game_Map::REAL_RES_Y
          @view_offset_y = 0 if SMOOTH_SCROLLING && self.is_a?(Game_Player)
          clear_stair_data
          return stair_screen_y
        end
      elsif @real_x / Game_Map::X_SUBPIXELS.to_f >= @stair_start_x * Game_Map::TILE_WIDTH &&
          @stair_end_x > @stair_start_x
        distance = (@stair_end_x - @stair_start_x) * Game_Map::REAL_RES_X -
            2.0 * @stair_begin_offset * Game_Map::X_SUBPIXELS
        rpos = @stair_start_x * Game_Map::REAL_RES_X - @real_x + @stair_begin_offset * Game_Map::X_SUBPIXELS
        fraction = rpos / distance.to_f
        if fraction <= 0 && fraction >= -1
          diff = fraction * (@stair_start_y - @stair_end_y) * Game_Map::REAL_RES_Y
          real_y += diff
          if self.is_a?(Game_Player)
            if SMOOTH_SCROLLING
              @view_offset_y += diff - (@stair_last_increment || 0)
            else
              $game_map.scroll_down(diff - (@stair_last_increment || 0))
            end
          end
          @stair_last_increment = diff
        end
        if fraction <= -1
          endy = @stair_end_y
          if @stair_end_y < @stair_start_y
            endy -= @stair_y_position
          else
            endy -= @stair_y_position
          end
          @y = endy
          @real_y = endy * Game_Map::REAL_RES_Y
          @view_offset_y = 0 if SMOOTH_SCROLLING && self.is_a?(Game_Player)
          clear_stair_data
          return stair_screen_y
        end
      else
        clear_stair_data
      end
    # elsif jumping?
      # n = (@jump_count - @jump_peak).abs
      # return (real_y - self.map.display_y + 3) / 4 + Game_Map::TILE_HEIGHT -
          # (@jump_peak * @jump_peak - n * n) / 2
    # end
    # Edit start
    elsif jumping?
      if @jump_count > 0
        jump_fraction = ((@jump_count * jump_speed_real / Game_Map::REAL_RES_X) - 0.5).abs   # 0.5 to 0 to 0.5
      else
        jump_fraction = ((@jump_distance_left / @jump_distance) - 0.5).abs   # 0.5 to 0 to 0.5
      end
      ret += @jump_peak * (4 * jump_fraction**2 - 1)
    end
    if jumping?
        return ret
    end
    #
    return (real_y - self.map.display_y + 3) / 4 + (Game_Map::TILE_HEIGHT)
  end
end
 

Abundantmoderation

Rookie
Member
Joined
Jan 30, 2021
Posts
2
Hello, I made a fix for this script for version 18.1. The newest version of essentials changed how jumps work, and this script thus overwrote the new jump method, causing the player to glide over ledges.
This script change starts at around line 507, with "def screen_Y":

Ruby:
Expand Collapse Copy
  def screen_y
    ret = screen_y_ground # new - required for v18.1 jump mechanic
    real_y = @real_y
    if on_stair?
      if @real_x / Game_Map::X_SUBPIXELS.to_f <= @stair_start_x * Game_Map::TILE_WIDTH &&
         @stair_end_x < @stair_start_x
        distance = (@stair_start_x - @stair_end_x) * Game_Map::REAL_RES_X -
            2.0 * @stair_begin_offset * Game_Map::X_SUBPIXELS
        rpos = @real_x - @stair_end_x * Game_Map::REAL_RES_X - @stair_begin_offset * Game_Map::X_SUBPIXELS
        fraction = 1 - rpos / distance.to_f
        if fraction >= 0 && fraction <= 1
          diff = fraction * (@stair_end_y - @stair_start_y) * Game_Map::REAL_RES_Y
          real_y += diff
          if self.is_a?(Game_Player)
            if SMOOTH_SCROLLING
              @view_offset_y += diff - (@stair_last_increment || 0)
            else
              $game_map.scroll_down(diff - (@stair_last_increment || 0))
            end
          end
          @stair_last_increment = diff
        end
        if fraction >= 1
          endy = @stair_end_y
          if @stair_end_y < @stair_start_y
            endy -= @stair_y_position
          else
            endy -= @stair_y_position
          end
          @y = endy
          @real_y = endy * Game_Map::REAL_RES_Y
          @view_offset_y = 0 if SMOOTH_SCROLLING && self.is_a?(Game_Player)
          clear_stair_data
          return stair_screen_y
        end
      elsif @real_x / Game_Map::X_SUBPIXELS.to_f >= @stair_start_x * Game_Map::TILE_WIDTH &&
          @stair_end_x > @stair_start_x
        distance = (@stair_end_x - @stair_start_x) * Game_Map::REAL_RES_X -
            2.0 * @stair_begin_offset * Game_Map::X_SUBPIXELS
        rpos = @stair_start_x * Game_Map::REAL_RES_X - @real_x + @stair_begin_offset * Game_Map::X_SUBPIXELS
        fraction = rpos / distance.to_f
        if fraction <= 0 && fraction >= -1
          diff = fraction * (@stair_start_y - @stair_end_y) * Game_Map::REAL_RES_Y
          real_y += diff
          if self.is_a?(Game_Player)
            if SMOOTH_SCROLLING
              @view_offset_y += diff - (@stair_last_increment || 0)
            else
              $game_map.scroll_down(diff - (@stair_last_increment || 0))
            end
          end
          @stair_last_increment = diff
        end
        if fraction <= -1
          endy = @stair_end_y
          if @stair_end_y < @stair_start_y
            endy -= @stair_y_position
          else
            endy -= @stair_y_position
          end
          @y = endy
          @real_y = endy * Game_Map::REAL_RES_Y
          @view_offset_y = 0 if SMOOTH_SCROLLING && self.is_a?(Game_Player)
          clear_stair_data
          return stair_screen_y
        end
      else
        clear_stair_data
      end
    # elsif jumping?
      # n = (@jump_count - @jump_peak).abs
      # return (real_y - self.map.display_y + 3) / 4 + Game_Map::TILE_HEIGHT -
          # (@jump_peak * @jump_peak - n * n) / 2
    # end
    # Edit start
    elsif jumping?
      if @jump_count > 0
        jump_fraction = ((@jump_count * jump_speed_real / Game_Map::REAL_RES_X) - 0.5).abs   # 0.5 to 0 to 0.5
      else
        jump_fraction = ((@jump_distance_left / @jump_distance) - 0.5).abs   # 0.5 to 0 to 0.5
      end
      ret += @jump_peak * (4 * jump_fraction**2 - 1)
    end
    if jumping?
        return ret
    end
    #
    return (real_y - self.map.display_y + 3) / 4 + (Game_Map::TILE_HEIGHT)
  end
end
Came here to see if there was any fix for this. I’ll try it later! Cheers
 

Damparo

Rookie
Member
Joined
Jul 15, 2021
Posts
1
Will this work with v19.1?
Hi, first time actually using the forum, be patient with me.
I am currently using v19.1 and the enhanced staircases. It works, after a couple of simple changes. Disclaimer: I just solved the issue. This solution might cause some other malfunctioning of the script. As far as I know, it works.

First, follow what Screedledude said above.

Now go around row 290 and look for the lines
Original:
Expand Collapse Copy
  alias stair_cetc check_event_trigger_touch
  def check_event_trigger_touch(x,y)
    return if on_stair?
    return stair_cetc(x,y)
  end
Change (x,y) into (dir) on both lines.

Now go over the whole script and look for occurrences of
Code to look for:
Expand Collapse Copy
check_event_trigger_touch(@x, @y)
Note that in the parenthesis you might find some + or - 1. Now depending on their presence, change (@x,@y) into (number) where number is
Correspondence (x,y) => (dir):
Expand Collapse Copy
(@x+1,@y  ) -> (6)
(@x  ,@y+1) -> (2)
(@x-1,@y  ) -> (4)
(@x  ,@y-1) -> (8)

If you miss some of the occurrences, don't worry. When you interact with an event or wall the game will crash and tell you the line where the missed occurrence is. Anyway, there should be 4 occurrences at lines 318, 337, 440, 452.

I hope it works!
 
Last edited:

DerxwnaKapsyla

Overseer of the Abyss
Member
Joined
Apr 24, 2017
Posts
152
For some reason I'm having issues where i'm getting stuck on one of the stair tiles, but only when going down it from its corresponding tile on higher up.


This is what the event looks like


It's the same as the event next to it, just 2/3 instead of 1/3 or 0/3
 
EDIT: Anyone reading this thread, I’m totally in the wrong here, ignore this post

Oh, I think the issue is that you're thinking of the width of the staircase from the character's perspective, but it's supposed to be the width the stairs are taking on the map itself. So like, it's not supposed to be this
1631738936153.png


It's supposed to be this:

1631738873611.png
 
Last edited:

DerxwnaKapsyla

Overseer of the Abyss
Member
Joined
Apr 24, 2017
Posts
152
Oh, I think the issue is that you're thinking of the width of the staircase from the character's perspective, but it's supposed to be the width the stairs are taking on the map itself. So like, it's not supposed to be this
View attachment 6791

It's supposed to be this:

View attachment 6790
So, what would I set the values to in this scenario? I tried setting the width value to "x/4", but that just regards the cliff tile as a slope tile as well.
 

DerxwnaKapsyla

Overseer of the Abyss
Member
Joined
Apr 24, 2017
Posts
152
That still doesn't fix it, and it introduces the problem I mentioned earlier where I can now walk onto the cliff tiles next to the stairs

 

DerxwnaKapsyla

Overseer of the Abyss
Member
Joined
Apr 24, 2017
Posts
152
They weren't before; I set them to 3/4 just now and that exacerbated the problem. Initially they were set to 1/4, 2/4, and 3/4. The only time I was prevented from walking on the cliff tile was when I had it set to x/3
 
Ah, whoops, rereading the instructions and realizing I misinterpreted the thing about width, you were right in the first place to have it arranged like you did. 😅

I think this might be something where you need to play around with the Offset value- since your tiles are a bit steeper and go into the cliffs, I'm wondering if there's not some point in your slope where the game thinks you're bumping into a non-passable tile in the cliffside.
 

Golisopod User

Elite Trainer
Member
Joined
May 11, 2020
Posts
319
For some reason I'm having issues where i'm getting stuck on one of the stair tiles, but only when going down it from its corresponding tile on higher up.


This is what the event looks like


It's the same as the event next to it, just 2/3 instead of 1/3 or 0/3

You should probably go over the thread thoroughly once. The thread mentions a few staicase examples, which show what kinds of staircases are bad, and what are good. And your stairs fall under an extended version of example 2 ie bad stairs. That's why you're struggling to find appropriate offset values. You'll need to change your stairs to work like the other examples mentioned there.
 

Evan

game director, Pokémon Sea & Sky
Member
Version for v19.1, basically just v17 with Screedledude's fix for jumping and Damparo's fix for the event triggers. (Although I made it refer to @direction instead of constants, just in case)
I cannot tell you how great your timing was. I was using a version of Marin's v18 one with Damparo's fix but I didn't realize Screedledude did a fix for the jumping and I was tearing my hair out trying to figure out why I couldn't jump over ledges! Thank you for posting this and packaging it all together nicely >.<
 
I cannot tell you how great your timing was. I was using a version of Marin's v18 one with Damparo's fix but I didn't realize Screedledude did a fix for the jumping and I was tearing my hair out trying to figure out why I couldn't jump over ledges! Thank you for posting this and packaging it all together nicely >.<
Haha, it's funny that you say that, because I was starting with just Screedledude's fix and almost did Damparo's from scratch before I saw it here! Seems everyone's got each other's back with this script!
 
Back
Top