Advertisement
dsiver144

Class Skin/System Add-on

Aug 5th, 2017
111
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.44 KB | None | 0 0
  1. #-------------------------------------------------------------------------------
  2. # * Class Skin/System Add-on
  3. # dsiver144
  4. # re-activate common event of class's current skin
  5. # - Put this below all of card skin script.
  6. #-------------------------------------------------------------------------------
  7. class Scene_ClassChoosing
  8. #-------------------------------------------------------------------------
  9. # * new method: on_class_confirm_ok
  10. #-------------------------------------------------------------------------
  11. def on_class_confirm_ok
  12. @window_confirm.close
  13. @window_confirm.deactivate
  14. old_class_id = $game_system.last_skin_access[:class_id]
  15. skin_id = $game_system.last_skin_access[:skin_id]
  16. if old_class_id && skin_id
  17. old_hash = DSIVER144::CARD_SKIN_SYSTEM::LEADER_SKINS[old_class_id][skin_id]
  18. if old_hash && (old_class_id != @window_classcommand.current_class_id)
  19. $game_switches[old_hash[:switch_id]] = false
  20. $game_temp.reserve_common_event(old_hash[:common_ev_id])
  21. end
  22. end
  23. while @sprite_black.opacity > 0
  24. @sprite_black.opacity -= 5
  25. Graphics.update
  26. @window_confirm.update
  27. end
  28. if $game_system.current_class
  29. class_data = CLASSES[$game_system.current_class]
  30. $game_switches[class_data[:switch_id]] = false
  31. end
  32. $game_system.current_class = @window_classcommand.current_class_id
  33. class_data = CLASSES[$game_system.current_class]
  34. $game_switches[class_data[:switch_id]] = true
  35. $game_actors[1].change_class(class_data[:class_id])
  36. $game_system.current_class = @window_classcommand.current_class_id
  37. @window_classcommand.activate
  38. deck_to_coll
  39. # --- Addtional to Class Skin System -------
  40. class_id = $game_system.current_class
  41. skin_id = $game_system.leader_current_card_skin[class_id]
  42. if skin_id != 0
  43. skin_data = DSIVER144::CARD_SKIN_SYSTEM::LEADER_SKINS[class_id][skin_id]
  44. if skin_data
  45. $game_switches[skin_data[:switch_id]] = true
  46. $game_temp.reserve_common_event(skin_data[:common_ev_id])
  47. end
  48. end
  49. # ------------------------------------------
  50. SceneManager.goto(Scene_Deck)
  51. end
  52. end # Scene_ClassChoosing
  53.  
  54. class Window_CardLeadSkinList
  55. #--------------------------------------------------------------------------
  56. # * set_new_skin
  57. #--------------------------------------------------------------------------
  58. def set_new_skin
  59. old_hash = LEADER_SKINS[@class_id][$game_system.leader_current_card_skin[@class_id]]
  60. if old_hash
  61. $game_switches[old_hash[:switch_id]] = false
  62. end
  63. if $game_system.leader_card_skins[@class_id].include?(current_skin_id) || current_skin_id == 0
  64. $game_system.leader_current_card_skin[@class_id] = current_skin_id
  65. if current_hash_data
  66. $game_switches[current_hash_data[:switch_id]] = true
  67. $game_temp.reserve_common_event(current_hash_data[:common_ev_id])
  68. end
  69. if old_hash && current_skin_id == 0
  70. $game_temp.reserve_common_event(old_hash[:common_ev_id])
  71. end
  72. Sound.play_ok
  73. refresh
  74. $game_system.last_skin_access[:class_id] = @class_id
  75. $game_system.last_skin_access[:skin_id] = current_skin_id
  76. else
  77. Sound.play_buzzer
  78. end
  79. end
  80. end
  81.  
  82. class Game_System
  83. attr_accessor :last_skin_access
  84. alias_method(:init_last_skin_access, :initialize)
  85. def initialize
  86. @last_skin_access = {}
  87. init_last_skin_access
  88. end
  89. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement