Enhanced Staircases

Tutorial Enhanced Staircases

Coolandkar

Levelling Up
Member
Joined
Oct 4, 2020
Posts
3
Age
27
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:
  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
 

Mewtwo1825

Rookie
Member
Joined
Nov 22, 2020
Posts
1
Age
20
Hello Marin,
I recently discovered this code and wanted to use it but I encountered this error whenever I would step on the required event tile. I cant seem to find anything regarding this error so I hope you can help.
---------------------------
Pokemon Essentials
---------------------------
[Pokémon Essentials version 18]

Exception: TypeError

Message: nil can't be coerced into Fixnum

Backtrace:

Enhanced Stairs:417:in `+'

Enhanced Stairs:417:in `slope'

Enhanced Stairs:251:in `start'

Game_Event:142:in `stair_ceta'

Enhanced Stairs:245:in `check_event_trigger_auto'

Game_Event:239:in `update'

Game_Map:414:in `update'

Game_Map:413:in `each'

Game_Map:413:in `update'

Scene_Map:135:in `updateMaps'
 
Top