Thread Rating:
  • 1 Vote(s) - 5 Average
  • 1
  • 2
  • 3
  • 4
  • 5
 Neo Mode 7 Script by MGCaladtogel
#34
Try this script to add looping maps (add [L] in maps names) :

Code:
#============================================================================
# Map Looping
# Extracted from Neo Mode 7 script
# MGC
#
# Add [L] in the maps names to define looping maps
#============================================================================

# To access maps names
$data_maps = load_data("Data/MapInfos.rxdata")

#============================================================================
# ** RPG::MapInfo
#============================================================================

class RPG::MapInfo
  # defines the map's name as the name without anything within brackets,
  # including brackets
  def name
    return @name.gsub(/\[.*\]/) {""}
  end
  #--------------------------------------------------------------------------
  # the original name with the codes
  def fullname
    return @name
  end
end


#============================================================================
# ** Game_System
#----------------------------------------------------------------------------
# Add attributes to this class
#============================================================================

class Game_System
  #--------------------------------------------------------------------------
  # * Aliased methods (F12 compatibility)
  #--------------------------------------------------------------------------
  unless @already_aliased
    alias initialize_mapLooping_game_system initialize
    @already_aliased = true
  end
  #--------------------------------------------------------------------------
  # * Attributes
  #--------------------------------------------------------------------------
  attr_accessor :mapLooping # true : map looping mode
  #--------------------------------------------------------------------------
  # * Object Initialization
  #--------------------------------------------------------------------------
  def initialize
    initialize_mapLooping_game_system
    self.mapLooping = false
  end
end


#============================================================================
# ** Game_Map
#----------------------------------------------------------------------------
# Methods modifications to handle map looping
#============================================================================

class Game_Map
  #--------------------------------------------------------------------------
  # * Aliased methods (F12 compatibility)
  #--------------------------------------------------------------------------
  unless @already_aliased
    alias scroll_down_mapLooping_game_map scroll_down
    alias scroll_left_mapLooping_game_map scroll_left
    alias scroll_right_mapLooping_game_map scroll_right
    alias scroll_up_mapLooping_game_map scroll_up
    alias valid_mapLooping_game_map? valid?
    alias passable_mapLooping_game_map? passable?
    alias old_setup_mapLooping setup
    @already_aliased = true
  end
  #--------------------------------------------------------------------------
  # * Scroll Down
  #     distance : scroll distance
  #--------------------------------------------------------------------------
  def scroll_down(distance)
    unless $game_system.mapLooping
      scroll_down_mapLooping_game_map(distance)
      return
    end
    @display_y = @display_y + distance
  end
  #--------------------------------------------------------------------------
  # * Scroll Left
  #     distance : scroll distance
  #--------------------------------------------------------------------------
  def scroll_left(distance)
    unless $game_system.mapLooping
      scroll_left_mapLooping_game_map(distance)
      return
    end
    @display_x = @display_x - distance
  end
  #--------------------------------------------------------------------------
  # * Scroll Right
  #     distance : scroll distance
  #--------------------------------------------------------------------------
  def scroll_right(distance)
    unless $game_system.mapLooping
      scroll_right_mapLooping_game_map(distance)
      return
    end
    @display_x = @display_x + distance
  end
  #--------------------------------------------------------------------------
  # * Scroll Up
  #     distance : scroll distance
  #--------------------------------------------------------------------------
  def scroll_up(distance)
    unless $game_system.mapLooping
      scroll_up_mapLooping_game_map(distance)
      return
    end
    @display_y = @display_y - distance
  end
  #--------------------------------------------------------------------------
  # * Determine Valid Coordinates
  #     x          : x-coordinate
  #     y          : y-coordinate
  #   Allow the hero to go out of the map when map looping
  #--------------------------------------------------------------------------
  def valid?(x, y)
    unless $game_system.mapLooping
      return valid_mapLooping_game_map?(x, y)
    end
    if $game_system.mapLooping then return true end
    return (x >= 0 && x < width && y >= 0&& y < height)
  end
  #--------------------------------------------------------------------------
  # * Determine if Passable
  #     x          : x-coordinate
  #     y          : y-coordinate
  #     d          : direction (0,2,4,6,8,10)
  #                  *  0,10 = determine if all directions are impassable
  #     self_event : Self (If event is determined passable)
  #--------------------------------------------------------------------------
  def passable?(x, y, d, self_event = nil)
    unless $game_system.mapLooping
      return passable_mapLooping_game_map?(x, y, d, self_event)
    end
    unless valid?(x, y)
      return false
    end
    bit = (1 << (d / 2 - 1)) & 0x0f
    for event in events.values
      if event.tile_id >= 0 and event != self_event and
         event.x == x and event.y == y and not event.through
        if @passages[event.tile_id] & bit != 0
          return false
        elsif @passages[event.tile_id] & 0x0f == 0x0f
          return false
        elsif @priorities[event.tile_id] == 0
          return true
        end
      end
    end
    for i in [2, 1, 0]
      tile_id = data[x % width, y % height, i] # handle map looping
      if tile_id == nil
        return false
      elsif @passages[tile_id] & bit != 0
        return false
      elsif @passages[tile_id] & 0x0f == 0x0f
        return false
      elsif @priorities[tile_id] == 0
        return true
      end
    end
    return true
  end
  #--------------------------------------------------------------------------
  # * Setup
  #     map_id : map ID
  #--------------------------------------------------------------------------
  def setup(map_id)
    old_setup_mapLooping(map_id)
    map_data = $data_maps[$game_map.map_id]
    $game_system.mapLooping = map_data.fullname.include?("[L]")
  end
