Dekita

$D13 Save Control 1.0

May 16th, 2013
289
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. if true # << Make true to use this script, false to disable.
  2. #===============================================================================
  3. #
  4. # ☆ $D13x - Save Control
  5. # -- Author : Dekita
  6. # -- Version : 1.0
  7. # -- Level : Easy
  8. # -- Requires : N/A
  9. # -- Engine : RPG Maker VX Ace.
  10. #
  11. #===============================================================================
  12. # ☆ Import
  13. #-------------------------------------------------------------------------------
  14. $D13x={}if$D13x==nil
  15. $D13x[:Save_Con]=true
  16. #===============================================================================
  17. # ☆ Updates
  18. #-------------------------------------------------------------------------------
  19. # D /M /Y
  20. # 21/o4/2o13 - Started, Finished,
  21. #
  22. #===============================================================================
  23. # ☆ Introduction
  24. #-------------------------------------------------------------------------------
  25. # Simple Script to allow a little more control over your save files.
  26. # Allows you to change the filename and extension.
  27. # Also allows for the save files to be stored into a folder.
  28. #
  29. # This script also slightly modify's the save/load scene to provide
  30. # a little more information, ie level, name ..
  31. #
  32. #===============================================================================
  33. # ★☆★☆★☆★☆★☆★☆★☆★ TERMS AND CONDITIONS: ☆★☆★☆★☆★☆★☆★☆★☆★☆
  34. #===============================================================================
  35. # 1. You MUST give credit to "Dekita" !!
  36. # 2. You are NOT allowed to repost this script.(or modified versions)
  37. # 3. You are NOT allowed to convert this script.
  38. # 4. You are NOT allowed to use this script for Commercial games.
  39. # 5. ENJOY!
  40. #
  41. # "FINE PRINT"
  42. # By using this script you hereby agree to the above terms and conditions,
  43. # if any violation of the above terms occurs "legal action" may be taken.
  44. # Not understanding the above terms and conditions does NOT mean that
  45. # they do not apply to you.
  46. # If you wish to discuss the terms and conditions in further detail you can
  47. # contact me at http://dekitarpg.wordpress.com/
  48. #
  49. #===============================================================================
  50. # ☆ Instructions
  51. #-------------------------------------------------------------------------------
  52. # Place Below " ▼ Materials " and Above " ▼ Main " in your script editor.
  53. #
  54. #===============================================================================
  55. module Deki_Save
  56. #===============================================================================
  57. #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  58. # ☆ Save File Configuration
  59. #--------------------------------------------------------------------------
  60. # << Save File's Folder. "" = default game folder
  61. Folder = "Save_Data/"
  62.  
  63. # << Save File's Name (will be followed by the file index
  64. FileName = "sD13x_21o42o13"
  65.  
  66. # << Save File Extension. Can be .rvdata2, .sav or .txt (reccommend .rvdata2)
  67. File_Ext = ".rvdata2"
  68.  
  69. # << Max Save Files Allowed
  70. Max_Files = 12
  71.  
  72. # << Allow save/load scene to be modified slightly ?
  73. Modify_Scene = true
  74. #####################
  75. # CUSTOMISATION END #
  76. end #####################
  77. #☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★#
  78. # #
  79. # http://dekitarpg.wordpress.com/ #
  80. # #
  81. #★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆#
  82. #===============================================================================#
  83. # ARE YOU MODIFYING BEYOND THIS POINT? \.\. #
  84. # YES?\.\. #
  85. # OMG, REALLY? \| #
  86. # WELL SLAP MY FACE AND CALL ME A DRAGONITE.\..\.. #
  87. # I REALLY DIDN'T THINK YOU HAD IT IN YOU.\..\.. #
  88. #===============================================================================#
  89. module Deki_Save
  90. #===============================================================================
  91. Dir.mkdir(Folder) unless Dir.exist?(Folder)
  92. case File_Ext;when".rvdata2",".sav",".txt";else;File_Ext=".rvdata2";end
  93. #-----------------------------------------------------------------------------
  94. # Determine Existence of Save File
  95. #-----------------------------------------------------------------------------
  96. def self.save_file_exists?
  97. !Dir.glob("#{Folder}#{FileName}*#{File_Ext}").empty?
  98. end
  99. #-----------------------------------------------------------------------------
  100. # Create Filename | index : File Index
  101. #-----------------------------------------------------------------------------
  102. def self.make_filename(index)
  103. "#{Folder}#{FileName}#{index+1}#{File_Ext}"
  104. end
  105.  
  106. end
  107.  
  108. #===============================================================================
  109. module DataManager
  110. #===============================================================================
  111. #-----------------------------------------------------------------------------
  112. # Determine Existence of Save File
  113. #-----------------------------------------------------------------------------
  114. def self.save_file_exists?
  115. Deki_Save.save_file_exists?
  116. end
  117. #-----------------------------------------------------------------------------
  118. # Maximum Number of Save Files
  119. #-----------------------------------------------------------------------------
  120. def self.savefile_max
  121. return Deki_Save::Max_Files
  122. end
  123. #-----------------------------------------------------------------------------
  124. # Create Filename | index : File Index
  125. #-----------------------------------------------------------------------------
  126. def self.make_filename(index)
  127. Deki_Save.make_filename(index)
  128. end
  129.  
  130. end
  131.  
  132. if Deki_Save::Modify_Scene
  133. #===============================================================================
  134. module DataManager
  135. #===============================================================================
  136. #-----------------------------------------------------------------------------
  137. # Alias List
  138. #-----------------------------------------------------------------------------
  139. class << self
  140. alias :msh_dekisav :make_save_header
  141. end
  142. #-----------------------------------------------------------------------------
  143. # Make Save Header
  144. #-----------------------------------------------------------------------------
  145. def self.make_save_header
  146. header = msh_dekisav
  147. header[:cash] = $game_party.gold
  148. header
  149. end
  150.  
  151. end
  152. #===============================================================================
  153. class Game_Party < Game_Unit
  154. #===============================================================================
  155. #-----------------------------------------------------------------------------
  156. # Character Information for Save File Display
  157. #-----------------------------------------------------------------------------
  158. def characters_for_savefile
  159. battle_members.collect do |actor|
  160. [actor.character_name, actor.character_index,
  161. actor.name, actor.level]
  162. end
  163. end
  164. end
  165.  
  166. #===============================================================================
  167. class Window_SaveFile < Window_Base
  168. #===============================================================================
  169. #-----------------------------------------------------------------------------
  170. # Refresh
  171. #-----------------------------------------------------------------------------
  172. def refresh
  173. contents.clear
  174. refresh_the_font
  175. draw_save_file_info
  176. end
  177. #-----------------------------------------------------------------------------
  178. # Refresh Font Settings
  179. #-----------------------------------------------------------------------------
  180. def refresh_the_font
  181. if !General::Fonts.include?(self.contents.font.name)
  182. self.contents.font.name = General::Fonts
  183. end
  184. if self.contents.font.size != General::Font_Size
  185. self.contents.font.size = General::Font_Size
  186. end
  187. if self.contents.font.bold != General::Font_Bold
  188. self.contents.font.bold = General::Font_Bold
  189. end
  190. end
  191. #-----------------------------------------------------------------------------
  192. # Draw Save Info
  193. #-----------------------------------------------------------------------------
  194. def draw_save_file_info
  195. font_size_mod = 2
  196. header = DataManager.load_header(@file_index)
  197. change_color(normal_color)
  198. name = Vocab::File + " #{@file_index + 1}"
  199. self.contents.font.size += font_size_mod
  200. draw_text(4, 0, 200, line_height, name)
  201. @name_width = text_size(name).width
  202. draw_cash(0, 0, contents.width, header, 1)
  203. draw_playtime(0, 0, contents.width, header, 2)
  204. self.contents.font.size -= font_size_mod
  205. draw_party_characters(24,48,header)
  206. end
  207. #-----------------------------------------------------------------------------
  208. # Draw Party Characters
  209. #-----------------------------------------------------------------------------
  210. def draw_party_characters(x, y, header)
  211. return unless header
  212. header[:characters].each_with_index do |data, i|
  213. draw_bio_block(x,y,i,data)
  214. end
  215. end
  216. #-----------------------------------------------------------------------------
  217. # Draw Actor Bio
  218. #-----------------------------------------------------------------------------
  219. def draw_bio_block(x,y,i,data)
  220. nx = x + ((contents.width-x/2)/$game_party.max_battle_members*i)
  221. draw_character(data[0], data[1], nx, y+18)
  222. draw_text(nx+18, y-18, 98, line_height, data[2], 0)
  223. draw_text(nx+18, y , 98, line_height, "Lvl: #{data[3]}", 0)
  224. end
  225. #-----------------------------------------------------------------------------
  226. # Draw Play Time
  227. #-----------------------------------------------------------------------------
  228. def draw_playtime(x, y, width, header, align)
  229. return unless header
  230. draw_text(x, y, width, line_height, "Playtime: " + header[:playtime_s], align)
  231. end
  232. #-----------------------------------------------------------------------------
  233. # Draw Cash
  234. #-----------------------------------------------------------------------------
  235. def draw_cash(x, y, width, header, align)
  236. return unless header
  237. draw_text(x, y, width, line_height, "Gold: " + header[:cash].to_s, align)
  238. end
  239.  
  240. end
  241.  
  242. #===============================================================================
  243. class Scene_File < Scene_MenuBase
  244. #===============================================================================
  245. #-----------------------------------------------------------------------------
  246. # Alias List
  247. #-----------------------------------------------------------------------------
  248. alias :visimaxxsave :visible_max
  249. #-----------------------------------------------------------------------------
  250. # Get Number of Save Files to Show on Screen
  251. #-----------------------------------------------------------------------------
  252. def visible_max
  253. return Deki_Save::Max_Files if (Deki_Save::Max_Files < 4)
  254. return visimaxxsave
  255. end
  256.  
  257. end
  258.  
  259. end # if Deki_Save::Modify_Scene
  260.  
  261. #==============================================================================#
  262. # http://dekitarpg.wordpress.com/ #
  263. #==============================================================================#
  264. end # if true # << Make true to use this script, false to disable.
RAW Paste Data