XP 스크립트

이전에 올라온 ASM에서 현재 맵(맵 이름이 아니고) 보여주기를 뺀 것입니다. rmxp.net에 올라와 있었던 스크립트 중 하나. 이 스크립트 사용시 세이브파일은 하위 디렉토리인 Saves에 저장됩니다(없으면 만들어야죠).



#==============================================================================
# ■ ASM - advanced save menu
#------------------------------------------------------------------------------
# by squall // squall@loeher.zzn.com
# edited by J.D. Slasha (1-20-06)
# monday the 28th of november 2005
#
# Allows to have up to 99 files.
# Files are stored inside of the folder 'Saves' inside of the game's folder.
# Don't forget to create that folder if it doesn't already exist.
#==============================================================================

#==============================================================================
# ■ Window_File
#------------------------------------------------------------------------------
#  This window shows a list of recorded save files.
#==============================================================================

class Window_File < Window_Selectable
#--------------------------------------------------------------------------
# ● initialize
#--------------------------------------------------------------------------
def initialize()
super(0, 64, 320, 416)
self.contents = Bitmap.new(width - 32, 99 * 32)
self.contents.font.name = $defaultfontface
self.contents.font.size = $defaultfontsize
index = $game_temp.last_file_index == nil ? 0 : $game_temp.last_file_index
self.index = index
@item_max = 99
refresh
end
#--------------------------------------------------------------------------
# ● refresh the window
#--------------------------------------------------------------------------
def refresh
time_stamp = Time.at(0)
for i in 0...99
filename = "Saves/Save#{i + 1}.rxdata"
self.contents.draw_text(1, i * 32, 32, 32, (i + 1).to_s, 1)
if FileTest.exist?(filename)
size = File.size(filename)
if size.between?(1000, 999999)
size /= 1000
size_str = "#{size} Kb"
elsif size > 999999
size /= 1000000
size_str = "#{size} Mb"
else
size_str = size.to_s
end
time_stamp = File.open(filename, "r").mtime
date = time_stamp.strftime("%m/%d/%Y")
time = time_stamp.strftime("%H:%M")
self.contents.draw_text(38, i * 32, 120, 32, date)
self.contents.draw_text(160, i * 32, 100, 32, time)
self.contents.draw_text(0, i * 32, 284, 32, size_str, 2)
end
end
end
end

#==============================================================================
# ■ Window_FileStatus
#------------------------------------------------------------------------------
#  This window shows the status of the currently selected save file
#==============================================================================

class Window_FileStatus < Window_Base
#--------------------------------------------------------------------------
# ● initialize
#--------------------------------------------------------------------------
def initialize(save_window)
super(320, 64, 320, 416)
self.contents = Bitmap.new(width - 32, height - 32)
self.contents.font.name = $defaultfontface
self.contents.font.size = $defaultfontsize
@save_window = save_window
@index = @save_window.index
rect = Rect.new(x + 16, y + (height - 32) / 2 + 16, width - 32, (height - 32) / 2)
@viewport = Viewport.new(rect)
@viewport.z = z + 10
refresh
end
#--------------------------------------------------------------------------
# ● dispose the map and the window
#--------------------------------------------------------------------------
def dispose
tilemap_dispose
@viewport.dispose
super
end
#--------------------------------------------------------------------------
# ● refresh the window
#--------------------------------------------------------------------------
def draw_actor_face(actor, x, y)
face = RPG::Cache.character("SaveFaces/" + actor.character_name, actor.character_hue)
fw = face.width
fh = face.height
src_rect = Rect.new(0, 0, fw, fh)
self.contents.blt(x - fw / 23, y - fh, face, src_rect)
end
def refresh
self.contents.clear
#tilemap_dispose
filename = "Saves/Save#{@index + 1}.rxdata"
return unless FileTest.exist?(filename)
file = File.open(filename, "r")
Marshal.load(file)
frame_count = Marshal.load(file)
for i in 0...6
Marshal.load(file)
end
party = Marshal.load(file)
Marshal.load(file)
map = Marshal.load(file)
for i in 0...party.actors.size
actor = party.actors[i]
x = i % 1 * 144 +5 #x = i % 2 * 144 + 4
y = i / 1 * 94 #y = i / 2 * 64
draw_actor_name(actor, x + 30, y)
draw_actor_level(actor, x + 30, y + 20)
draw_actor_graphic(actor, x + 10, y + 90)
#draw_actor_face(actor,x+10,y+400)
end
total_sec = frame_count / Graphics.frame_rate
hour = total_sec / 60 / 60
min = total_sec / 60 % 60
sec = total_sec % 60
text = sprintf("%02d:%02d:%02d", hour, min, sec)
map_name = load_data("Data/MapInfos.rxdata")[map.map_id].name
self.contents.font.color = system_color
self.contents.draw_text(164, 125, 120, 32, "Play Time: ")
self.contents.draw_text(164, 170, 120, 32, "Location: ")
# self.contents.draw_text(184, 128, 120, 32, ":")
#self.contents.draw_text(184, 160, 16, 32, ":")
self.contents.font.color = normal_color
self.contents.draw_text(184, 145, 120, 32, text)
self.contents.draw_text(184, 190, 120, 32, map_name)

