Advertisement
dsiver144

Class Skin/System Add-on

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