end


#============================================================================
# ** Game_Character
#----------------------------------------------------------------------------
# "update" method modifications to handle map looping
#============================================================================

class Game_Character
  #--------------------------------------------------------------------------
  # * Aliased methods (F12 compatibility)
  #--------------------------------------------------------------------------
  unless @already_aliased
    alias initialize_mapLooping_game_character initialize
    alias update_mapLooping_game_character update
    @already_aliased = true
  end
  #--------------------------------------------------------------------------
  # * Attributes
  #--------------------------------------------------------------------------
  attr_accessor :x
  attr_accessor :y
  attr_accessor :real_x
  attr_accessor :real_y
  attr_accessor :map_number_x # map's number with X-looping
  attr_accessor :map_number_y # map's number with Y-looping
  #--------------------------------------------------------------------------
  # * Object Initialization
  #--------------------------------------------------------------------------
  def initialize
    initialize_mapLooping_game_character
    self.map_number_x = 0
    self.map_number_y = 0
  end
  #--------------------------------------------------------------------------
  # * Update : handle map looping
  #--------------------------------------------------------------------------
  def update
    unless $game_system.mapLooping
      update_mapLooping_game_character
      return
    end
    # if x-coordinate is out of the map
    unless (x.between?(0, $game_map.width - 1))
      difference = 128 * x - real_x
      if self.is_a?(Game_Player)
        # increase or decrease map's number
        self.map_number_x += difference / (difference.abs)
      end
      # x-coordinate is equal to its equivalent in the map
      self.x %= $game_map.width
      self.real_x = 128 * x - difference
    end
    # if y-coordinate is out of the map
    unless (y.between?(0, $game_map.height - 1))
      difference = 128 * y - real_y
      if self.is_a?(Game_Player)
        # increase or decrease map's number
        self.map_number_y += difference / (difference.abs)
      end
      # y-coordinate is equal to its equivalent in the map
      self.y %= $game_map.height
      self.real_y = 128 * y - difference
    end
    update_mapLooping_game_character
  end
end


#============================================================================
# ** Game_Player
#============================================================================

