Advertisement
FlipelyFlip

Change Battler Graphic by Damage

Oct 16th, 2012
208
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Ruby 3.21 KB | None | 0 0
  1. module Flip
  2.  
  3.   HP_LIMIT_1 = 10 # lowest limit to change the graphic of the battler
  4.   HP_LIMIT_2 = 25 # low limit to change the graphic of the battler
  5.   HP_LIMIT_3 = 50 # middle limit to change the graphic of the battler
  6.   HP_LIMIT_4 = 75 # highest limit to change the battler graphic
  7.  
  8.   HP_LIMIT_PERCENT = true # if true, the HP_LIMITer will be set as percentage
  9.  
  10.   HP_LIMIT_ENDING_1 = "_critical" # ending phrase of the battler graphic by LIMIT_1
  11.   HP_LIMIT_ENDING_2 = "_low" # ending phrase of the battler graphic by LIMIT_2
  12.   HP_LIMIT_ENDING_3 = "_middle" # ending phrase of the battler graphic by LIMIT_3
  13.   HP_LIMIT_ENDING_4 = "_ok" # ending phrase of the battler graphic by LIMIT_4
  14.  
  15.   #battler graphics should be saved by the name of the battler like:
  16.   # Aluxes
  17.   # Aluxes_ok
  18.   # Aluxes_middle
  19.   # Aluxes_low
  20.   # Aluxes_critical
  21.   # else you will run into errors.
  22. end
  23.  
  24. class Scene_Battle
  25.   #--------------------------------------------------------------------------
  26.   # ● フレーム更新
  27.   #--------------------------------------------------------------------------
  28.   def change_battler_graphic
  29.     for i in $game_party.actors
  30.       old_graphics = []
  31.       old_graphics[0] = i.character_name
  32.       old_graphics[1] = i.character_hue
  33.       old_graphics[2] = i.battler_name
  34.       old_graphics[3] = i.battler_hue
  35.       if Flip::HP_LIMIT_PERCENT
  36.         actor_hp = i.hp
  37.         actor_hp *= 100
  38.         actor_hp /= i.maxhp
  39.         if actor_hp <= Flip::HP_LIMIT_1
  40.           i.set_graphic(old_graphics[0],old_graphics[1],i.name + Flip::HP_LIMIT_ENDING_1,old_graphics[3])
  41.         elsif actor_hp <= Flip::HP_LIMIT_2
  42.           i.set_graphic(old_graphics[0],old_graphics[1],i.name + Flip::HP_LIMIT_ENDING_2,old_graphics[3])
  43.         elsif actor_hp <= Flip::HP_LIMIT_3
  44.           i.set_graphic(old_graphics[0],old_graphics[1],i.name + Flip::HP_LIMIT_ENDING_3,old_graphics[3])
  45.         elsif actor_hp <= Flip::HP_LIMIT_4
  46.           i.set_graphic(old_graphics[0],old_graphics[1],i.name + Flip::HP_LIMIT_ENDING_4,old_graphics[3])
  47.         else
  48.           i.set_graphic(old_graphics[0],old_graphics[1],i.name,old_graphics[3])
  49.         end
  50.       else
  51.         if actor_hp <= Flip::HP_LIMIT_1
  52.           i.set_graphic(old_graphics[0],old_graphics[1],i.name + Flip::HP_LIMIT_ENDING_1,old_graphics[3])
  53.         elsif actor_hp <= Flip::HP_LIMIT_2
  54.           i.set_graphic(old_graphics[0],old_graphics[1],i.name + Flip::HP_LIMIT_ENDING_2,old_graphics[3])
  55.         elsif actor_hp <= Flip::HP_LIMIT_3
  56.           i.set_graphic(old_graphics[0],old_graphics[1],i.name + Flip::HP_LIMIT_ENDING_3,old_graphics[3])
  57.         elsif actor_hp <= Flip::HP_LIMIT_4
  58.           i.set_graphic(old_graphics[0],old_graphics[1],i.name + Flip::HP_LIMIT_ENDING_4,old_graphics[3])
  59.         else
  60.           i.set_graphic(old_graphics[0],old_graphics[1],i.name,old_graphics[3])
  61.         end
  62.       end
  63.     end
  64.   end
  65.   #--------------------------------------------------------------------------
  66.   # * Frame Update (main phase step 6 : refresh)
  67.   #--------------------------------------------------------------------------
  68.   alias flip_update_phase4_step6 update_phase4_step6
  69.   def update_phase4_step6
  70.     change_battler_graphic
  71.     flip_update_phase4_step6
  72.   end
  73. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement