IceSage

Enemy Character Hues (Yami Engine Symphony add-on)

Mar 15th, 2014
223
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. =begin
  2. ##~~============================================================================
  3.               --Enemy Character Hues (Yami Symphony add-on)--
  4.    Version: 1.1
  5.    Author: IceSage
  6.    Parent Author/Source: Yami Engine Symphony / Add-on: Enemy Character Set
  7.    
  8.    Compatibility:
  9.       Compatible with Yami's Engine Symphony "Enemy Character Set" script only.
  10.    
  11.    Description:
  12.       Allows you to change the hue of an enemy Character Set Battler by
  13.       adjusting the hue slider when chosing a picture for a Monster normally.
  14.       YES: Enemy Character Set Battlers did not come with this featured integrated, so
  15.       changing the hue for your enemy monster did nothing.
  16.      
  17.       You may also adjust the hue by using & modifying your current note tags
  18.       for your enemy battlers, adding an extra number to assign a hue to
  19.       the battler. (This will overwrite whatever hue was chosen when you
  20.       imported the picture / adjusted the hue slider.)
  21.    
  22.       Example:
  23.         <battler set: filename, index[, hue]>
  24.           <battler set: Monster2, 6>
  25.               Default notetag. Hue will default to monster's default.
  26.           <battler set: Monster2, 6, 99>
  27.               Hue added, changes hue to 99 regardless of currently set hue.
  28. ##~~============================================================================
  29.     Terms:
  30.       -Free for Commercial / Non-Commercial use.
  31.             Any terms by Yami still apply.
  32.       -Must accept that code is "as is."
  33.             Will do bug fixes, but no external compatibility other than YEA/YES.
  34.       -Must accept it won't be compatible with other scripts or parent script.
  35.       -Author not responsible for any errors or incompatibility.
  36.       -No need to add credit to me in your game, but preserve this header.
  37.       -Can redistribute and modify, but preserve this header.
  38. ##~~============================================================================
  39. =end
  40.  
  41. if $imported["BattleSymphony-EnemyCharset"]
  42.  
  43.   ##========================================================================
  44.   # Cache doesn't have "hue" for characters. Let's make one!
  45.   ##========================================================================
  46.  
  47. class << Cache
  48.  
  49.   def character(filename, hue = 0)
  50.     load_bitmap("Graphics/Characters/", filename, hue)
  51.   end
  52.  
  53. end
  54.  
  55.   ##========================================================================
  56.   # Let's change it so that only enemies get hues, then change the bitmap.
  57.   ##========================================================================
  58.  
  59. class Sprite_Battler < Sprite_Base
  60.  
  61.      def set_character_bitmap
  62.        
  63.       @huecolor = self.battler.battler_hue
  64.      
  65.       #Check if Battler is Enemy or not.
  66.       if battler.actor?
  67.           self.bitmap = Cache.character(@character_name, 0)
  68.           #Player Actors don't get hue.
  69.         else
  70.           self.bitmap = Cache.character(@character_name, @huecolor)
  71.           #Enemies get a hue.
  72.       end
  73.          sign = @character_name[/^[\!\$]./]
  74.             if sign && sign.include?('$')
  75.               @cw = bitmap.width / 3
  76.               @ch = bitmap.height / 4
  77.             else
  78.               @cw = bitmap.width / 12
  79.               @ch = bitmap.height / 8
  80.             end
  81.       end
  82. end
  83.  
  84. class RPG::BaseItem
  85.  
  86.   #--------------------------------------------------------------------------
  87.   # * Public Instance Variables
  88.   #--------------------------------------------------------------------------
  89.   attr_accessor :character_name
  90.   attr_accessor :character_index
  91.   attr_accessor :eweapon_1
  92.   attr_accessor :eweapon_2
  93.   attr_accessor :eshield
  94.   attr_accessor :battler_hue
  95.  
  96.   ##===========================================================================
  97.   # Overwrite Symphony method: battle_symphony_enemy_charset    
  98.   # Adding an extra field to the battle tag for hue.
  99.   ##===========================================================================
  100.  
  101.   def battle_symphony_enemy_charset
  102.     self.note.split(/[\r\n]+/).each { |line|
  103.       case line
  104.       when REGEXP::SYMPHONY::CHARSET
  105.         str_scan = $1.scan(/[^,]+/i)
  106.         @character_name = str_scan[0]
  107.         @character_index = str_scan[1].to_i
  108.     @battler_hue = str_scan[2].to_i if str_scan[2]
  109.       when REGEXP::SYMPHONY::WEAPON1
  110.         @eweapon_1 = $1.to_i
  111.       when REGEXP::SYMPHONY::WEAPON2
  112.         @eweapon_2 = $1.to_i
  113.       when REGEXP::SYMPHONY::SHIELD
  114.         @eshield = $1.to_i
  115.       end
  116.     }
  117.   end  
  118. end # RPG::BaseItem
  119.  
  120. else #Yami Imported If-else
  121.  
  122.   msg = "Battler Hues not Compatible!\n"
  123.   msg += "This script is an addon and requires its parent.\n"
  124.   msg += "You have 'Enemy Battler Hues' added, but not 'YEA: Enemy Battlers' \n"
  125.   msg += "Either remove this script, or add Yami's Enemy Battlers."
  126.   msgbox(sprintf(msg))
  127.   exit
  128.  
  129. end #Yami Check Imported
  130.  
  131. ##~~=====================================================================
  132. #   END OF SCRIPT
  133. ##~~=====================================================================
RAW Paste Data