class Game_Player < Game_Character
  #--------------------------------------------------------------------------
  # * Aliased methods (F12 compatibility)
  #--------------------------------------------------------------------------
  unless @already_aliased
    alias center_mapLooping_game_player center
    @already_aliased = true
  end
  #--------------------------------------------------------------------------
  # * Always center around the hero if map looping
  #--------------------------------------------------------------------------
  def center(x, y)
    unless $game_system.mapLooping
      center_mapLooping_game_player(x, y)
      return
    end
    $game_map.display_x = x * 128 - CENTER_X
    $game_map.display_y = y * 128 - CENTER_Y
  end
end


#============================================================================
# ** Sprite_Character
#============================================================================

class Sprite_Character < RPG::Sprite
  #--------------------------------------------------------------------------
  # * Aliased methods (F12 compatibility)
  #--------------------------------------------------------------------------
  unless @already_aliased
    alias update_mapLooping_sprite_character update
    @already_aliased = true
  end
  #--------------------------------------------------------------------------
  # * Update
  #--------------------------------------------------------------------------
  def update
    update_mapLooping_sprite_character
    if $game_system.mapLooping
      unless x + computed_right_width >= 0 && x - computed_left_width < 640
        self.x %= $game_map.width << 5
      end
      while y + computed_lower_height < 0
        self.y += $game_map.height << 5
        self.z += $game_map.height << 5
      end
      while y - computed_upper_height >= 480
        self.y -= $game_map.height << 5
        self.z -= $game_map.height << 5
      end
    end
  end
  #--------------------------------------------------------------------------
  # * Sprite's upper height (doesn't handle rotation)
  #--------------------------------------------------------------------------
  def computed_upper_height
    return (oy * zoom_y).to_i
  end
  #--------------------------------------------------------------------------
  # * Sprite's lower height
  #--------------------------------------------------------------------------
  def computed_lower_height
    return ((src_rect.height - oy) * zoom_y).to_i
  end
  #--------------------------------------------------------------------------
  # * Sprite's left width
  #--------------------------------------------------------------------------
  def computed_left_width
    return (ox * zoom_x).to_i
  end
  #--------------------------------------------------------------------------
  # * Sprite's right width
  #--------------------------------------------------------------------------
  def computed_right_width
    return ((src_rect.width - ox) * zoom_x).to_i
  end
end
Some scripts :
Working on :
Reply }


