Hey everyone, not sure if you can remember, but a while back, Chaosg1 did me a script request, and it was perfect, he also released it publicly, but at the time I had the SDK, now, I don't have it, and don't wish to use it as all my other scripts aren't SDK compatible.
Can someone please take a look at this and take off the SDK ? Thankyou.
Can someone please take a look at this and take off the SDK ? Thankyou.
Code:
#===============================================================================
# ** World Map System: Setup Module
#-------------------------------------------------------------------------------
# Author : Chaosg1
# Version: 1.0
# Date : 21-02-07
#===============================================================================
SDK.log('World Map','Chaosg1',1.0, 21-02-07)
SDK.check_requirements(2.0, [1,2])
#--------------------------------------------------------------------------
# Begin SDK Enabled Check
#--------------------------------------------------------------------------
if SDK.enabled?('World Map')
FIRST_MAP_ID = 1
SIGN = '•' #the map name must contain this simbol. in default case *
#Not Necessary, but when you select a location it can show the locations in the world map.
WMLocations = {"Forest" => [500,500]}
class Scene_World_Map < SDK::Scene_Base
MAP = "World Map"
KEY = (Input::A)
PIXEL_MOVE = 10
PIXEL_KEY = 20
ZOOM_KEY = (Input::CTRL)
#--------------------------------------------------------------------------
# * Object Initialization
#--------------------------------------------------------------------------
def main_variable
super()
@map = RPG::Cache.picture(MAP)
@viewport = Viewport.new(200,0,440,480)
@sprite = Sprite.new(@viewport)
@sprite.bitmap = @map
@sprite.visible = false
@window_command = Command_Map.new
@window_title = Window_Title.new
@viewport_active = false
@character_window = Window_Charcter.new
@command = Window_Command.new(360,["Go to Location", "Check in the map"])
@command.visible = false
@command.x = 240
@command.y = 240-@command.height/2
end
#--------------------------------------------------------------------------
# * Object Initialization
#--------------------------------------------------------------------------
def update
super()
if @viewport_active != true
if Input.trigger?(Input::B)
$game_system.se_play($data_system.cancel_se)
return $scene = Scene_Map.new
end
@sprite.visible = false
if @window_command.index == @window_command.commands.size - 1
if Input.trigger?(Input::C)
$game_system.se_play($data_system.decision_se)
@window_command.active = false
@viewport_active = true
end
end
else
@sprite.visible = true
if Input.trigger?(Input::B)
$game_system.se_play($data_system.cancel_se)
@window_command.active = true
return @viewport_active = false
end
pixel = PIXEL_MOVE
pixel = PIXEL_KEY if Input.press?(KEY)
#Player Input
@viewport.ox -= pixel if Input.repeat?(Input::LEFT) or Input.trigger?(Input::LEFT)
@viewport.ox += pixel if Input.repeat?(Input::RIGHT) or Input.trigger?(Input::RIGHT)
if Input.repeat?(Input::UP) or Input.trigger?(Input::UP)
if Input.press?(ZOOM_KEY)
@sprite.zoom_x += 0.1
@sprite.zoom_y += 0.1
@viewport.ox += (@sprite.zoom_x * 10 * @viewport.ox)/100
@viewport.oy += (@sprite.zoom_y * 10 * @viewport.oy)/100
else
@viewport.oy -= pixel
end
end
if Input.repeat?(Input::DOWN) or Input.trigger?(Input::DOWN)
if Input.press?(ZOOM_KEY)
@sprite.zoom_x -= 0.1
@sprite.zoom_y -= 0.1
@viewport.ox -= (@sprite.zoom_x * 10 * @viewport.ox)/100
@viewport.oy -= (@sprite.zoom_y * 10 * @viewport.oy)/100
else
@viewport.oy += pixel
end
end
end
if @command.visible
case @command.index
when 0
if Input.trigger?(Input::C)
$game_system.se_play($data_system.decision_se)
array = $game_system.map_coo[@window_command.commands[@window_command.index]]
$game_temp.player_transferring = true
$game_temp.player_new_map_id = array[0]
$game_temp.player_new_x = array[1]
$game_temp.player_new_y = array[2]
$game_temp.player_new_direction = array[3]
$scene = Scene_Map.new
# Set transition processing flag
$game_temp.transition_processing = true
$game_temp.transition_name = ""
end
when 1
if Input.trigger?(Input::C)
$game_system.se_play($data_system.decision_se)
@sprite.zoom_x = @sprite.zoom_y = 1.0
return if WMLocations[@window_command.commands[@window_command.index]].nil?
@sprite.visible = true
@viewport_active = true
@command.visible = false
@viewport.ox = WMLocations[@window_command.commands[@window_command.index]][0]-210
@viewport.oy = WMLocations[@window_command.commands[@window_command.index]][1]-240
end
end
elsif Input.trigger?(Input::C) and not @window_command.index == @window_command.commands.size - 1
$game_system.se_play($data_system.decision_se)
@window_command.active = false
@command.active = true
@command.visible = true
end
end
end
#=============================================================================
# ** Game_System
#-----------------------------------------------------------------------------
# This class handles data surrounding the system. Backround music, etc.
# is managed here as well. Refer to "$game_system" for the instance of
# this class.
#=============================================================================
class Game_System
attr_accessor :visited_maps,:map_coo
alias cg1_wm_gm_init initialize
def initialize
cg1_wm_gm_init
@visited_maps = []
@map_coo = {}
end
end
#=============================================================================
# ** Game_Map
#-----------------------------------------------------------------------------
# This class handles the map. It includes scrolling and passable determining
# functions. Refer to "$game_map" for the instance of this class.
#=============================================================================
class Game_Map
alias cg1_setup setup
def setup(map_id)
cg1_setup(map_id)
data = load_data("Data/MapInfos.rxdata")
if @map_id != FIRST_MAP_ID and data[@map_id].location?
$game_system.visited_maps.push(data[@map_id].name)
$game_system.map_coo[data[@map_id].name] = [@map_id,$game_temp.player_new_x,$game_temp.player_new_y,$game_player.direction]
elsif data[@map_id].location?
$game_system.visited_maps.push(data[@map_id].name)
$game_system.map_coo[data[@map_id].name] = [@map_id,$data_system.start_x,$data_system.start_x,2]
end
end
end
#-----------------------------------------------------------------------------
class RPG::MapInfo
def name
return @name.gsub(/#{SIGN.to_s}/) {|a| ""}
end
def location?
return @name.scan(/#{SIGN.to_s}/).size > 0
end
end
#--------------------------------------------------------------------------
# Begin SDK Enabled Check
#--------------------------------------------------------------------------
class Command_Map < Window_Command
attr_accessor :commands
def initialize
@commands = nil
@commands = $game_system.visited_maps|$game_system.visited_maps
@commands.push("View World Map")
super(200,@commands)
self.height = 340
self.y = 60
end
end
#------------------------------------------------------------------------
class Window_Title < Window_Base
def initialize
super(0,0,200,60)
@text = "Where To:"
self.contents = Bitmap.new(self.width - 32,self.height - 32)
cx = self.contents.text_size(@text).width
cy = self.contents.text_size(@text).height
x = (self.width-32)/2 - cx/2
y = (self.height-32)/2 - cy/2
self.contents.draw_text(x,y,cx,cy,@text)
end
end
#------------------------------------------------------------------------
class Window_Charcter < Window_Base
def initialize
super(0,400,200,80)
self.contents = Bitmap.new(self.width-32,self.height-32)
a = 1
$game_party.actors.each do |actor|
return if a > 4
bitmap = RPG::Cache.character(actor.character_name, actor.character_hue)
cw = bitmap.width / 4
ch = bitmap.height / 4
#x =(self.width-32)/2) * a
x = a * cw
y = ch
draw_actor_graphic(actor,x,y)
a += 1
actor = $game_party.actors[a]
end
end
end
#------------------------------------------------------------------------
end