RMRK is retiring.
Server is paid up for the rest of 2026, but the forum may go after that. See here for more information. Please archive or save anything you would like to keep before 2027.
Main Menu
  • Welcome to The RPG Maker Resource Kit.

[REQUEST] Map Scroll

Started by denzel, June 09, 2008, 10:52:51 AM

0 Members and 1 Guest are viewing this topic.

denzel

it says im missing SDK part 1 and 2
can anyone tell me why?
and please post SDK 1 and 2

[spoiler]

#============================================================================
# ** Zelda Map Scroll
#----------------------------------------------------------------------------
# Yeyinde
# 1.1.0
# 05/26/07
# SDK Version : (2.2) - Parts: I, II
# Notes:
#   Try and get your maps a nice even multiple size of 20x15.  It makes the
#   scrolling a tad bit better.
#============================================================================

#-----------------------------------------------------------------------------
# SDK Auto-installer
#-----------------------------------------------------------------------------
unless Object.const_defined?(:SDK)
  begin
    require 'SDK'
  rescue LoadError
    print 'This script (Zelda Map Scroll) requires the SDK to run.'
    exit 1
  end
end

#-----------------------------------------------------------------------------
# SDK Log
#-----------------------------------------------------------------------------
SDK.log('Zelda Map Scroll', 'Yeyinde', '1.10', '05/26/07')

#-----------------------------------------------------------------------------
# SDK Check Requirements
#-----------------------------------------------------------------------------
SDK.check_requirements(2.2, [1, 2])

#-----------------------------------------------------------------------------
# SDK Enabled Check
#-----------------------------------------------------------------------------
if SDK.enabled?('Zelda Map Scroll')

#==============================================================================
# ** Zelda_Map_Scroll
#------------------------------------------------------------------------------
#  Customization module
#------------------------------------------------------------------------------
module Zelda_Map_Scroll
  # How fast the screen will scroll (1 being the slowest, 7 being the fastest)
  SCROLL_SPEED = 6
  # If the player will wait for the scrolling to finish before moving again
  SCROLL_WAIT = true
  # How long the player will wait during each scroll (In frames)
  SCROLL_WAIT_PERIOD_Y = 10
  SCROLL_WAIT_PERIOD_X = 16
end

#==============================================================================
# ** Game_Player
#------------------------------------------------------------------------------
#  This class handles the player. Its functions include event starting
#  determinants and map scrolling. Refer to "$game_player" for the one
#  instance of this class.
#==============================================================================

class Game_Player
  #---------------------------------------------------------------------------
  # * Overwrite methods
  #---------------------------------------------------------------------------
  SDK.log_overwrite('Game_Player', 'center')
  SDK.log_overwrite('Game_Player', 'update_scroll_down')
  SDK.log_overwrite('Game_Player', 'update_scroll_left')
  SDK.log_overwrite('Game_Player', 'update_scroll_right')
  SDK.log_overwrite('Game_Player', 'update_scroll_up')
  #---------------------------------------------------------------------------
  # * Object Initialization
  #---------------------------------------------------------------------------
  def initialize
    # Call superclass' initialize
    super
    # Make the wait while scrolling variable (Y)
    @scroll_wait_y = RPG::MoveRoute.new
    # Make it so it does not repeat
    @scroll_wait_y.repeat = false
    # Make the wait command
    @scroll_wait_y.list[0].code = 15
    @scroll_wait_y.list[0].parameters = [Zelda_Map_Scroll::SCROLL_WAIT_PERIOD_Y]
    # Add a blank move command to signify the end
    @scroll_wait_y.list << RPG::MoveCommand.new
    # Make the wait while scrolling variable (X)
    @scroll_wait_x = RPG::MoveRoute.new
    # Make it so it does not repeat
    @scroll_wait_x.repeat = false
    # Make the wait command
    @scroll_wait_x.list[0].code = 15
    @scroll_wait_x.list[0].parameters = [Zelda_Map_Scroll::SCROLL_WAIT_PERIOD_X]
    # Add a blank move command to signify the end
    @scroll_wait_x.list << RPG::MoveCommand.new
  end
  #---------------------------------------------------------------------------
  # * Set Map Display Position to Center of Screen
  #---------------------------------------------------------------------------
  def center(x, y)
    # Get the maximum distance from the top-left corner
    max_x = ($game_map.width - 20) * 128
    max_y = ($game_map.height - 15) * 128
    # Get the minimum distance to make
    min_x = (x - x % 20) * 128
    min_y = (y - y % 15) * 128
    $game_map.display_x = [0, [min_x, max_x].min].max
    $game_map.display_y = [0, [min_y, max_y].min].max
  end
  #--------------------------------------------------------------------------
  # * Frame Update : Scroll Down
  #--------------------------------------------------------------------------
  def update_scroll_down(last_real_y)
    # If character moves down off the display area
    if @real_y > last_real_y and @real_y - $game_map.display_y > CENTER_Y * 2
      # Scroll map down
      $game_map.start_scroll(2, 15, Zelda_Map_Scroll::SCROLL_SPEED)
      # Wait for scrolling to finish
      force_move_route(@scroll_wait_y) if Zelda_Map_Scroll::SCROLL_WAIT
    end
  end
  #--------------------------------------------------------------------------
  # * Scroll Left
  #--------------------------------------------------------------------------
  def update_scroll_left(last_real_x)
    # If character moves left off the display area
    if @real_x < last_real_x and @real_x < $game_map.display_x
      # Scroll map left
      $game_map.start_scroll(4, 20, Zelda_Map_Scroll::SCROLL_SPEED)
      # Wait for scrolling to finish
      force_move_route(@scroll_wait_x) if Zelda_Map_Scroll::SCROLL_WAIT
    end
  end
  #--------------------------------------------------------------------------
  # * Scroll Right
  #--------------------------------------------------------------------------
  def update_scroll_right(last_real_x)
    # If character moves right off the display area
    if @real_x > last_real_x and @real_x - $game_map.display_x > CENTER_X * 2
      # Scroll map right
      $game_map.start_scroll(6, 20, Zelda_Map_Scroll::SCROLL_SPEED)
      # Wait for scrolling to finish
      force_move_route(@scroll_wait_x) if Zelda_Map_Scroll::SCROLL_WAIT
    end
  end
  #--------------------------------------------------------------------------
  # * Scroll Up
  #--------------------------------------------------------------------------
  def update_scroll_up(last_real_y)
    # If character moves up off the display area
    if @real_y < last_real_y and @real_y < $game_map.display_y
      # Scroll map up
      $game_map.start_scroll(8, 15, Zelda_Map_Scroll::SCROLL_SPEED)
      # Wait for scrolling to finish
      force_move_route(@scroll_wait_y) if Zelda_Map_Scroll::SCROLL_WAIT
    end
  end
end

end
#-----------------------------------------------------------------------------
# End SDK Enabled Check
#-----------------------------------------------------------------------------




[/spoiler]

Falcon

Strike 1. This belongs in script request.

denzel

but i was also asking why is this happening?

ahref

#3
also you should have read this:
Quote from: falcon2. Search other forums!
Please, before posting a request, take the time to go to hbgames.org or creationaslyum.net and look through their script database, they have a lot more scripts then we do here. Link to the .org script archive is below.
http://www.hbgames.org/forums/showthread.php?t=3353

the sdk is developed and maintained there

denzel

i know that and also a member
but they script isn't working