메뉴 건너뛰기

창조도시 기록보관소

RPGXP/VX 렉없는 자동세이브 스크립트!!!

2007.04.19 02:33

귀찮아‡ 조회 수:755 추천:2

#==============================================================================
# *** AutoSave
#------------------------------------------------------------------------------
# This module handles the AutoSaving
#==============================================================================
module AutoSave
#--------------------------------------------------------------------------
# * Saves File
#--------------------------------------------------------------------------
def self.save
  begin
    #Saves the file to whatever $game_system.filename is
    file = File.open($game_system.filename, "wb")
    a = Scene_Save.new
    a.write_save_data(file)
  ensure
    file.close
  end
end
#--------------------------------------------------------------------------
# * Deletes File
#--------------------------------------------------------------------------
def self.deletesave
  begin
    if FileTest.exits?($game_system.filename)
      File.delete($game_system.filename)
    end 
  end
end
end
#==============================================================================


#==============================================================================
# ** Scene_Save
#------------------------------------------------------------------------------
# This class performs save screen processing.
# NOTE THAT SCENE_SAVE NO LONGER SAVES THE GAME, it changes the autosave file
#==============================================================================


class Scene_Save < Scene_File
#--------------------------------------------------------------------------
# * Object Initialization
#--------------------------------------------------------------------------
def initialize
  super("Which file would you like to autosave to?")
end
#--------------------------------------------------------------------------
# * Decision Processing
#--------------------------------------------------------------------------
def on_decision(filename)
  # Play save SE
  $game_system.se_play($data_system.save_se)
  $game_system.filename_c(filename)
  $scene = Scene_Menu.new
end
end


#==============================================================================
# ** Scene_Load
#------------------------------------------------------------------------------
#  This class performs load screen processing.
#==============================================================================
class Scene_Load < Scene_File


alias old_doloadthingie on_decision
#--------------------------------------------------------------------------
# * Decision Processing
#--------------------------------------------------------------------------
def on_decision(filename)
  $game_system.filename_c(filename)
  old_doloadthingie(filename)
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
#--------------------------------------------------------------------------
# * Aliasing Objects
#--------------------------------------------------------------------------
alias autosaveinit initialize
#--------------------------------------------------------------------------
# * Initialize
#--------------------------------------------------------------------------
def initialize
  autosaveinit
  @filename = "Save1.rxdata"
end
#--------------------------------------------------------------------------
# * Filename -> Returns Autosave Filename
#--------------------------------------------------------------------------
def filename
  if @filename != nil
    return @filename
  else
    return "Save1.rxdata"
  end 
end
#--------------------------------------------------------------------------
# * Filename_change -> Sets New Autosave Filename
#--------------------------------------------------------------------------
def filename_c(newname)
  return if newname == "" or newname == nil
  @filename = newname
end
end


#==============================================================================
# ** Game_Party
#------------------------------------------------------------------------------
# This class handles the party. It includes information on amount of gold
# and items. Refer to "$game_party" for the instance of this class.
#==============================================================================
class Game_Party


alias gainglod_autosave gain_gold
alias gainitem_autosave gain_item
alias gainweap_autosave gain_weapon
alias gainarmor_autosave gain_armor
#--------------------------------------------------------------------------
# * Gain Gold (or lose)
# n : amount of gold
#--------------------------------------------------------------------------
def gain_gold(n)
  gainglod_autosave(n)
  AutoSave.save
end
#--------------------------------------------------------------------------
# * Gain Items (or lose)
# item_id : item ID
# n : quantity
#--------------------------------------------------------------------------
def gain_item(item_id, n)
  gainitem_autosave(item_id, n)
  AutoSave.save
end
#--------------------------------------------------------------------------
# * Gain Weapons (or lose)
# weapon_id : weapon ID
# n : quantity
#--------------------------------------------------------------------------
def gain_weapon(weapon_id, n)
  gainweap_autosave(weapon_id, n)
  AutoSave.save
end
#--------------------------------------------------------------------------
# * Gain Armor (or lose)
# armor_id : armor ID
# n : quantity
#--------------------------------------------------------------------------
def gain_armor(armor_id, n)
  gainarmor_autosave(armor_id, n)
  AutoSave.save
end
end


#==============================================================================
# ** Scene Change Map
#------------------------------------------------------------------------------
# This Scene pop-ups when teleporting.
#==============================================================================
class Scene_Map
alias autosavescript_changemap_main main
#--------------------------------------------------------------------------
# * Main
#--------------------------------------------------------------------------
def main
  autosavescript_changemap_main
  AutoSave.save
end
end


사용방법: 그냥 main위에 찔러 넣으세요


 


 


 


 


 


출처: 기억안남

번호 제목 글쓴이 날짜 조회 수
409 초보자를 위한 그래픽 소스 게임에 넣을 때의 팁. [3] file 한글화마스터 2007.07.15 1025
408 [THDO]판화 세계지도제작 스크립트. [7] file 협객 2007.06.25 1668
407 바실리어트 - 비주얼노벨형 게임 제작용 엔진 [4] 플루비아♥ 2007.06.24 954
406 [스크립트 문제]RPGXP에서 타일셋의 우선순위 문제 해결 [1] file Novelist 2007.06.19 809
405 [C++] 클래스(객체지향) - 기본 생성자와 소멸자 [3] Sirjhswin 2007.06.11 487
404 RPGXP의 기본전투 속도를 더욱 빠르게~ [9] Novelist 2007.06.08 1139
403 [C++] 한글과 영어가 섞인 문자열의 길이 체크 [4] Zeprod 2007.05.27 1427
402 [DX&C++] 화면에 글씨를 써볼까요. [2] Zeprod 2007.05.17 741
401 미소녀 제작기에 대해. Light 사의 Lum 툴....? [4] 협객 2007.05.14 1100
400 윈터뮤트 엔진.....이라는군요. [1] 협객 2007.05.13 592
399 vnap 로드는 load로 되는데 세이브는 save로 안된다??????????? ㅡ.ㅡ; [2] 협객 2007.05.13 550
398 [구기술체험소] Fast Chatting System [2] file 비밀소년 2007.04.30 678
397 [구기술체험소] Fast Animation System [2] file 비밀소년 2007.04.30 763
396 턴알에서 순간데미지 2배이상으로늘리기[턴알] [2] Dship 2007.04.28 716
395 오랜만에 잡담 하나 [4] 아란 2007.04.27 367
» 렉없는 자동세이브 스크립트!!! [5] 귀찮아‡ 2007.04.19 755
393 [DX&C++] 3D를 넘어 2D로! [13] Zeprod 2007.04.11 831
392 마우스 이동 스크립트 [12] 아크로s 2007.04.08 1420
391 '에피소드'형식이 아닌 '화' 형식의 시나리오는 어떨까요? [2] 우드록맨 2007.04.03 544
390 [DX&C++] 지형을 만들어 봅시다. (Height Map) [1] Zeprod 2007.04.02 492