#@tilemap = Tilemap.new(@viewport)
#@tilemap.tileset = RPG::Cache.tileset(map.tileset_name)
for i in 0..6
#autotile_name = map.autotile_names[i]
# @tilemap.autotiles[i] = RPG::Cache.autotile(autotile_name)
end
#@tilemap.map_data = map.data
#@tilemap.ox = map.display_x / 4 + 176
#@tilemap.oy = map.display_y / 4 + 148
end
#--------------------------------------------------------------------------
# ● tilemap_dispose
#--------------------------------------------------------------------------
def tilemap_dispose
unless @tilemap == nil
@tilemap.tileset.dispose
for i in 0..6
@tilemap.autotiles[i].dispose
end
@tilemap.dispose
@tilemap = nil
end
end
#--------------------------------------------------------------------------
# ● update
#--------------------------------------------------------------------------
def update
@tilemap.update if @tilemap != nil
if @index != @save_window.index
@index = @save_window.index
refresh
end
super
end
end

#==============================================================================
# ■ Scene_File
#------------------------------------------------------------------------------
#  Base scene for load and save menus.
#==============================================================================

class Scene_File
#--------------------------------------------------------------------------
# ● initialize the scene
#--------------------------------------------------------------------------
def initialize(help_text)
@help_text = help_text
end
#--------------------------------------------------------------------------
# ● main
#--------------------------------------------------------------------------
def main
@help_window = Window_Help.new
@help_window.set_text(@help_text)
@file_window = Window_File.new
@status_window = Window_FileStatus.new(@file_window)
Graphics.transition
loop do
Graphics.update
Input.update
update
if $scene != self
break
end
end
Graphics.freeze
@help_window.dispose
@file_window.dispose
@status_window.dispose
end
#--------------------------------------------------------------------------
# ● update
#--------------------------------------------------------------------------
def update
@help_window.update
@file_window.update
@status_window.update
if Input.trigger?(Input::C)
decision
$game_temp.last_file_index = @file_index
return
end
if Input.trigger?(Input::B)
cancel
return
end
end
#--------------------------------------------------------------------------
# ● return the selected file's name
#--------------------------------------------------------------------------
def filename
return "Saves/Save#{@file_window.index + 1}.rxdata"
end
end

#==============================================================================
# ■ Scene_Save
#------------------------------------------------------------------------------
#  Save menu
#==============================================================================

class Scene_Save < Scene_File
#--------------------------------------------------------------------------
# ● initialize the save menu
#--------------------------------------------------------------------------
def initialize
super("Select a file to record your progress.")
end
#--------------------------------------------------------------------------
# ● decision key pressed
#--------------------------------------------------------------------------
def decision
$game_system.se_play($data_system.save_se)
file = File.open(filename, "wb")
write_save_data(file)
file.close
if $game_temp.save_calling
$game_temp.save_calling = false
$scene = Scene_Map.new
return
end
$scene = Scene_Menu.new(4)
end
#--------------------------------------------------------------------------
# ● cancel key pressed
#--------------------------------------------------------------------------
def cancel
$game_system.se_play($data_system.cancel_se)
if $game_temp.save_calling
$game_temp.save_calling = false
$scene = Scene_Map.new
return
end
$scene = Scene_Menu.new(4)
end
#--------------------------------------------------------------------------
# ● save the current data into the selected file
#--------------------------------------------------------------------------
def write_save_data(file)
characters = []
for i in 0...$game_party.actors.size
actor = $game_party.actors[i]
characters.push([actor.character_name, actor.character_hue])
end
Marshal.dump(characters, file)
Marshal.dump(Graphics.frame_count, file)
$game_system.save_count += 1
$game_system.magic_number = $data_system.magic_number
Marshal.dump($game_system, file)
Marshal.dump($game_switches, file)
Marshal.dump($game_variables, file)
Marshal.dump($game_self_switches, file)
Marshal.dump($game_screen, file)
Marshal.dump($game_actors, file)
Marshal.dump($game_party, file)
Marshal.dump($game_troop, file)
Marshal.dump($game_map, file)
Marshal.dump($game_player, file)
end
end

#==============================================================================
# ■ Scene_Load
#------------------------------------------------------------------------------
#  Load menu
#==============================================================================

