Advertisement
dsiver144

DSI Class Image As Battler

Jul 4th, 2017
94
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.29 KB | None | 0 0
  1. #==============================================================================
  2. # DSI Class Image As Battler (Can't find a fancy name, lol)
  3. # -- Last Updated: 2017.07.04
  4. # -- Author: dsiver144
  5. # -- Level: Easy
  6. # -- Requires: n/a
  7. #==============================================================================
  8. $imported = {} if $imported.nil?
  9. $imported["DSI-ClassImageAsBattler"] = true
  10. #==============================================================================
  11. # + Updates
  12. # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  13. # 2017.07.04 - Finish first version.
  14. #==============================================================================
  15. # + Instructions
  16. # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  17. # To install this script, open up your script editor and copy/paste this script
  18. # to an open slot below ?? Materials/?f?? but above ?? Main. Remember to save.
  19. # Put this above MOG_Damage_Popup
  20. #==============================================================================
  21. module DSIVER144
  22. module CARD_AS_BATTLER
  23. NON_CLASS_BATTLER_IMAGE = "bt_mgirl_pudding_a" # In Graphics/Battlers Folder
  24. BATTLER_POSITION = [445,265] # [ X , Y ]
  25. ZOOM_SCALE = 1.0 # 1.0 = Full size
  26. end # CARD_AS_BATTLER
  27. end # DSIVER144
  28.  
  29. class Spriteset_Battle
  30. #--------------------------------------------------------------------------
  31. # * Create Actor Sprite
  32. # By default, the actor image is not displayed, but for convenience
  33. # a dummy sprite is created for treating enemies and allies the same.
  34. #--------------------------------------------------------------------------
  35. def create_actors
  36. @actor_sprites = Array.new(4) { Sprite_Battler.new(@viewport1) }
  37. end
  38. end # Spriteset_Battle
  39.  
  40. class Game_Actor
  41. include DSIVER144::CARD_AS_BATTLER
  42. #--------------------------------------------------------------------------
  43. # * new method: screen_x
  44. #--------------------------------------------------------------------------
  45. def screen_x
  46. return BATTLER_POSITION[0]
  47. end
  48. #--------------------------------------------------------------------------
  49. # * new method: screen_y
  50. #--------------------------------------------------------------------------
  51. def screen_y
  52. return BATTLER_POSITION[1]
  53. end
  54. #--------------------------------------------------------------------------
  55. # * new method: screen_z
  56. #--------------------------------------------------------------------------
  57. def screen_z
  58. return 100
  59. end
  60. end
  61.  
  62. class Sprite_Battler < Sprite_Base
  63. include DSIVER144::CARD_AS_BATTLER
  64. #--------------------------------------------------------------------------
  65. # * Public Instance Variables
  66. #--------------------------------------------------------------------------
  67. attr_accessor :battler
  68. #--------------------------------------------------------------------------
  69. # * new method: initialize
  70. #--------------------------------------------------------------------------
  71. alias_method(:dsi_init_battler, :initialize)
  72. def initialize(viewport, battler = nil)
  73. dsi_init_battler(viewport, battler)
  74. self.zoom_x = self.zoom_y = ZOOM_SCALE
  75. end
  76. #--------------------------------------------------------------------------
  77. # * new method: update
  78. #--------------------------------------------------------------------------
  79. def update
  80. super
  81. if @battler
  82. update_bitmap
  83. update_origin
  84. update_position
  85. setup_new_effect
  86. setup_new_animation
  87. update_effect
  88. else
  89. self.bitmap = nil
  90. @effect_type = nil
  91. end
  92. end
  93. #--------------------------------------------------------------------------
  94. # * new method: update_bitmap
  95. #--------------------------------------------------------------------------
  96. def update_bitmap
  97. if @battler.actor?
  98. id = $game_system.current_class ? $game_system.current_class : 0
  99. if id == 0
  100. new_bitmap = Cache.battler(NON_CLASS_BATTLER_IMAGE,0)
  101. else
  102. new_bitmap = Cache.picture(DSIVER144::CLASS_CHOOSING::CLASSES[id][:picture])
  103. end
  104. else
  105. new_bitmap = Cache.battler(@battler.battler_name, @battler.battler_hue)
  106. end
  107. if bitmap != new_bitmap
  108. self.bitmap = new_bitmap
  109. init_visibility
  110. end
  111. end
  112. end # Sprite_CardBattler
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement