Advertisement
diamondandplatinum3

Story-Entwined Status Screen ~ RGSS3

Dec 7th, 2012
727
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Ruby 40.44 KB | None | 0 0
  1. #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  2. #             Story-Entwined Status Screen
  3. #             Version: 1.0
  4. #             Authors: DiamondandPlatinum3
  5. #             Date: December 8, 2012
  6. #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  7. #  Description:
  8. #
  9. #    This script overhals the default status screen and replaces it with a fully
  10. #    customisable system that allows you to modify actor descriptions, names,
  11. #    font colours, side images and background textures to be used to show how
  12. #    much devleopment your characters have gone through throughout your game.
  13. #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  14. #------------------------------------------------------------------------------
  15. #  Instructions:
  16. #  
  17. #     In the editable region below, you can modify default values for font colours
  18. #     and set up textures for your already playable characters. Textures are individual
  19. #     to each character whilst font will be the same for all characters unless you
  20. #     specify individual colours (as explained below).
  21. #
  22. #
  23. #     In order to get specific font colours per character, you will need to used
  24. #     the following script call in an event
  25. #
  26. #       status_screen_modify_font_gauge_options( actor, option, red, green, blue )
  27. #
  28. #     - Where 'actor' can either be the name of the actor you wish to modify like "Ralph" (The
  29. #     name that is specified in the database, NOT in this script), or the ID of that actor.
  30. #     - 'option' is to be replaced with one of the font identifiers in the editable, pretty
  31. #     much just copy-paste them in quotation marks "NameFontColour".
  32. #     - Red, Green, Blue are just replaced by the RGB values for colours, you can find
  33. #     these on most paint associated software like Photoshop and Paint.net, or even online.
  34. #
  35. #
  36. #     There are more methods to use beside changing just the font per character.
  37. #     You can also modify Names and descriptions (only for the status screen, doesn't modify
  38. #     these in the database) and add or remove textures as you wish.
  39. #     Use the Following Script Calls:
  40. #
  41. #         status_screen_modify_actor_full_name( actor, sName )
  42. #         status_screen_add_background_image( actor, sImageName, width, height )
  43. #         status_screen_remove_background_image( actor, sImageName )
  44. #         status_screen_change_character_image( actor, sImageName, width, height )
  45. #         status_screen_change_character_description( actor, sDescription )
  46. #
  47. #
  48. #     'actor' means the same as above, replace the other things with exactly what
  49. #     they say they want, width & height for images is asking you what width and
  50. #     height you want to draw the image with, NOT what the width and height of the
  51. #     actual image is!
  52. #     Just remember that if you are passing in an argument with an 's' in front of it,
  53. #     that means that you need to put your argument in quotation marks, the same is true if
  54. #     you want to pass in 'actor' by their name rather than their ID.
  55. #
  56. #
  57. #     Those script calls are all you really need to worry about, you'll learn quicker by
  58. #     just messing around with it, so try it out.
  59. #
  60. #
  61. #     An Example Screenshot can be seen here:
  62. #     http://img4host.net/upload/0719500050c23a582f923.png
  63. #
  64. #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  65. ($diamondandplatinum3_scripts ||= {})[:StoryEntwinedStatusScreen] = true
  66.  
  67. module DiamondandPlatinum3
  68.   module StatusScreenOptions
  69.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  70.     #                                                        -=
  71.     #                 Editable Region        ////            ==
  72.     #                                                        =-
  73.     #-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  74.     ShowActorNickname         = true  # Do you wish the Actor's nickname to be shown?
  75.     ShowHLAfterName           = true  # Do you want to show a Horizontal Line just below your characters name?
  76.     SecondsUntilSwitchBGImage = 8     # How Many Seconds Until the Background is swapped?
  77.     #=======================================================================
  78.     # * Font/Gauge Colours, modify the RGB (Red, Green, Blue) values
  79.     # Use an online RGB colour wheel or other to get RGB values for colours
  80.     #=======================================================================
  81.     NameFontColour            = [ 255, 150, 0   ]
  82.     ClassLabelFontColour      = [ 100, 100, 241 ]
  83.     ClassFontColour           = [ 100, 100, 241 ]
  84.     NicknameLabelFontColour   = [ 214, 50,  100 ]
  85.     NicknameFontColour        = [ 214, 50,  100 ]
  86.     LevelLabelFontColour      = [ 58,  255, 225 ]
  87.     LevelFontColour           = [ 58,  255, 225 ]
  88.     StatusLabelFontColour     = [ 100, 100, 100 ]
  89.     EquipmentLabelFontColour  = [ 255, 248, 45  ]
  90.     EquipmentFontColour       = [ 255, 248, 45  ]
  91.     ParameterLabelFontColour  = [ 30,  255, 30  ]
  92.     ParameterFontColour       = [ 100, 200, 30  ]
  93.     HP_GaugeColour            = [ 255, 30,  30  ]
  94.     MP_GaugeColour            = [ 30,  30,  255 ]
  95.     EXP_GaugeColour           = [ 30,  255, 30  ]
  96.     DescriptionFontColour     = [ 255, 30,  30  ]
  97.     #=======================================================================
  98.     # * Character Display Name: this exists so that your character can have
  99.     #   a full name displayed in the status screen. If your character doesn't
  100.     #   have a full name, just enter their first name
  101.     #=======================================================================
  102.     #-----------------------------------------------------------------------
  103.     CharacterDisplayName = [ # <= Do not Touch this line
  104.     #-----------------------------------------------------------------------
  105.     "Rita ???",          # Full Name of Actor 1
  106.     "Emily ???",         # Full Name of Actor 2
  107.                          # Copy-paste above to add more
  108.     #=======================================================================
  109.     # * Background Picture: in this section you write the filename, then the
  110.     #   width you want the image, then the height you want the image. This is
  111.     #   written in an array format:
  112.     #   [ "Filename", Width, Height,
  113.     #     "Filename", Width, Height,
  114.     #       *Repeat
  115.     #   when you are finished adding all images for that character, you move
  116.     #   on to the next character by adding '],'
  117.     #=======================================================================
  118.     #-----------------------------------------------------------------------
  119.     ]; BackgroundPictures = [ # <= Do not Touch this line
  120.     #-----------------------------------------------------------------------
  121.     [ "Rita12", 544, 416,
  122.       "Rita18", 294, 416,
  123.       "Rita19", 286, 416,
  124.       "Rita17", 224, 416 ],   # Background Images for Actor 1
  125.      
  126.     [ "Emily2", 276, 416,
  127.       "Emily4", 544, 416, ],  # Background Images for Actor 2
  128.      
  129.     [ "Blah", 544, 416 ],     # Background Images for Actor 3
  130.    
  131.     [],                       # No Background Images for Actor 4
  132.    
  133.     #=======================================================================
  134.     # * Character Image: in this section you write the filename, width &
  135.     #   height of the image you want to have displayed when this character is
  136.     #   selected, it's the same as the above except you are limited to only
  137.     #   one image per actor.
  138.     #=======================================================================
  139.     #-----------------------------------------------------------------------
  140.     ]; CharacterImage = [ # <= Do not Touch this line
  141.     #-----------------------------------------------------------------------
  142.     [ "Rita_Sketch", 161, 416 ],     # Character Image for Actor 1
  143.     [ "Emily3", 121, 416 ],          # Character Image for Actor 2
  144.    
  145.     #-----------------------------------------------------------------------
  146.     ] # <= Do not Touch this line
  147.     #-----------------------------------------------------------------------
  148.   end # Of Editable Region
  149.   #-------------------------------------------------------------------------
  150. end
  151.  
  152.  
  153.  
  154.  
  155.  
  156.  
  157.  
  158.  
  159.  
  160.  
  161.  
  162.  
  163.  
  164.  
  165.  
  166.  
  167. #==============================================================================
  168. # ** Window_Status
  169. #------------------------------------------------------------------------------
  170. #  This window displays full status specs on the status screen.
  171. #==============================================================================
  172.  
  173. class Window_Status < Window_Selectable
  174.   include DiamondandPlatinum3::StatusScreenOptions
  175.   #--------------------------------------------------------------------------
  176.   # * Overwritten Method: Object Initialization
  177.   #--------------------------------------------------------------------------
  178.   def initialize(actor)
  179.     # New Instance Variables
  180.     @x = @y = 0; @w = 112; @h = line_height
  181.     @description_helpwindow = Window_Help.new()
  182.     @description_helpwindow.y = Graphics.height - @description_helpwindow.height
  183.    
  184.     @actor_BackgroundPictureSprites = []
  185.     @actor_CharacterImage = []
  186.     @currently_selected_actor_id = actor.id
  187.    
  188.     # Iterate Through The Background Images 2D Array
  189.     $game_system.dp3_status_screen_actor_backgroundimages_array.each do |actorBP_Array|
  190.       root_index = @actor_BackgroundPictureSprites.size
  191.       @actor_BackgroundPictureSprites[root_index] = Array.new()
  192.       element = 0
  193.       while(actorBP_Array[element]) do
  194.         current_index   = @actor_BackgroundPictureSprites[root_index].size
  195.         sprite          = Sprite.new()
  196.         sprite.bitmap   = Cache.picture(actorBP_Array[element])
  197.         sprite.opacity  = 0
  198.         element += 1
  199.         sprite.zoom_x   = actorBP_Array[element].to_f / sprite.bitmap.width
  200.         element += 1
  201.         sprite.zoom_y   = actorBP_Array[element].to_f / sprite.bitmap.height
  202.         sprite.x        = ((Graphics.width * 0.5) - (actorBP_Array[element - 1] * 0.5))
  203.         sprite.y        = 0
  204.         sprite.z        = 100
  205.        
  206.         @actor_BackgroundPictureSprites[root_index][current_index] = sprite
  207.         element += 1
  208.       end
  209.     end
  210.    
  211.     # Setup Character Images
  212.     $game_system.dp3_status_screen_actor_characterimage_array.each do |index|
  213.       sprite          = Sprite.new()
  214.       sprite.bitmap   = Cache.picture(index[0])
  215.       sprite.opacity  = 255
  216.       sprite.zoom_x   = index[1].to_f / sprite.bitmap.width
  217.       sprite.zoom_y   = index[2].to_f / sprite.bitmap.height
  218.       sprite.x        = (Graphics.width * 0.75) - (index[1] * 0.3)
  219.       sprite.y        = 0
  220.       sprite.z        = 150
  221.       sprite.visible  = false
  222.       @actor_CharacterImage[@actor_CharacterImage.size] = sprite
  223.     end
  224.    
  225.     @previous_bg_sprite = @current_bg_sprite = @actor_BackgroundPictureSprites[actor.id - 1][rand(@actor_BackgroundPictureSprites[actor.id - 1].size)]
  226.     @currentframescount = @framesuntilswitchbg = (SecondsUntilSwitchBGImage * 60)
  227.     @actor_CharacterImage[actor.id - 1].visible = true
  228.    
  229.     super( 0, 0, Graphics.width * 0.75, Graphics.height )
  230.     @actor = actor
  231.     refresh
  232.     activate
  233.    
  234.     self.opacity = 0
  235.     self.z = 244
  236.     @description_helpwindow.opacity = 0
  237.     @description_helpwindow.z = 255
  238.   end
  239.   #--------------------------------------------------------------------------
  240.   # * Dispose
  241.   #--------------------------------------------------------------------------
  242.   def dispose
  243.     super()
  244.    
  245.     # Dipose of the help window
  246.     @description_helpwindow.dispose()
  247.        
  248.     # Dispose of the Sprites that was created in initialisation
  249.     @actor_BackgroundPictureSprites.each do |inner_array|
  250.       inner_array.each do |element|
  251.         element.bitmap.dispose() unless element.bitmap.disposed?
  252.         element.dispose() unless element.disposed?
  253.       end
  254.     end
  255.    
  256.     @actor_CharacterImage.each do |element|
  257.       element.bitmap.dispose() unless element.bitmap.disposed?
  258.       element.dispose() unless element.disposed?
  259.     end
  260.   end
  261.   #--------------------------------------------------------------------------
  262.   # * New Method: Update
  263.   #--------------------------------------------------------------------------
  264.   def update()
  265.     @current_bg_sprite.opacity  += 1 if @current_bg_sprite && @current_bg_sprite.opacity < 255
  266.     @previous_bg_sprite.opacity -= 1 if @previous_bg_sprite && @previous_bg_sprite.opacity > 0
  267.    
  268.     @currentframescount += 1
  269.    
  270.    
  271.    
  272.     # ///// Update Character Image /////
  273.     if (@currently_selected_actor_id != @actor.id)
  274.       for i in 0..(@actor_CharacterImage.size - 1)
  275.         @actor_CharacterImage[i].visible = (i == (@actor.id - 1)) ? true : false
  276.       end
  277.     end
  278.      
  279.    
  280.    
  281.    
  282.    
  283.    
  284.     # ///// Update Background Images /////
  285.     #=-=-=-=-=
  286.     if @actor_BackgroundPictureSprites[@actor.id - 1]
  287.       #----------
  288.       if @actor_BackgroundPictureSprites[@actor.id - 1].size > 1
  289.         if (@currentframescount >= @framesuntilswitchbg) || (@currently_selected_actor_id != @actor.id)
  290.           @currentframescount = 0
  291.           @previous_bg_sprite = @current_bg_sprite
  292.           while(@previous_bg_sprite == @current_bg_sprite) do
  293.             @current_bg_sprite = @actor_BackgroundPictureSprites[@actor.id - 1][rand(@actor_BackgroundPictureSprites[@actor.id - 1].size)]
  294.           end
  295.         end
  296.       #----------  
  297.       else
  298.         @current_bg_sprite = @actor_BackgroundPictureSprites[@actor.id - 1][0]
  299.       end
  300.     #=-=-=-=-=  
  301.     else
  302.       @current_bg_sprite.opacity -= 2   if @current_bg_sprite && @current_bg_sprite.opacity > 0
  303.     end
  304.     #=-=-=-=-=
  305.    
  306.     # Decrease Opacity for all unassigned images
  307.     for innerarray in @actor_BackgroundPictureSprites
  308.       for sprite in innerarray
  309.         sprite.opacity -= 1 if sprite.opacity > 0 && sprite != @current_bg_sprite && sprite != @previous_bg_sprite
  310.       end
  311.     end
  312.    
  313.    
  314.     # Fix Up what's left
  315.     @currently_selected_actor_id  = @actor.id
  316.     @current_bg_sprite.z          = 100    if @current_bg_sprite
  317.     @previous_bg_sprite.z         = 101    if @previous_bg_sprite
  318.     super()
  319.   end
  320.   #--------------------------------------------------------------------------
  321.   # * Refresh
  322.   #--------------------------------------------------------------------------
  323.   def refresh
  324.     contents.clear
  325.     @x = @y = 0
  326.     draw_actor_name()
  327.     draw_horz_line(@y) if ShowHLAfterName
  328.     draw_actor_face()
  329.     draw_actor_class()
  330.     draw_actor_nickname() if ShowActorNickname && @actor.nickname != ""
  331.     draw_actor_level()
  332.     draw_actor_icons()
  333.     draw_actor_hp()
  334.     draw_actor_mp()
  335.     draw_exp_info()
  336.     draw_equipments()
  337.     draw_parameters()
  338.     draw_character_description()
  339.   end
  340.   #--------------------------------------------------------------------------
  341.   # * Draw Actor Name
  342.   #--------------------------------------------------------------------------
  343.   def draw_actor_name
  344.     text = $game_system.dp3_status_screen_actor_fullname_array[@actor.id - 1]
  345.     h = contents.font.size = 30
  346.     if text
  347.       w = (text.length * contents.font.size)
  348.       x = ((self.width * 0.5) - ((text.length * 12) * 0.5))
  349.       self.change_color(self.name_font_colour)
  350.       self.draw_text(x, @y, w, h, text)
  351.     end
  352.    
  353.     @y = contents.font.size
  354.     contents.font.size = Font.default_size
  355.   end
  356.   #--------------------------------------------------------------------------
  357.   # * Draw Actor Face
  358.   #--------------------------------------------------------------------------
  359.   def draw_actor_face()
  360.     @y += @h
  361.     super(@actor, @x, @y)
  362.   end
  363.   #--------------------------------------------------------------------------
  364.   # * Draw Actor Class
  365.   #--------------------------------------------------------------------------
  366.   def draw_actor_class
  367.     @x = 100
  368.     text =  "Class:     "
  369.     self.change_color(self.class_label_font_colour)
  370.     self.draw_text(@x, @y, @w, @h, text)
  371.    
  372.     @x += text.length * 9
  373.     text = @actor.class.name
  374.     self.change_color(self.class_font_colour)
  375.     self.draw_text(@x, @y, @w, @h, text)
  376.   end
  377.   #--------------------------------------------------------------------------
  378.   # * Draw Actor Nickname
  379.   #--------------------------------------------------------------------------
  380.   def draw_actor_nickname()
  381.     @x = 100; @y += @h
  382.     text = "Nickname:  "
  383.     self.change_color(self.nickname_label_font_colour)
  384.     self.draw_text(@x, @y, @w, @h, text)
  385.  
  386.     @x += text.length * 9
  387.     text = @actor.nickname
  388.     self.change_color(self.nickname_font_colour)
  389.     self.draw_text(@x, @y, @w, @h, text)
  390.   end
  391.   #--------------------------------------------------------------------------
  392.   # * Draw Actor Level
  393.   #--------------------------------------------------------------------------
  394.   def draw_actor_level()
  395.     @x = 100; @y += @h
  396.     text = "Level:     "
  397.     self.change_color(self.level_label_font_colour)
  398.     self.draw_text(@x, @y, @w, @h, text)
  399.    
  400.     @x += text.length * 9
  401.     text = @actor.level.to_s
  402.     self.change_color(self.level_font_colour)
  403.     self.draw_text(@x, @y, @w, @h, text)
  404.   end
  405.   #--------------------------------------------------------------------------
  406.   # * Draw Actor Icons
  407.   #--------------------------------------------------------------------------
  408.   def draw_actor_icons
  409.     @x = 100; @y += @h
  410.     text = "Status:    "
  411.     self.change_color(self.status_label_font_colour)
  412.     self.draw_text(@x, @y, @w, @h, text)
  413.    
  414.     @x += text.length * 9
  415.     super( @actor, @x, @y )
  416.   end
  417.   #--------------------------------------------------------------------------
  418.   # * Draw HP
  419.   #--------------------------------------------------------------------------
  420.   def draw_actor_hp()
  421.     @x = 0; @y = 150; width = 180
  422.     draw_gauge(@x, @y, width, @actor.hp_rate, self.hp_gauge_colour2, self.hp_gauge_colour)
  423.     change_color(system_color)
  424.     draw_text(@x, @y, 30, line_height, Vocab::hp_a)
  425.     draw_current_and_max_values(@x, @y, 96, @actor.hp, @actor.mhp, hp_color(@actor), normal_color)
  426.   end
  427.   #--------------------------------------------------------------------------
  428.   # * Draw MP
  429.   #--------------------------------------------------------------------------
  430.   def draw_actor_mp()
  431.     @y += @h; width = 180
  432.     draw_gauge(@x, @y, width, @actor.mp_rate, self.mp_gauge_colour2, self.mp_gauge_colour)
  433.     change_color(system_color)
  434.     draw_text(@x, @y, 30, line_height, Vocab::mp_a)
  435.     draw_current_and_max_values(@x, @y, 96, @actor.mp, @actor.mmp, mp_color(@actor), normal_color)
  436.   end
  437.   #--------------------------------------------------------------------------
  438.   # * Draw Experience Information
  439.   #--------------------------------------------------------------------------
  440.   def draw_exp_info()
  441.     @y += @h; width = 180
  442.     exp_rate = @actor.exp.to_f / @actor.next_level_exp
  443.     draw_gauge(@x, @y, width, exp_rate, self.exp_gauge_colour2, self.exp_gauge_colour)
  444.     change_color(system_color)
  445.     draw_text(@x, @y, 30, line_height, "Exp")
  446.     draw_current_and_max_values(@x, @y, 96, @actor.exp, @actor.next_level_exp, normal_color, normal_color)
  447.   end
  448.   #--------------------------------------------------------------------------
  449.   # * Draw Equipment
  450.   #--------------------------------------------------------------------------
  451.   def draw_equipments()
  452.     @x = 200; @y = 155 + @h
  453.     self.change_color(self.equipment_label_font_colour)
  454.     draw_text(@x, @y, 200, line_height, "Equipment")
  455.     self.change_color(self.equipment_font_colour)
  456.     @y += @h
  457.     @actor.equips.each_with_index do |item, i|
  458.       draw_item_name(item, @x, (@y + (@h * i)), true, ((self.width - @x) - 48))
  459.     end
  460.   end
  461.   #--------------------------------------------------------------------------
  462.   # * Draw Parameters
  463.   #--------------------------------------------------------------------------
  464.   def draw_parameters()
  465.     @x = 0; @y = 150 + (@h * 4); rowdown = false
  466.     6.times{ |i|  
  467.       self.change_color(parameter_label_font_colour)
  468.       text = Vocab::param(i + 2) + ": "
  469.       draw_text(@x, @y, 60, @h, text)
  470.       change_color(self.parameter_font_colour)
  471.       draw_text(@x + (text.length * 12), @y, 36, @h, @actor.param(i + 2), 0)
  472.      
  473.       if rowdown
  474.         @x = 0; @y += @h
  475.         rowdown = false
  476.       else
  477.         @x = 90
  478.         rowdown = true
  479.       end
  480.     }
  481.   end
  482.   #--------------------------------------------------------------------------
  483.   # * Draw Character Description
  484.   #--------------------------------------------------------------------------
  485.   def draw_character_description()
  486.     @description_helpwindow.change_color(self.description_font_colour)
  487.     if $game_system.dp3_status_screen_actor_description_array[@actor.id - 1]
  488.       @description_helpwindow.set_text($game_system.dp3_status_screen_actor_description_array[@actor.id - 1])
  489.     else
  490.       @description_helpwindow.set_text(@actor.description)
  491.     end
  492.   end
  493.   #--------------------------------------------------------------------------
  494.   # * Get Custom Font/Gauge Colours
  495.   #--------------------------------------------------------------------------
  496.   def name_font_colour;             colour = get_colour( 0 );  colour = Color.new( *NameFontColour )            if !colour; return colour; end
  497.   def class_label_font_colour;      colour = get_colour( 3 );  colour = Color.new( *ClassLabelFontColour )      if !colour; return colour; end
  498.   def class_font_colour;            colour = get_colour( 6 );  colour = Color.new( *ClassFontColour )           if !colour; return colour; end
  499.   def nickname_label_font_colour;   colour = get_colour( 9 );  colour = Color.new( *NicknameLabelFontColour )   if !colour; return colour; end
  500.   def nickname_font_colour;         colour = get_colour( 12 ); colour = Color.new( *NicknameFontColour )        if !colour; return colour; end
  501.   def level_label_font_colour;      colour = get_colour( 15 ); colour = Color.new( *LevelLabelFontColour )      if !colour; return colour; end
  502.   def level_font_colour;            colour = get_colour( 18 ); colour = Color.new( *LevelFontColour )           if !colour; return colour; end
  503.   def status_label_font_colour;     colour = get_colour( 21 ); colour = Color.new( *StatusLabelFontColour )     if !colour; return colour; end
  504.   def equipment_label_font_colour;  colour = get_colour( 24 ); colour = Color.new( *EquipmentLabelFontColour )  if !colour; return colour; end
  505.   def equipment_font_colour;        colour = get_colour( 27 ); colour = Color.new( *EquipmentFontColour )       if !colour; return colour; end
  506.   def parameter_label_font_colour;  colour = get_colour( 30 ); colour = Color.new( *ParameterLabelFontColour )  if !colour; return colour; end
  507.   def parameter_font_colour;        colour = get_colour( 33 ); colour = Color.new( *ParameterFontColour )       if !colour; return colour; end
  508.   def description_font_colour;      colour = get_colour( 36 ); colour = Color.new( *DescriptionFontColour )     if !colour; return colour; end
  509.   def hp_gauge_colour;              colour = get_colour( 39 ); colour = Color.new( *HP_GaugeColour )            if !colour; return colour; end
  510.   def mp_gauge_colour;              colour = get_colour( 42 ); colour = Color.new( *MP_GaugeColour )            if !colour; return colour; end
  511.   def exp_gauge_colour;             colour = get_colour( 45 ); colour = Color.new( *EXP_GaugeColour )           if !colour; return colour; end
  512.  
  513.   def hp_gauge_colour2
  514.     colour = hp_gauge_colour
  515.     Color.new( colour.red * 0.5, colour.green * 0.5, colour.blue * 0.5 )
  516.   end
  517.   def mp_gauge_colour2
  518.     colour = mp_gauge_colour
  519.     Color.new( colour.red * 0.5, colour.green * 0.5, colour.blue * 0.5 )
  520.   end
  521.  
  522.   def exp_gauge_colour2
  523.     colour = exp_gauge_colour
  524.     Color.new( colour.red * 0.5, colour.green * 0.5, colour.blue * 0.5 )
  525.   end
  526.  
  527.   def get_colour( index )
  528.     index = index + ((@actor.id - 1) * 48)
  529.     colour_array = $game_system.dp3_status_screen_actor_font_gauge_colour_array
  530.     if colour_array[index] && colour_array[index + 1] && colour_array[index + 2]
  531.       return Color.new( colour_array[index], colour_array[index + 1], colour_array[index + 2] )
  532.     else
  533.       return false
  534.     end
  535.   end
  536.   #--------------------------------------------------------------------------
  537.   # * Redefined Method: Draw Current and Max Values
  538.   #--------------------------------------------------------------------------
  539.   def draw_current_and_max_values(x, y, width, current, max, color1, color2)
  540.     change_color(color1)
  541.     xr = x + width
  542.     if width < 96
  543.       draw_text(xr - 40, y, 42, line_height, current, 2)
  544.     else
  545.       text = current.to_s + " / " + max.to_s
  546.       xpos = xr - ((text.length * 12) * 0.5)
  547.       draw_text(xpos, y, 200, line_height, text, 1)
  548.     end
  549.   end
  550. end
  551.  
  552.  
  553.  
  554.  
  555.  
  556.  
  557.  
  558.  
  559.  
  560.  
  561.  
  562.  
  563.  
  564.  
  565.  
  566. #==============================================================================
  567. # ** Window_Base
  568. #------------------------------------------------------------------------------
  569. #  This is a super class of all windows within the game.
  570. #==============================================================================
  571.  
  572. class Window_Base < Window
  573.   #--------------------------------------------------------------------------
  574.   # * Draw Text with Control Characters
  575.   #--------------------------------------------------------------------------
  576.   alias dp3_windowbase_drawtextex_2038ufs   draw_text_ex
  577.   #--------------------------------------------------------------------------
  578.   def draw_text_ex(x, y, text)
  579.     if SceneManager.scene_is?(Scene_Status)
  580.       text = convert_escape_characters(text)
  581.       pos = {:x => x, :y => y, :new_x => x, :height => calc_line_height(text)}
  582.       process_character(text.slice!(0, 1), text, pos) until text.empty?
  583.     else
  584.       dp3_windowbase_drawtextex_2038ufs(x, y, text)
  585.     end
  586.   end
  587.   #--------------------------------------------------------------------------
  588.   # * Draw Item Name
  589.   #     enabled : Enabled flag. When false, draw semi-transparently.
  590.   #--------------------------------------------------------------------------
  591.   alias dp3_windowbase_drawitemname_2038ufs     draw_item_name
  592.   #--------------------------------------------------------------------------
  593.   def draw_item_name(item, x, y, enabled = true, width = 172)
  594.     if SceneManager.scene_is?(Scene_Status)
  595.       return unless item
  596.       draw_icon(item.icon_index, x, y, enabled)
  597.       draw_text(x + 24, y, width, line_height, item.name)
  598.     else
  599.       dp3_windowbase_drawitemname_2038ufs( item, x, y, enabled, width)
  600.     end
  601.   end
  602. end
  603.  
  604.  
  605.  
  606.  
  607.  
  608.  
  609.  
  610.  
  611.  
  612.  
  613.  
  614.  
  615.  
  616.  
  617.  
  618. #==============================================================================
  619. # ** Game_System
  620. #------------------------------------------------------------------------------
  621. #  This class handles system data. It saves the disable state of saving and
  622. # menus. Instances of this class are referenced by $game_system.
  623. #==============================================================================
  624.  
  625. class Game_System
  626.   #--------------------------------------------------------------------------
  627.   # * New Public Instance Variables
  628.   #--------------------------------------------------------------------------
  629.   attr_accessor :dp3_status_screen_actor_fullname_array
  630.   attr_accessor :dp3_status_screen_actor_font_gauge_colour_array  
  631.   attr_accessor :dp3_status_screen_actor_backgroundimages_array
  632.   attr_accessor :dp3_status_screen_actor_characterimage_array
  633.   attr_accessor :dp3_status_screen_actor_description_array
  634.   #--------------------------------------------------------------------------
  635.   # * Aliased Method: Object Initialization
  636.   #--------------------------------------------------------------------------
  637.   alias dp3_gamesystem_initialize_283yfj2     initialize
  638.   #--------------------------------------------------------------------------
  639.   def initialize( *args )
  640.     @dp3_status_screen_actor_fullname_array = DiamondandPlatinum3::StatusScreenOptions::CharacterDisplayName
  641.     @dp3_status_screen_actor_font_gauge_colour_array =
  642.     [
  643.       *DiamondandPlatinum3::StatusScreenOptions::NameFontColour,  
  644.       *DiamondandPlatinum3::StatusScreenOptions::ClassLabelFontColour,
  645.       *DiamondandPlatinum3::StatusScreenOptions::ClassFontColour,
  646.       *DiamondandPlatinum3::StatusScreenOptions::NicknameLabelFontColour,
  647.       *DiamondandPlatinum3::StatusScreenOptions::NicknameFontColour,        
  648.       *DiamondandPlatinum3::StatusScreenOptions::LevelLabelFontColour,  
  649.       *DiamondandPlatinum3::StatusScreenOptions::LevelFontColour,    
  650.       *DiamondandPlatinum3::StatusScreenOptions::StatusLabelFontColour,
  651.       *DiamondandPlatinum3::StatusScreenOptions::EquipmentLabelFontColour,  
  652.       *DiamondandPlatinum3::StatusScreenOptions::EquipmentFontColour,  
  653.       *DiamondandPlatinum3::StatusScreenOptions::ParameterLabelFontColour,
  654.       *DiamondandPlatinum3::StatusScreenOptions::ParameterFontColour,
  655.       *DiamondandPlatinum3::StatusScreenOptions::DescriptionFontColour,
  656.       *DiamondandPlatinum3::StatusScreenOptions::HP_GaugeColour,    
  657.       *DiamondandPlatinum3::StatusScreenOptions::MP_GaugeColour,            
  658.       *DiamondandPlatinum3::StatusScreenOptions::EXP_GaugeColour,
  659.     ]
  660.     @dp3_status_screen_actor_backgroundimages_array = DiamondandPlatinum3::StatusScreenOptions::BackgroundPictures
  661.     @dp3_status_screen_actor_characterimage_array = DiamondandPlatinum3::StatusScreenOptions::CharacterImage
  662.     @dp3_status_screen_actor_description_array = []
  663.     # Call Original Method
  664.     dp3_gamesystem_initialize_283yfj2( *args )
  665.   end
  666.   #--------------------------------------------------------------------------
  667.   # * New Method: Get Actor ID
  668.   #--------------------------------------------------------------------------
  669.   def dp3_status_screen_get_actor_id( actor )
  670.     actor_id = actor.is_a?(Integer) ? actor : nil
  671.     if actor.is_a?(String)
  672.       for i in 1..($data_actors.size - 1)
  673.         if $game_actors[i].name.upcase == actor.upcase
  674.           actor_id = $game_actors[i].id
  675.           break
  676.         end
  677.       end
  678.     end
  679.     return actor_id
  680.   end
  681.   #--------------------------------------------------------------------------
  682.   # * New Method: Modify Status Screen Actor Full Name
  683.   #--------------------------------------------------------------------------
  684.   def dp3_modify_status_screen_actor_full_name( actor, sName )
  685.     actor_id = dp3_status_screen_get_actor_id( actor )
  686.     return if !actor_id || !sName.is_a?(String)
  687.     @dp3_status_screen_actor_fullname_array[actor_id - 1] = sName
  688.   end
  689.   #--------------------------------------------------------------------------
  690.   # * New Method: Modify Status Screen Font Options
  691.   #--------------------------------------------------------------------------
  692.   def dp3_modify_status_screen_font_gauge_options( actor, sOption, iRed, iGreen, iBlue )
  693.     # Get Actor ID
  694.     actor_id = dp3_status_screen_get_actor_id( actor )
  695.     return if !actor_id || !sOption.is_a?(String)
  696.     #~~~~~~~~~~~~~~~~~~~~~~~~
  697.     # While we don't have specified font colours for an actor, make it the default colours
  698.     while @dp3_status_screen_actor_font_gauge_colour_array.size < actor_id * 48
  699.       array =
  700.       [
  701.         *DiamondandPlatinum3::StatusScreenOptions::NameFontColour,  
  702.         *DiamondandPlatinum3::StatusScreenOptions::ClassLabelFontColour,
  703.         *DiamondandPlatinum3::StatusScreenOptions::ClassFontColour,
  704.         *DiamondandPlatinum3::StatusScreenOptions::NicknameLabelFontColour,
  705.         *DiamondandPlatinum3::StatusScreenOptions::NicknameFontColour,        
  706.         *DiamondandPlatinum3::StatusScreenOptions::LevelLabelFontColour,  
  707.         *DiamondandPlatinum3::StatusScreenOptions::LevelFontColour,    
  708.         *DiamondandPlatinum3::StatusScreenOptions::StatusLabelFontColour,
  709.         *DiamondandPlatinum3::StatusScreenOptions::EquipmentLabelFontColour,  
  710.         *DiamondandPlatinum3::StatusScreenOptions::EquipmentFontColour,  
  711.         *DiamondandPlatinum3::StatusScreenOptions::ParameterLabelFontColour,
  712.         *DiamondandPlatinum3::StatusScreenOptions::ParameterFontColour,
  713.         *DiamondandPlatinum3::StatusScreenOptions::DescriptionFontColour,
  714.         *DiamondandPlatinum3::StatusScreenOptions::HP_GaugeColour,    
  715.         *DiamondandPlatinum3::StatusScreenOptions::MP_GaugeColour,            
  716.         *DiamondandPlatinum3::StatusScreenOptions::EXP_GaugeColour,
  717.       ]
  718.       # Now put them into our instance array
  719.       array.each do |element|
  720.         index = @dp3_status_screen_actor_font_gauge_colour_array.size
  721.         @dp3_status_screen_actor_font_gauge_colour_array[index] = element
  722.       end
  723.     end
  724.     #~~~~~~~~~~~~~~~~~~~~~~~~
  725.     index = nil
  726.     case sOption.upcase
  727.     when "NAMEFONTCOLOUR"
  728.       index = [ 0, 1, 2 ]
  729.     when "CLASSLABELFONTCOLOUR"
  730.       index = [ 3, 4, 5 ]
  731.     when "CLASSFONTCOLOUR"
  732.       index = [ 6, 7, 8 ]
  733.     when "NICKNAMELABELFONTCOLOUR"
  734.       index = [ 9, 10, 11 ]
  735.     when "NICKNAMEFONTCOLOUR"
  736.       index = [ 12, 13, 14 ]
  737.     when "LEVELLABELFONTCOLOUR"
  738.       index = [ 15, 16, 17 ]
  739.     when "LEVELFONTCOLOUR"
  740.       index = [ 18, 19, 20 ]
  741.     when "STATUSLABELFONTCOLOUR"
  742.       index = [ 21, 22, 23 ]
  743.     when "EQUIPMENTLABELFONTCOLOUR"
  744.       index = [ 24, 25, 26 ]
  745.     when "EQUIPMENTFONTCOLOUR"
  746.       index = [ 27, 28, 29 ]
  747.     when "PARAMETERLABELFONTCOLOUR"
  748.       index = [ 30, 31, 32 ]
  749.     when "PARAMETERFONTCOLOUR"
  750.       index = [ 33, 34, 35 ]
  751.     when "DESCRIPTIONFONTCOLOUR"
  752.       index = [ 36, 37, 38 ]
  753.     when "HP_GAUGECOLOUR"
  754.       index = [ 39, 40, 41 ]
  755.     when "MP_GAUGECOLOUR"
  756.       index = [ 42, 43, 44 ]
  757.     when "EXP_GAUGECOLOUR"
  758.       index = [ 45, 46, 47 ]
  759.     end
  760.     return if !index || index.size < 3
  761.     #~~~~~~~~~~~~~~~~~~~~~~~~
  762.     # Use the actor id multiplied by the size of specific actor space of the array to get the actual index position
  763.     index[0] += ((actor_id - 1) * 48); index[1] += ((actor_id - 1) * 48); index[1] += ((actor_id - 1) * 48)
  764.     @dp3_status_screen_actor_font_gauge_colour_array[index[0]] = iRed
  765.     @dp3_status_screen_actor_font_gauge_colour_array[index[1]] = iGreen
  766.     @dp3_status_screen_actor_font_gauge_colour_array[index[2]] = iBlue
  767.   end
  768.   #--------------------------------------------------------------------------
  769.   # * New Method: Add A Background Image to Status Screen
  770.   #--------------------------------------------------------------------------
  771.   def dp3_status_screen_add_background_image( actor, sImageName, width, height )
  772.     actor_id = dp3_status_screen_get_actor_id( actor )
  773.     return if !actor_id || !sImageName.is_a?(String) || !width.is_a?(Integer) || !height.is_a?(Integer)
  774.    
  775.     # If an actor if out of range, keep making arrays until the size is up to scratch
  776.     while( @dp3_status_screen_actor_backgroundimages_array.size < actor_id )
  777.       index = @dp3_status_screen_actor_backgroundimages_array.size
  778.       @dp3_status_screen_actor_backgroundimages_array[index] = Array.new()
  779.     end
  780.    
  781.     inner_index = @dp3_status_screen_actor_backgroundimages_array[actor_id - 1].size
  782.     @dp3_status_screen_actor_backgroundimages_array[actor_id - 1][inner_index] = sImageName
  783.     @dp3_status_screen_actor_backgroundimages_array[actor_id - 1][inner_index + 1] = width
  784.     @dp3_status_screen_actor_backgroundimages_array[actor_id - 1][inner_index + 2] = height
  785.   end
  786.   #--------------------------------------------------------------------------
  787.   # * New Method: Remove A Background Image from Status Screen
  788.   #--------------------------------------------------------------------------
  789.   def dp3_status_screen_remove_background_image( actor, sImageName )
  790.     actor_id = dp3_status_screen_get_actor_id( actor )
  791.     return if !actor_id || !sImageName.is_a?(String)
  792.    
  793.     if @dp3_status_screen_actor_backgroundimages_array[actor_id - 1]
  794.       index = 0; foundimage = false
  795.       for imagename in @dp3_status_screen_actor_backgroundimages_array[actor_id - 1]
  796.         if imagename.is_a?(String) && imagename == sImageName
  797.           foundimage = true; break;
  798.         else
  799.           index += 1
  800.         end
  801.       end
  802.       if foundimage
  803.         @dp3_status_screen_actor_backgroundimages_array[actor_id - 1].delete_at( index + 2 )
  804.         @dp3_status_screen_actor_backgroundimages_array[actor_id - 1].delete_at( index + 1 )
  805.         @dp3_status_screen_actor_backgroundimages_array[actor_id - 1].delete_at( index )
  806.       end
  807.     end
  808.   end
  809.   #--------------------------------------------------------------------------
  810.   # * New Method: Change a Character Image for Status Screen
  811.   #--------------------------------------------------------------------------
  812.   def dp3_status_screen_change_character_image( actor, sImageName, width, height )
  813.     actor_id = dp3_status_screen_get_actor_id( actor )
  814.     return if !actor_id || !sImageName.is_a?(String) || !width.is_a?(Integer) || !height.is_a?(Integer)
  815.  
  816.     # If an actor if out of range, keep making arrays until the size is up to scratch
  817.     while( @dp3_status_screen_actor_characterimage_array < actor_id )
  818.       index = @dp3_status_screen_actor_characterimage_array.size
  819.       @dp3_status_screen_actor_characterimage_array[index] = Array.new()
  820.     end
  821.    
  822.     @dp3_status_screen_actor_characterimage_array[actor_id - 1][0] = sImageName
  823.     @dp3_status_screen_actor_characterimage_array[actor_id - 1][1] = width
  824.     @dp3_status_screen_actor_characterimage_array[actor_id - 1][2] = height
  825.   end
  826.   #--------------------------------------------------------------------------
  827.   # * New Method: Change a Character's Description for Status Screen
  828.   #--------------------------------------------------------------------------
  829.   def dp3_status_screen_modify_character_description( actor, description )
  830.     actor_id = dp3_status_screen_get_actor_id( actor )
  831.     return if !actor_id || !description.is_a?(String)
  832.     while @dp3_status_screen_actor_description_array.size < actor_id
  833.       @dp3_status_screen_actor_description_array[@dp3_status_screen_actor_description_array.size] = ""
  834.     end
  835.     @dp3_status_screen_actor_description_array[actor_id - 1] = description
  836.   end
  837. end
  838.  
  839.  
  840.  
  841.  
  842.  
  843.  
  844.  
  845.  
  846.  
  847.  
  848.  
  849.  
  850.  
  851.  
  852. #==============================================================================
  853. # ** Game_Interpreter
  854. #------------------------------------------------------------------------------
  855. #  An interpreter for executing event commands. This class is used within the
  856. # Game_Map, Game_Troop, and Game_Event classes.
  857. #==============================================================================
  858.  
  859. class Game_Interpreter
  860.   #--------------------------------------------------------------------------
  861.   # * New Method: Modify Status Screen Actor Full Name
  862.   #--------------------------------------------------------------------------
  863.   def status_screen_modify_actor_full_name( actor, sName )
  864.     $game_system.dp3_modify_status_screen_actor_full_name( actor, sName )
  865.   end
  866.   #--------------------------------------------------------------------------
  867.   # * New Method: Modify Status Screen Font Options
  868.   #--------------------------------------------------------------------------
  869.   def status_screen_modify_font_gauge_options( actor, sOption, iRed, iGreen, iBlue )
  870.     $game_system.dp3_modify_status_screen_font_gauge_options( actor, sOption, iRed, iGreen, iBlue )
  871.   end
  872.   #--------------------------------------------------------------------------
  873.   # * New Method: Add A Background Image to Status Screen
  874.   #--------------------------------------------------------------------------
  875.   def status_screen_add_background_image( actor, sImageName, width, height )
  876.     $game_system.dp3_status_screen_add_background_image( actor, sImageName, width, height )
  877.   end
  878.   #--------------------------------------------------------------------------
  879.   # * New Method: Remove A Background Image from Status Screen
  880.   #--------------------------------------------------------------------------
  881.   def status_screen_remove_background_image( actor, sImageName )
  882.     $game_system.dp3_status_screen_remove_background_image( actor, sImageName )
  883.   end
  884.   #--------------------------------------------------------------------------
  885.   # * New Method: Change a Character Image for Status Screen
  886.   #--------------------------------------------------------------------------
  887.   def status_screen_change_character_image( actor, sImageName, width, height )
  888.     $game_system.dp3_status_screen_change_character_image( actor, sImageName, width, height )
  889.   end
  890.   #--------------------------------------------------------------------------
  891.   # * New Method: Change a Character's Description for Status Screen
  892.   #--------------------------------------------------------------------------
  893.   def status_screen_change_character_description( actor, description )
  894.     $game_system.dp3_status_screen_modify_character_description( actor, description )
  895.   end
  896. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement