Advertisement
TheSixth

Battle Busts by Sixth

Sep 2nd, 2015
1,154
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Ruby 7.52 KB | None | 0 0
  1. #===============================================================================
  2. # * [ACE] Battle Busts
  3. #===============================================================================
  4. # * Made by: Sixth (www.rpgmakervxace.net, www.forums.rpgmakerweb.com)
  5. # * Version: 1.0
  6. # * Updated: 27/01/2015
  7. # * Requires: -------
  8. #-------------------------------------------------------------------------------
  9. # * < Change Log >
  10. #-------------------------------------------------------------------------------
  11. # * Version 1.0 (27/01/2015)
  12. #   - Initial release.
  13. #-------------------------------------------------------------------------------
  14. # * < Description >
  15. #-------------------------------------------------------------------------------
  16. # * This script will add an option to display bust images for the actors during
  17. #   the battle when you are selecting their commands.
  18. # * Settings to setup the position, opacity and z value of the bust image for
  19. #   each actor separately!
  20. # * Script call to change an actor's battle bust image and their properties
  21. #   during the game!
  22. #-------------------------------------------------------------------------------
  23. # * < Script Calls >
  24. #-------------------------------------------------------------------------------
  25. # * To change an actor's battle bust image during the game, you can use the
  26. #   following script call:
  27. #
  28. #     change_battle_bust(id,img,pos*,opa*,z*)
  29. #
  30. #    id = The id of the actor.
  31. #   img = The image file name for the new bust.
  32. #   pos = The position array for the new bust.
  33. #   opa = The opacity for the new bust.
  34. #     z = The z value for the new bust.
  35. #
  36. #   Settings marked with a * sign are optional and can be omitted at will.
  37. #   If they are omitted, the settings for those will not be changed.
  38. #   NOTE:
  39. #   If you want to define a new z value for a bust, you must define the pos and
  40. #   opa settings too! Similarly, if you want to define the opacity value for the
  41. #   bust, you must define the pos setting too but you can omit the z setting!
  42. #
  43. # * Example:
  44. #
  45. #     change_battle_bust(2,"actorbbust3a",[250,200])
  46. #
  47. #   This would change the battle bust image used for the actor with the ID of 2
  48. #   to the image named "actorbbust3a".
  49. #   It's X position would be 250, and it's Y position would be 200.
  50. #   It's opacity and z value would stay the same as before.
  51. #-------------------------------------------------------------------------------
  52. # * < Installation >
  53. #-------------------------------------------------------------------------------
  54. # * Place this script below Materials but above Main!
  55. #-------------------------------------------------------------------------------
  56. # * < Compatibility Info >
  57. #-------------------------------------------------------------------------------
  58. # * No known incompatibilities.
  59. #-------------------------------------------------------------------------------
  60. # * < Known Issues >
  61. #-------------------------------------------------------------------------------
  62. # * No known issues.
  63. #-------------------------------------------------------------------------------
  64. # * < Terms of Use >
  65. #-------------------------------------------------------------------------------
  66. # * Free to use for whatever purposes you want.
  67. # * Credit me (Sixth) in your game, pretty please! :P
  68. # * Posting modified versions of this script is allowed as long as you notice me
  69. #   about it with a link to it!
  70. #===============================================================================
  71. $imported = {} if $imported.nil?
  72. $imported["SixthBattleBusts"] = true
  73. #===============================================================================
  74. # Settings:
  75. #===============================================================================
  76. module Sixth_Battle_Busts
  77.  
  78.   # The folder used for storing the battle bust images.
  79.   BustImg_Folder = "Graphics/BattleBust/"
  80.  
  81.   # Bust image setup starts here!
  82.   #
  83.   # Format:
  84.   #
  85.   #   ID => { # <-- The ID is the id of the actor from your database.
  86.   #     :image => "image file name", # <-- Enter the image name here.
  87.   #     :pos => [x,y], # <-- Enter the X and Y position for the image here.
  88.   #     :opacity => value, # <-- Enter the opacity value for the image here.
  89.   #     :z => value, # <-- Enter the z value for the image here.
  90.   #   }, # <-- Closing the bust setup for an actor. Never forget this line!
  91.   #
  92.   # Each actor must have a valid setting setup here!
  93.   # Valid values for the opacity setting: 0 - 255. (0 = fully transparent!)
  94.   # The z value affects what appears before the image and what appears below it.
  95.   # Can be used to show the bust image below or under some specific windows.
  96.   Bust_Setup = { # <-- No touchy-touchy!
  97.     1 => {
  98.       :image => "bust1-A",
  99.       :pos => [282,128],
  100.       :opacity => 255,
  101.       :z => 40,
  102.     },
  103.     2 => {
  104.       :image => "bust3-A",
  105.       :pos => [282,128],
  106.       :opacity => 255,
  107.       :z => 40,
  108.     },
  109.     3 => {
  110.       :image => "bust2-A",
  111.       :pos => [282,128],
  112.       :opacity => 255,
  113.       :z => 40,
  114.     },
  115.     # Add as many as you want here!
  116.   } # <-- No touchy-touchy!
  117.  
  118. end # <-- No touchy-touchy!
  119. #===============================================================================
  120. # End of Settings! Editing anything below may lead to... You know what, right?
  121. #===============================================================================
  122.  
  123. module Cache
  124.  
  125.   def self.battle_bust(filename)
  126.     load_bitmap(Sixth_Battle_Busts::BustImg_Folder, filename)
  127.   end
  128.  
  129. end
  130.  
  131. class Scene_Battle < Scene_Base
  132.  
  133.   alias make_bust_sprites1222 create_spriteset
  134.   def create_spriteset
  135.     make_bust_sprites1222
  136.     create_bust_sprite
  137.   end
  138.  
  139.   def create_bust_sprite
  140.     @bust = Sprite.new
  141.   end
  142.  
  143.   alias actor_bust_drawing1223 next_command
  144.   def next_command
  145.     actor_bust_drawing1223
  146.     draw_actor_bust_image
  147.   end
  148.  
  149.   alias actor_bust_drawing1253 prior_command
  150.   def prior_command
  151.     actor_bust_drawing1253
  152.     draw_actor_bust_image
  153.   end
  154.  
  155.   def draw_actor_bust_image
  156.     @bust.bitmap.dispose if !@bust.bitmap.nil? && !@bust.bitmap.disposed?
  157.     if !BattleManager.actor.nil?
  158.       @bust_data = BattleManager.actor.battle_bust
  159.       @bust.bitmap = Cache.battle_bust(@bust_data[:image])
  160.       @bust.x = @bust_data[:pos][0]; @bust.y = @bust_data[:pos][1]
  161.       @bust.opacity = @bust_data[:opacity]; @bust.z = @bust_data[:z]
  162.     end
  163.   end
  164.  
  165.   alias hide_actor_bust1223 turn_start
  166.   def turn_start
  167.     @bust.bitmap.dispose if !@bust.bitmap.nil? && !@bust.bitmap.disposed?
  168.     hide_actor_bust1223
  169.   end
  170.  
  171.   alias dispose_busts1223 dispose_spriteset
  172.   def dispose_spriteset
  173.     dispose_bust_sprite
  174.     dispose_busts1223
  175.   end
  176.  
  177.   def dispose_bust_sprite
  178.     @bust.bitmap.dispose if !@bust.bitmap.nil? && !@bust.bitmap.disposed?
  179.     @bust.dispose if !@bust.nil?
  180.   end
  181.  
  182. end
  183.  
  184. class Game_Actor < Game_Battler
  185.  
  186.   attr_accessor  :battle_bust
  187.  
  188.   alias init_battle_busts2233 initialize
  189.   def initialize(actor_id)
  190.     init_battle_busts2233(actor_id)
  191.     @battle_bust = Sixth_Battle_Busts::Bust_Setup[actor_id]
  192.   end
  193.    
  194. end
  195.  
  196. class Game_Interpreter
  197.  
  198.   def change_battle_bust(id,img,pos=nil,opa=nil,z=nil)
  199.     $game_actors[id].battle_bust[:image] = img
  200.     $game_actors[id].battle_bust[:pos] = pos if !pos.nil?
  201.     $game_actors[id].battle_bust[:opacity] = opa if !opa.nil?
  202.     $game_actors[id].battle_bust[:z] = z if !z.nil?
  203.   end
  204.  
  205. end
  206. #==============================================================================
  207. # !!END OF SCRIPT - OHH, NOES!!
  208. #==============================================================================
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement