Data hosted with ♥ by Pastebin.com - Download Raw - See Original
  1. #======================================================================
  2. # ** Synopsis Journal
  3. # Version: 1.0
  4. # Author: VianoceGames
  5. # Date: February 14, 2015
  6. #----------------------------------------------------------------------
  7. # Description:
  8. #
  9. # This script creates a menu option which tracks a quest(s) in
  10. # progress and passed passed events relavent to the progression of the
  11. # story. This script needs polishing.
  12. #
  13. #----------------------------------------------------------------------
  14. # Instruction:
  15. #
  16. # For custom defualt settings see editable region to make desired
  17. # changes.
  18. #
  19. # During the progression of the games story insert the following script
  20. # calls in events to update the journal.
  21. #
  22. # change_synopsis_description_text( "Insert text here")
  23. # change_synopsis_objective_text( "Insert text here")
  24. # change_synopsis_background_image( "Insert file name here without
  25. # file extension.")
  26. #
  27. # To add a custom background simply add the image to your pictures folder
  28. # and use the script call shown above for the background image and input
  29. # file name for your custom image. The image will be stretched or
  30. # compressed to fit the screen. It is recommended that the custom image
  31. # be scalable by 544x416 (The default screen dimentions of the game. If
  32. # you use Yanfly you may have to re-evaluate the demenions of the scale
  33. # accordingly when creating your custom image.
  34. #
  35. # By default this script uses the "Book" image from the title folder;
  36. # imported to the pictures folder.
  37. #
  38. # Note: If you are injecting this script into a pre-exsisting project
  39. # you must start a new game or you will have errors.
  40. #
  41. #======================================================================
  42.  
  43. module VianoceGames14
  44. module SynopsisScene
  45.  
  46. #==================================================================
  47. #
  48. # ** Editable Region ////////////////////////////////////////////
  49. #
  50. #------------------------------------------------------------------
  51. # Here you can edit options to give the scene a custom look.
  52. #==================================================================
  53. Description_Window_Opacity = 255 # Opacity for windows are
  54. # 255: means fully visable
  55. Objective_Window_Opacity = 255 # 0: means invisable
  56.  
  57. Header_Window_opacity = 255
  58.  
  59. Default_Background_Image = "" # If background image has an error
  60. # use this default image.
  61. #==================================================================
  62. # End of editable region
  63. #==================================================================
  64.  
  65. #==================================================================
  66. # * New Method: Word Wrapping
  67. #==================================================================
  68. def self.word_wrapping(window, text)
  69. # Current text position
  70. current_text_position = 0
  71.  
  72. for i in 0..(text.length - 1)
  73.  
  74. if text[i] == "\n"
  75. current_text_position = 0
  76. next
  77. end
  78.  
  79. # Current position += character(digit) width
  80. current_text_position += window.text_size(text[i]).width
  81.  
  82. # If current position > window width
  83. if current_text_position >= window.width - 32
  84. # The paragraph format
  85. current_element = i
  86. while(text[current_element] != " ")
  87. break if current_element == 0
  88. current_element -= 1
  89. end
  90.  
  91. temp_text = ""
  92. for j in 0..(text.length - 1)
  93. temp_text += text[j]
  94. temp_text += "\n" if j == current_element
  95. end
  96. text = temp_text
  97. i = current_element
  98. current_text_position = 0
  99. end
  100. end
  101. return text
  102. end
  103. end
  104. end
  105.  
  106. class Scene_Synopsis < Scene_Base
  107. #--------------------------------------------------------------------------
  108. # * Start Processing
  109. #--------------------------------------------------------------------------
  110. def start
  111. super()
  112.  
  113. #------------------------------------------------------------------------
  114. # * Background Image
  115. #------------------------------------------------------------------------
  116. if $game_system.synopsis_background_image != "" && !! VianoceGames14::SynopsisScene::Default_Background_Image != ""
  117. background_image = nil
  118. if $game_system.synopsis_background_image != ""
  119. background_image = $game_system.synopsis_background_image
  120. else
  121. background_image = VianoceGames14::SynopsisScene::Default_Background_Image != ""
  122. end
  123.  
  124. @custom_sprite = Sprite.new()
  125. @custom_sprite.bitmap = Cache.picture(background_image)
  126. @custom_sprite.x = 0
  127. @custom_sprite.y = 0
  128. @custom_sprite.z = 0
  129. @custom_sprite.zoom_x = Graphics.width.to_f / @custom_sprite.bitmap.width
  130. @custom_sprite.zoom_y = Graphics.height.to_f / @custom_sprite.bitmap.height
  131. @custom_sprite.opacity = 255
  132. @custom_sprite.visible = true
  133. end
  134. #------------------------------------------------------------------------
  135. # Windows
  136. #------------------------------------------------------------------------
  137. @window_synopsis_header = Window_Synopsis_Header.new()
  138. @window_synopsis_description = Window_Synopsis_Description.new()
  139. @window_synopsis_objective = Window_Synopsis_Objective.new()
  140. @window_synopsis_description.opacity = VianoceGames14::SynopsisScene::Description_Window_Opacity
  141. @window_synopsis_objective.opacity = VianoceGames14::SynopsisScene::Objective_Window_Opacity
  142. @window_synopsis_header.opacity = VianoceGames14::SynopsisScene::Header_Window_opacity
  143. end
  144. #--------------------------------------------------------------------------
  145. # * Post-Start Processing
  146. #--------------------------------------------------------------------------
  147. def post_start
  148. super()
  149. end
  150. #--------------------------------------------------------------------------
  151. # * Frame Update
  152. #--------------------------------------------------------------------------
  153. def update
  154. super()
  155. return_scene() if Input.trigger?(:B)
  156. cancel_se() if Input.trigger?(:B)
  157. end
  158. end
  159.  
  160. def cancel_se
  161. cancel_sound = "Cancel2"
  162.  
  163. RPG::SE.new(cancel_sound, 70, 100).play
  164. end
  165. #--------------------------------------------------------------------------
  166. # * Pre-Termination Processing
  167. #--------------------------------------------------------------------------
  168. def pre_terminate
  169. end
  170. #--------------------------------------------------------------------------
  171. # * Termination Processing
  172. #--------------------------------------------------------------------------
  173. def terminate
  174. super()
  175. if @background_image
  176. @custom_sprite.bitmap.dispose()
  177. @custom_sprite.dispose()
  178. end
  179.  
  180. @window_synopsis_objective.dispose()
  181. @window_synopsis_description.dispose()
  182. @window_synopsis_header.dispose()
  183. end
  184.  
  185. #==============================================================================
  186. # ** Window_MenuCommand
  187. #------------------------------------------------------------------------------
  188. # This command window appears on the menu screen.
  189. #==============================================================================
  190.  
  191. class Window_MenuCommand < Window_Command
  192. #--------------------------------------------------------------------------
  193. # * For Adding Original Commands
  194. #--------------------------------------------------------------------------
  195. alias vg14_custscene_winmencmmd_addorigcmmd_43trwe add_original_commands
  196. #--------------------------------------------------------------------------
  197. def add_original_commands
  198. vg14_custscene_winmencmmd_addorigcmmd_43trwe() # Call original method
  199. add_command("Journal", :synopsis_scene, true)
  200. end
  201. end
  202.  
  203.  
  204.  
  205. #==============================================================================
  206. # ** Scene_Menu
  207. #------------------------------------------------------------------------------
  208. # This class performs the menu screen processing.
  209. #==============================================================================
  210.  
  211. class Scene_Menu < Scene_MenuBase
  212. #--------------------------------------------------------------------------
  213. # * Create Command Window
  214. #--------------------------------------------------------------------------
  215. alias vg14_custscene_scenemenu_createcmmdwindow_43trwe create_command_window
  216. #--------------------------------------------------------------------------
  217. def create_command_window
  218. vg14_custscene_scenemenu_createcmmdwindow_43trwe() # Call original method
  219. @command_window.set_handler(:synopsis_scene, method(:command_scenesynopsis))
  220. end
  221.  
  222. def command_scenesynopsis
  223. SceneManager.call(Scene_Synopsis)
  224. end
  225. end
  226.  
  227. #==============================================================================
  228. # ** Window_Despription.
  229. #------------------------------------------------------------------------------
  230. # This message window is used to display text for the quest Desription.
  231. #==============================================================================
  232.  
  233. class Window_Synopsis_Description < Window_Base
  234. def initialize()
  235. super(0, (Graphics.height * 0.13), Graphics.width, (Graphics.height * 0.57))
  236. draw_description()
  237. end
  238.  
  239. def draw_description()
  240.  
  241. text = VianoceGames14::SynopsisScene::word_wrapping(self, $game_system.synopsis_description_text)
  242. draw_text_ex(0, 0, text)
  243. end
  244. end
  245.  
  246. #==============================================================================
  247. # ** Window_Objective
  248. #------------------------------------------------------------------------------
  249. # This message window is used to display text
  250. #==============================================================================
  251.  
  252. class Window_Synopsis_Objective < Window_Base
  253. def initialize()
  254. super(0, (Graphics.height * 0.7), Graphics.width, (Graphics.height * 0.3))
  255. draw_objective()
  256. end
  257.  
  258. def draw_objective()
  259. text = VianoceGames14::SynopsisScene::word_wrapping(self, $game_system.synopsis_objective_text)
  260. draw_text_ex(0, 0, text)
  261. end
  262. end
  263.  
  264. #==============================================================================
  265. # ** Window_Header
  266. #------------------------------------------------------------------------------
  267. # This message window is used to display text
  268. #==============================================================================
  269.  
  270. class Window_Synopsis_Header < Window_Base
  271. def initialize()
  272. super(0, 0, Graphics.width, (Graphics.height * 0.13))
  273. draw_image()
  274. end
  275.  
  276. def draw_image()
  277. text = VianoceGames14::SynopsisScene::word_wrapping(self, $game_system.synopsis_header_text)
  278. draw_text_ex(0, 0, text)
  279. end
  280. end
  281.  
  282. #==============================================================================
  283. # ** Game_System
  284. #------------------------------------------------------------------------------
  285. # This class handles system data. It saves the disable state of saving and
  286. # menus. Instances of this class are referenced by $game_system.
  287. #==============================================================================
  288.  
  289. class Game_System
  290. #--------------------------------------------------------------------------
  291. # * Public Instance Variables
  292. #--------------------------------------------------------------------------
  293. attr_accessor :synopsis_header_text
  294. attr_accessor :synopsis_description_text
  295. attr_accessor :synopsis_objective_text
  296. attr_accessor :synopsis_background_image
  297. #--------------------------------------------------------------------------
  298. # * Object Initialization
  299. #--------------------------------------------------------------------------
  300. alias vg14_gamesystem_synopsis_initialize_43eds initialize
  301. #--------------------------------------------------------------------------
  302. def initialize
  303. @synopsis_description_text = "Progress: \nNothion has happened yet." # Default story synopsis
  304. @synopsis_objective_text = "Objective(s): \nNo current Objectives." # Default objectives
  305. @synopsis_header_text = "Header section (quest titles & or story chapter)" # Default chapter title
  306. @synopsis_background_image = "Book" # comments -> # Default background image
  307. vg14_gamesystem_synopsis_initialize_43eds() # Call original method
  308. end
  309. end
  310.  
  311. #==============================================================================
  312. # ** Game_Interpreter
  313. #------------------------------------------------------------------------------
  314. # An interpreter for executing event commands. This class is used within the
  315. # Game_Map, Game_Troop, and Game_Event classes.
  316. #==============================================================================
  317.  
  318. class Game_Interpreter
  319.  
  320. def change_synopsis_description_text( text )
  321. return unless text.is_a?(String)
  322. $game_system.synopsis_description_text = text
  323. end
  324.  
  325. def change_synopsis_objective_text( text )
  326. return unless text.is_a?(String)
  327. $game_system.synopsis_objective_text = text
  328. end
  329.  
  330. def change_synopsis_background_image( text )
  331. return unless text.is_a?(String)
  332. $game_system.synopsis_background_image = text
  333. end
  334.  
  335. def change_synopsis_header_text( text )
  336. return unless text.is_a?(String)
  337. $game_system.synopsis_header_text = text
  338. end
  339. end