Advertisement
dsiver144

DSI Card Skin v1.2

Jul 22nd, 2017
99
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 8.61 KB | None | 0 0
  1. #==============================================================================
  2. # DSI Card Skin v1.2
  3. # -- Last Updated: 2017.07.23
  4. # -- Author: dsiver144
  5. # -- Level: Normal
  6. # -- Requires: n/a
  7. #==============================================================================
  8. $imported = {} if $imported.nil?
  9. $imported["DSI-CardSkin"] = true
  10. #==============================================================================
  11. # + Updates
  12. # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  13. # 2017.07.16 - Finish first version.
  14. # 2017.07.19 - Add 2 script calls.
  15. # 2017.07.23 - Fix the BGM issues.
  16. #==============================================================================
  17. # + Instructions
  18. # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  19. # To install this script, open up your script editor and copy/paste this script
  20. # to an open slot below ?? Materials/?f?? but above ?? Main. Remember to save.
  21. # *Put this below my Class Choosing script.
  22. # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  23. # Script Call: open_skin_option_scene -> Open Skin Option Scene
  24. # unlock_card_skin(skill_id, skin_id_1, skin_id_2, ... skin_id_n)
  25. # - ex: unlock_card_skin(28, 1, 2) -> unlock extra skin #1, #2 for Earth Throw.
  26. # unlock_class_skin(class_id, skin_id_1, skin_id_2, ... skin_id_n)
  27. # - ex: unlock_class_skin(1, 2, 3) -> unlock extra skin #2, #3 for Earth Mage
  28. # class.
  29. #==============================================================================
  30. module DSIVER144
  31. module CARD_SKIN_SYSTEM
  32. SHOW_MENU_COMMAND = true
  33. end
  34. end
  35. class Game_Interpreter
  36. #--------------------------------------------------------------------------
  37. # new method: open_deck_option_scene
  38. #--------------------------------------------------------------------------
  39. def open_skin_option_scene
  40. SceneManager.call(Scene_CardSkinOptions)
  41. end
  42. end # Game_Interpreter
  43.  
  44. class Window_MenuCommand < Window_Command
  45. #---------------------------------------------------------------------------
  46. # overwritten method: add_main_commands
  47. #---------------------------------------------------------------------------
  48. alias_method(:dsi_card_skin_add_main_commands, :add_main_commands)
  49. def add_main_commands
  50. dsi_card_skin_add_main_commands
  51. if DSIVER144::CARD_SKIN_SYSTEM::SHOW_MENU_COMMAND
  52. add_command("Card Skin", :card_skin, main_commands_enabled)
  53. end
  54. end
  55. end # Window_MenuCommand
  56.  
  57. class Scene_Menu < Scene_MenuBase
  58. #--------------------------------------------------------------------------
  59. # Adds a handler to access the card crafting system
  60. #--------------------------------------------------------------------------
  61. alias_method(:dsiver144_create_command_window_dsi_card_skin, :create_command_window)
  62. def create_command_window
  63. dsiver144_create_command_window_dsi_card_skin
  64. if DSIVER144::CARD_CRAFTING::SHOW_MENU_COMMAND
  65. @command_window.set_handler(:card_skin, method(:command_card_skin))
  66. end
  67. end
  68. #--------------------------------------------------------------------------
  69. # * new method: command_card_skin
  70. #--------------------------------------------------------------------------
  71. def command_card_skin
  72. $game_system.save_bgm
  73. SceneManager.call(Scene_CardSkinOptions)
  74. end
  75. end # Scene_Menu
  76.  
  77. module DSIVER144
  78. module CARD_SKIN_SYSTEM
  79.  
  80. OPTION_SCENE_BG = "MeteorG"
  81. OPTION_SCENE_BGM = ["Scene5",100,100]
  82.  
  83. end # CLASS_ABILITY_SYSTEM
  84. end # DSIVER144
  85.  
  86. class Scene_CardSkinOptions < Scene_Base
  87. include DSIVER144::CARD_SKIN_SYSTEM
  88. #--------------------------------------------------------------------------
  89. # * new method: start
  90. #--------------------------------------------------------------------------
  91. def start
  92. super
  93. play_card_skin_bgm
  94. create_background
  95. create_buttons
  96. end
  97. #-------------------------------------------------------------------------
  98. # * new method: play_card_library_bgm
  99. #-------------------------------------------------------------------------
  100. def play_card_skin_bgm
  101. RPG::BGM.new(*OPTION_SCENE_BGM).play
  102. end
  103. #-------------------------------------------------------------------------
  104. # * new method: stop_card_bgm
  105. #-------------------------------------------------------------------------
  106. def stop_card_skin_bgm
  107. RPG::BGM.stop
  108. $game_system.replay_bgm
  109. end
  110. #--------------------------------------------------------------------------
  111. # * Create Background
  112. #--------------------------------------------------------------------------
  113. def create_background
  114. @background_sprite = Sprite.new
  115. @background_sprite.bitmap = Cache.picture(OPTION_SCENE_BG)
  116. end
  117. #--------------------------------------------------------------------------
  118. # * Free Background
  119. #--------------------------------------------------------------------------
  120. def dispose_background
  121. @background_sprite.dispose
  122. end
  123. #--------------------------------------------------------------------------
  124. # * new method: create_buttons
  125. #--------------------------------------------------------------------------
  126. def create_buttons
  127. @button1 = Window_DeckOptionButton.new(0,0,"Change Card Skins")
  128. @button2 = Window_DeckOptionButton.new(0,0,"Change Deck Leader Skins")
  129. @button3 = Window_DeckOptionButton.new(0,0,"Exit")
  130. space_y = @button3.height + 20
  131. cal_height = (@button1.height + space_y)*2 + @button1.height
  132. start_y = 0.5*(Graphics.height - cal_height)
  133. for i in 1..3
  134. eval("@button#{i}.x = 0.5*(Graphics.width - @button1.width)")
  135. eval("@button#{i}.y = start_y + #{space_y*(i)} - 20")
  136. end
  137. @command_index = $menu_last_cursor_pos ? $menu_last_cursor_pos : 0
  138. @buttons = [@button1,@button2,@button3]
  139. instant_change_opacity
  140. end
  141. #--------------------------------------------------------------------------
  142. # * new method: instant_change_opacity
  143. #--------------------------------------------------------------------------
  144. def instant_change_opacity
  145. @buttons.each_with_index do |button, index|
  146. if @command_index == index
  147. button.opacity = 255
  148. button.contents_opacity = 255
  149. else
  150. button.opacity = 100
  151. button.contents_opacity = 100
  152. end
  153. end
  154. end
  155. #--------------------------------------------------------------------------
  156. # * new method: update_button_opacity
  157. #--------------------------------------------------------------------------
  158. def update_button_opacity
  159. @buttons.each_with_index do |button, index|
  160. if @command_index == index
  161. if button.opacity < 255
  162. button.opacity += 10
  163. button.contents_opacity += 10
  164. elsif button.opacity > 255
  165. button.opacity = 255
  166. button.contents_opacity = 255
  167. end
  168. else
  169. if button.opacity > 100
  170. button.opacity -= 10
  171. button.contents_opacity -= 10
  172. elsif button.opacity < 100
  173. button.opacity = 100
  174. button.contents_opacity = 100
  175. end
  176. end
  177. end
  178. end
  179. #--------------------------------------------------------------------------
  180. # * new method: update_cursor
  181. #--------------------------------------------------------------------------
  182. def update_cursor
  183. if Input.repeat?(:UP)
  184. @command_index -= 1
  185. Sound.play_cursor
  186. @command_index = 2 if @command_index < 0
  187. end
  188. if Input.repeat?(:DOWN)
  189. @command_index += 1
  190. Sound.play_cursor
  191. @command_index = 0 if @command_index > 2
  192. end
  193. if Input.trigger?(:B)
  194. Sound.play_cancel
  195. stop_card_skin_bgm
  196. return_scene
  197. end
  198. if Input.trigger?(:C)
  199. case @command_index
  200. when 0
  201. Sound.play_ok
  202. $menu_last_cursor_pos = @command_index
  203. SceneManager.call(Scene_SkinType)
  204. when 1
  205. Sound.play_ok
  206. $menu_last_cursor_pos = @command_index
  207. SceneManager.call(Scene_LeadSkinType)
  208. when 2
  209. Sound.play_cancel
  210. stop_card_skin_bgm
  211. return_scene
  212. end
  213. end
  214. end
  215. #--------------------------------------------------------------------------
  216. # * new method: update
  217. #--------------------------------------------------------------------------
  218. def update
  219. super
  220. update_cursor
  221. update_button_opacity
  222. end
  223. #--------------------------------------------------------------------------
  224. # * new method: terminate
  225. #--------------------------------------------------------------------------
  226. def terminate
  227. super
  228. dispose_background
  229. end
  230. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement