Memorize Location Script R2

30 de julho de 2013
Memorize Location Script R2

Memorize Location Script R2 é um script para o RPG Maker XP criado por dubealex, que, em termos bem rápidos, permite você a mover um evento de lugar em algum determinado mapa, que ele vai permanecer neste mesmo local mesmo que você saia e retorne a este mapa.

O minigame além de exemplificar melhor (embora esteja todo em inglês) ainda ensina direitinho como você pode implementar este script no seu game ou projeto, os eventos que precisa criar e seu funcionamento.

Apenas para instalar, basta inserir o código abaixo acima do Main:

#===================================================
#===================================================
# ■ Memorize Location Script R2 - created by dubealex 
#===================================================
# For more infos and update, visit:
# rmxp.dubealex.com
#
# -> Real/Screen coordinates fixed.
# -> Screen X/Y added.
#
# November 26, 2004
#===================================================

#===================================================
# ▼ CLASS Store_Location Begins
#===================================================
class Store_Location 
  
  attr_accessor :x
  attr_accessor :y
  attr_accessor :rx
  attr_accessor :ry
  attr_accessor :sx
  attr_accessor :sy
  attr_accessor :facing
  attr_accessor :mapID
  attr_accessor :mapName
  attr_accessor :name
  attr_accessor :keyname
  attr_accessor :terrain
  
  def initialize(x, y, rx, ry, sx, sy, facing, mapID, mapName, name, keyname, terrain)
    @x= x
    @y= y
    @rx= rx
    @ry= ry
    @sx=sx
    @sy=sy
    @facing= facing
    @mapID= mapID
    @mapName= mapName
    @name= name
    @keyname= keyname
    @terrain= terrain
  end
  
end
#===================================================
# ▲ CLASS Store_Location  Ends
#===================================================


#===================================================
# ▼ CLASS MemLocation Begins
#===================================================
class MemLocation 
  
  def initialize(keyname, name, event)
    @name= name
    @keyname= keyname
    @event = event
    
    if event <= 0    
      x= $game_player.x
      y= $game_player.y
      rx= $game_player.real_x 
      ry= $game_player.real_y
      sx= $game_player.screen_x
      sy=$game_player.screen_y
      facing= $game_player.direction
      mapID= $game_map.map_id
      mapName= $game_map.name
      terrain= $game_map.terrain_tag(x, y)
      $MemLocation[@keyname] = Store_Location.new(x, y, rx, ry,sx,sy, facing, mapID, mapName, name, keyname, terrain)
      self
    else if event >= 0
      x= $game_map.events[event].x
      y= $game_map.events[event].y
      rx= $game_map.events[event].real_x 
      ry= $game_map.events[event].real_y
      sx= $game_map.events[event].screen_x
      sy=$game_map.events[event].screen_y
      facing= $game_map.events[event].direction
      mapID= $game_map.map_id
      mapName= $game_map.name
      terrain= $game_map.terrain_tag(x, y)
      $MemLocation[@keyname] = Store_Location.new(x, y, rx, ry,sx,sy, facing, mapID, mapName, name, keyname, terrain)
      self
     end
   end
 end
  
  def [](name)
      $MemLocation[keyname]
  end

end
#===================================================
# ▲ CLASS  MemLocation Ends
#===================================================

#===================================================
# ▼ CLASS RecallLocation Begins
#===================================================
class RecallLocation 
  
  def initialize(keyname, facing)
    
    if $MemLocation.has_key?(keyname)  
     $game_map.setup($MemLocation[keyname].mapID)
     $game_player.moveto($MemLocation[keyname].x, $MemLocation[keyname].y)  
     case facing
     when -1
          case $MemLocation[keyname].facing
          when 2 
            $game_player.turn_down
          when 4 
            $game_player.turn_left
          when 6 
            $game_player.turn_right
          when 8 
            $game_player.turn_up
        end 
     when 2 
      $game_player.turn_down
     when 4 
      $game_player.turn_left
     when 6 
      $game_player.turn_right
     when 8 
      $game_player.turn_up
    end
     Graphics.freeze 
     $game_temp.transition_processing = true     
     $game_map.autoplay
     $scene = Scene_Map.new 
     $game_temp.transition_processing = false
     Graphics.frame_reset
   else 
      print "This location does not exist yet in memory."
      print "Use 'Conditional Branches' in your event to bypass this error."
      print "Read the full instruction manual on RMXP.DUBEALEX.COM"
    end
  end
end
#===================================================
# ▲ CLASS  RecallLocation Ends
#===================================================


#===================================================
# ▼ CLASS Warp Begins
#===================================================
class Warp 
  
  def initialize(mapID, x, y, facing)
     $game_map.setup(mapID)
     $game_player.moveto(x, y)  
    case facing
     when 2 
      $game_player.turn_down
     when 4 
      $game_player.turn_left
     when 6 
      $game_player.turn_right
     when 8 
      $game_player.turn_up
    end
     Graphics.freeze 
     $game_temp.transition_processing = true     
     $game_map.autoplay
     $scene = Scene_Map.new 
     $game_temp.transition_processing = false
     Graphics.frame_reset
   end
 end
 
 
#===================================================
# ▲ CLASS  Warp Ends
#===================================================


#===================================================
# ▼ CLASS RecallEvent Begins
#===================================================
class RecallEvent 
  
  def initialize(keyname, event)
    
    if $MemLocation.has_key?(keyname) 
  $game_map.events[event].moveto($MemLocation[keyname].x, $MemLocation[keyname].y)
   else 
      print "This location does not exist yet in memory."
      print "Use 'Conditional Branches' in your event to bypass this error."
      print "Read the full instruction manual on RMXP.DUBEALEX.COM"
    end
  end
end
#===================================================
# ▲ CLASS  RecallEvent Ends
#===================================================

#===================================================
# ▼ CLASS Game_Map Additional Code Begins
#===================================================
class Game_Map
  
#Dubealex Addition (from XRXS) to show Map Name on screen
 def name
   $map_infos[@map_id]
 end
end

#===================================================
# ▲ CLASS Game_Map Additional Code Ends
#===================================================


#===================================================
# ▼ CLASS Scene_Title Additional Code Begins
#===================================================
class Scene_Title

  
				  $MemLocation = Hash.new
#Dubealex Addition (from XRXS) to show Map Name on screen
   $map_infos = load_data("Data/MapInfos.rxdata")
   for key in $map_infos.keys
     $map_infos[key] = $map_infos[key].name
   end
end

#===================================================
# ▲ CLASS Scene_Title Additional Code Ends
#===================================================
site ou autor do arquivo dubealex tamanho do arquivo 401KB licencaGrátis sistemas operacionais compativeisWindows 98/98SE/Me/2000/XP/Vista/7 Download

Um comentário para “Memorize Location Script R2”

  1. mateus disse:

    não tinha pensado nisso antes mas como meu projeto é de mições precisa disso

Deixe um comentário

  • Seja social e nos siga!

           
  • Páginas

  • Tags Especiais

  • Categorias

  • Parceiros

  • eXTReMe Tracker
    Copyright © 2001 - 2017 Gaming Room. Todos os Direitos Reservados - É expressamente proibida a reprodução total ou parcial deste site sem o consentimento dos autores.