Messages In This Thread
Neo Mode 7 Script by MGCaladtogel - by MGC - 12-07-2008, 04:13 PM
RE: Neo Mode 7 Script by MGCaladtogel - by Habs11 - 12-06-2010, 06:21 AM
RE: Neo Mode 7 Script by MGCaladtogel - by MGC - 12-06-2010, 11:57 AM
RE: Neo Mode 7 Script by MGCaladtogel - by Habs11 - 12-07-2010, 01:53 AM
RE: Neo Mode 7 Script by MGCaladtogel - by MGC - 12-07-2010, 09:00 AM
RE: Neo Mode 7 Script by MGCaladtogel - by Habs11 - 12-08-2010, 04:16 AM
RE: Neo Mode 7 Script by MGCaladtogel - by MGC - 09-26-2011, 08:58 PM
RE: Neo Mode 7 Script by MGCaladtogel - by MGC - 09-27-2011, 04:04 PM
RE: Neo Mode 7 Script by MGCaladtogel - by MGC - 09-30-2011, 08:37 PM
RE: Neo Mode 7 Script by MGCaladtogel - by MGC - 03-08-2012, 08:34 PM
RE: Neo Mode 7 Script by MGCaladtogel - by MGC - 03-28-2012, 04:35 PM
RE: Neo Mode 7 Script by MGCaladtogel - by Taylor - 04-09-2012, 05:26 AM
RE: Neo Mode 7 Script by MGCaladtogel - by MGC - 05-09-2012, 07:19 AM
RE: Neo Mode 7 Script by MGCaladtogel - by Zohran - 08-04-2012, 03:59 PM
Neo Mode 7 Script by MGCaladtogel - by ozer - 09-12-2009, 04:08 PM
Neo Mode 7 Script by MGCaladtogel - by baddog - 03-07-2010, 06:20 PM
Neo Mode 7 Script by MGCaladtogel - by Ace - 03-07-2010, 06:21 PM
Neo Mode 7 Script by MGCaladtogel - by Villain - 03-09-2010, 05:23 PM
Neo Mode 7 Script by MGCaladtogel - by Ace - 03-10-2010, 07:58 AM
Neo Mode 7 Script by MGCaladtogel - by Villain - 03-10-2010, 08:31 AM
Neo Mode 7 Script by MGCaladtogel - by Villain - 03-10-2010, 09:46 AM
Neo Mode 7 Script by MGCaladtogel - by Villain - 03-17-2010, 09:13 PM
Neo Mode 7 Script by MGCaladtogel - by adrienk - 03-26-2010, 03:38 AM
Neo Mode 7 Script by MGCaladtogel - by PK8 - 03-26-2010, 04:28 AM
Neo Mode 7 Script by MGCaladtogel - by Villain - 03-26-2010, 03:46 PM
Neo Mode 7 Script by MGCaladtogel - by PK8 - 03-26-2010, 06:02 PM
Neo Mode 7 Script by MGCaladtogel - by Naridar - 03-29-2010, 04:48 PM
Neo Mode 7 Script by MGCaladtogel - by MGC - 03-29-2010, 07:12 PM
Neo Mode 7 Script by MGCaladtogel - by Naridar - 03-30-2010, 03:14 PM
Neo Mode 7 Script by MGCaladtogel - by MGC - 03-30-2010, 06:06 PM
Neo Mode 7 Script by MGCaladtogel - by Naridar - 03-31-2010, 08:44 PM
Neo Mode 7 Script by MGCaladtogel - by MGC - 06-18-2010, 06:49 AM
Neo Mode 7 Script by MGCaladtogel - by Habs11 - 06-28-2010, 10:12 PM
Neo Mode 7 Script by MGCaladtogel - by MGC - 06-29-2010, 07:20 PM
Neo Mode 7 Script by MGCaladtogel - by Habs11 - 06-29-2010, 09:33 PM
Neo Mode 7 Script by MGCaladtogel - by MGC - 06-30-2010, 07:33 PM
Neo Mode 7 Script by MGCaladtogel - by Habs11 - 06-30-2010, 10:55 PM
Neo Mode 7 Script by MGCaladtogel - by MGC - 07-01-2010, 06:51 AM
Neo Mode 7 Script by MGCaladtogel - by Habs11 - 07-03-2010, 03:00 AM
Neo Mode 7 Script by MGCaladtogel - by MGC - 07-06-2010, 08:43 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
   Text Scroll Script - Enhanced DerVVulfman 23 30,347 02-18-2021, 04:16 AM
Last Post: DerVVulfman
   Cursor Script Selwyn 7 13,395 09-28-2019, 02:13 PM
Last Post: DerVVulfman
   ACBS FIX SCRIPT #2: Advanced Cry Correction DerVVulfman 1 4,063 08-09-2019, 03:42 PM
Last Post: aeliath
   ACBS FIX SCRIPT #1: Victory Cries Patch DerVVulfman 1 4,018 08-08-2019, 02:53 PM
Last Post: aeliath
   Archived Script Listings DerVVulfman 9 34,321 01-08-2019, 04:27 AM
Last Post: DerVVulfman
   Spritesheet Generator Conversion Script DerVVulfman 0 3,686 11-21-2018, 04:48 AM
Last Post: DerVVulfman
   Longer Script Calls LiTTleDRAgo 0 4,460 05-17-2017, 12:36 AM
Last Post: LiTTleDRAgo
   SLOLS: Snake Look-alike on Load Script Zeriab 3 10,338 05-14-2017, 06:25 PM
Last Post: LiTTleDRAgo
   Character Select Script Selwyn 3 9,691 03-07-2017, 04:14 AM
Last Post: JayRay
   ELSA (Event Layering Script Advance) JayRay 0 5,511 02-25-2015, 04:15 AM
Last Post: JayRay



Users browsing this thread: