RPGXP Script
2013.09.24 08:03

자동 세이브 스크립트

Views 1058 Votes 0 Comment 1
?

Shortcut

PrevPrev Article

NextNext Article

Larger Font Smaller Font Up Down Go comment Print
?

Shortcut

PrevPrev Article

NextNext Article

Larger Font Smaller Font Up Down Go comment Print

#============================================================================== 
# *** 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 


출처: 게임공작소

?

List of Articles
No. Category Subject Author Date Views Votes
288 RPGXP Script 새로운 게임 시작/로드 시 미묘한 연출 추가. 창조도시 2007.12.01 2547 1
287 RPGXP Script 대화 글씨 폰트를 원하는 폰트로 바꾸기 창조도시 2007.12.01 1675 2
286 RPGXP Script 대각선 방향 이동추가로 8방향 이동 만들기. 1 창조도시 2008.08.14 2453 1
285 RPGXP Script 맵 이름을 화면 상단에 띄우기. 1 1 file 창조도시 2008.10.12 2407 1
284 RPGXP Script 최초 시작화면에 제작자 정보를 띄워보자. 6 창조도시 2008.04.04 2208 5
283 RPGXP Script 선택 메뉴를 가운데 정렬 해보자. 1 file 창조도시 2007.12.02 1668 2
282 RPGXP Script 아이템창을 아이템 분류별로 나누어 지게 개조. 3 file 창조도시 2007.12.02 1877 1
281 RPGXP Script c[n] 명령어 줄때의 색상 결정. 창조도시 2008.02.14 1338 1
280 RPGXP Script 대화창에 얼굴 띄우기& 대화창 명령어 모음. 1 file 창조도시 2008.12.31 2359 1
279 RPGXP Script 게임도중에 글씨체를 바꿔보자. 창조도시 2008.12.31 1540 1
278 RPGXP Script 대화창에 이름&얼굴 띄우기 새로운방식. file 창조도시 2007.11.06 3882 3
277 RPGXP Script 그림자문자 사용하기.. 바탕색이 무슨색이건 상관없이 글자가 잘보인다!!! 창조도시 2007.11.06 1699 1
276 RPGXP Script 기차 파티 스크립트 2 창조도시 2008.07.24 1705 2
275 RPGXP Script 한글이름입력기 v1.76 1 1 창조도시 2008.07.24 2932 2
274 RPGXP Script 창고 시스템 2 창조도시 2008.01.18 2010 3
273 RPGXP Script 물가에가면 캐릭터를 반사시켜주는 스크립트 4 file 창조도시 2007.12.02 4781 6
272 RPGXP Script 파티 선두 캐릭터 id 변수에 넣기 Evangelista 2008.01.08 1666 1
271 RPGVX Script vx 한글이름입력 2 file 가가상 2010.05.21 3350 1
270 RPGVX Script [VX] 파티 선두 캐릭터 액터ID를 변수에 넣기 Evangelista 2008.11.28 1960 1
269 RPGVX Script [VX] 조건분기로 키입력의 처리 실행 1 Evangelista 2008.11.28 1996 1
Board Pagination Prev 1 2 3 4 5 6 7 8 9 10 ... 15 Next
/ 15


[privacy statements] | [Terms of Use] | [Contact us] | [Sponsorship] | [Indiside History]

Copyright © 1999 - 2016 INdiSide.com/CL3D Co., Ltd. All Rights Reserved.
Owner : Chunmu(Jiseon Lee) | kernys(Wonbae Kim) | Sasinji(Byungkook Kim)