class Scene_Load < Scene_File
#--------------------------------------------------------------------------
# ● initialize the menu
#--------------------------------------------------------------------------
def initialize
$game_temp = Game_Temp.new
$game_temp.last_file_index = 0
latest_time = Time.at(0)
for i in 0..99
filename = "Saves/Save#{i + 1}.rxdata"
if FileTest.exist?(filename)
file = File.open(filename, "r")
if file.mtime > latest_time
latest_time = file.mtime
$game_temp.last_file_index = i
end
file.close
end
end
super("Select a file to load.")
end
#--------------------------------------------------------------------------
# ● decision key pressed
#--------------------------------------------------------------------------
def decision
unless FileTest.exist?(filename)
$game_system.se_play($data_system.buzzer_se)
return
end
$game_system.se_play($data_system.load_se)
file = File.open(filename, "rb")
read_save_data(file)
file.close
$game_system.bgm_play($game_system.playing_bgm)
$game_system.bgs_play($game_system.playing_bgs)
$game_map.update
$scene = Scene_Map.new
end
#--------------------------------------------------------------------------
# ● cancel key pressed
#--------------------------------------------------------------------------
def cancel
$game_system.se_play($data_system.cancel_se)
$scene = Scene_Title.new
end
#--------------------------------------------------------------------------
# ● load the selected file
#--------------------------------------------------------------------------
def read_save_data(file)
characters = Marshal.load(file)
Graphics.frame_count = Marshal.load(file)
$game_system = Marshal.load(file)
$game_switches = Marshal.load(file)
$game_variables = Marshal.load(file)
$game_self_switches = Marshal.load(file)
$game_screen = Marshal.load(file)
$game_actors = Marshal.load(file)
$game_party = Marshal.load(file)
$game_troop = Marshal.load(file)
$game_map = Marshal.load(file)
$game_player = Marshal.load(file)
if $game_system.magic_number != $data_system.magic_number
$game_map.setup($game_map.map_id)
$game_player.center($game_player.x, $game_player.y)
end
$game_party.refresh
end
end


** 타이틀에서 게임세이브가 정상적으로 불러와지게 하려면 class Scene_Title에서 세이브파일 경로를 찾아 수정해야 합니다.

Who's 백호

?

이상혁입니다.

http://elab.kr

Atachment
첨부 '1'

List of Articles
번호 분류 제목 글쓴이 날짜 조회 수
공지 스크립트 자료 게시물 작성시 주의사항 습작 2012.12.24 6202
981 오디오 WhiteFlute - AudioEX (XP/VX/VXA) file Alkaid 2012.12.26 1257
980 그래픽 WhiteFlute - BitmapEX 4 file JACKY 2012.12.10 2955
979 오디오 Audio Module Rewrite mciSendString 1.1 by DerVVulfman Alkaid 2012.09.18 1371
978 전투 Trickster씨의 전투 시스템 (SDK 필수?) Alkaid 2012.09.18 3261
977 스킬 Trickster's Bag of Skill Effects (SDK 필요) Alkaid 2012.09.17 1291
976 변수/스위치 Switchless Common Events by PK8(XP/VX/VXA) Alkaid 2012.09.15 1202
975 변수/스위치 Initial Switches and Variables by PK8 (XP/VX/VXA) Alkaid 2012.09.14 1298
974 변수/스위치 The Self Data Suite by PK8 (XP/VX/VXA) Alkaid 2012.09.14 1237
973 그래픽 부드럽게 화면이 움직이는 스크립트 입니다. 16 GangSin 2012.09.12 4594
972 맵/타일 Editor Tiles by PK8 (XP/VX/VXA) Alkaid 2012.09.11 1868
971 장비 Auto Equipment Optimization for Guillaume777's Multi Slot Script by DerVVulfman Alkaid 2012.09.09 1498
970 메뉴 Leidy's Ring Command Window 1.2 by DerVVulfman Alkaid 2012.09.09 1433
969 그래픽 Pictures below Characters by PK8 (XP/VXA) Alkaid 2012.09.07 1643
968 그래픽 Event Transparency by DerVVulfman (XP/VX/VXA) Alkaid 2012.09.01 1488
967 전투 Etude87_Custom_Slip_Damage_XP ver.1.0 5 습작 2012.08.26 1857
966 전투 Mr.Mo's ABS Ultimate 7.0 by DerVVulfman 4 Alkaid 2012.08.26 2587
965 그래픽 Composite Window Skins by PK8 (XP/VX/VXA) Alkaid 2012.08.26 1563
964 스킬 Miriam's Handicrafts! 1.3 by DerVVulfman Alkaid 2012.08.26 1207
963 전투 Minkoff's Animated Battlers - Enhanced 13.8 by DerVVulfman 1 Alkaid 2012.08.26 1832
962 메뉴 메뉴를 바꾸는 스크립트 14 №1 2012.08.04 4214
Board Pagination Prev 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 ... 52 Next
/ 52