chaucer91

RMX-OS Party hud

Oct 1st, 2014
447
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. =begin
  2.  
  3. Script: RMX-OS Party HUD Version 0.83
  4.  
  5. Author: Chaucer
  6.  
  7. thanks to Blizzard for helping get player stats.
  8. free to use in commercial & non-commercial games just give credits.
  9.  
  10. Instructions:
  11. Place Below RMX-OS, Blizz ABS,  
  12. HUD_X & Y self explanitory
  13. HP_X & Y  As above
  14. SP_X & Y As above
  15. HP_OX & OY used to center Health bar inside of the health background
  16. (if background is larger than the hp bar)
  17. SP_OX & OY As above
  18. Name_x & y name & level x & y values
  19.  
  20. Background:
  21.   nil = black border(used to match blizz abs hud border)
  22.   0 = no border
  23.   'Image_name' = use an image background instead.
  24.  
  25.   HP_Full:
  26.   Health bar image
  27.  
  28.   HP_Empty:
  29.   Background for health
  30.  
  31.   SP_Full:
  32.   same as HP_Full(Except for SP)
  33.  
  34.   SP_Empty:
  35.   same as HP_Empty(Except for SP)
  36.  
  37.   Percent_HP:
  38.   true will show HP in % value I.E. full HP = 100%
  39.   false will show HP in Current_HP / Max HP
  40.  
  41.   Percent SP:
  42.   same as above except for SP
  43.  
  44. =end
  45. module NewHUD
  46.   #============================================================================
  47.   #Configuration
  48.   #============================================================================
  49.   #The X & Y of the new Hud
  50.   HUD_X = 44
  51.   HUD_Y = 86
  52.   #X & Y of HP Bars
  53.   HP_X = 10
  54.   HP_Y = 11
  55.   #X & Y of SP Bars
  56.   SP_X = 10
  57.   SP_Y = 21
  58.   #Offset X & Offset Y of HP Bars
  59.   HP_OX = 1
  60.   HP_OY = 1
  61.   #Offset X & Offset Y of HP Bars
  62.   SP_OX = 1
  63.   SP_OY = 1
  64.   #use icons to define party member's class
  65.   ICONS = false
  66.   #use colors to define party member's place in party
  67.   ICON_COLOR = false
  68.   #Class Icons x & y if ICONS = TRUE
  69.   ICON_X = 1
  70.   ICON_Y = 1
  71.   #draws name & level X & Y positions
  72.   NAME_X = 0
  73.   NAME_Y = -1
  74.   #Background Image of HUD
  75.   BACKGROUND = nil
  76.  
  77.   #Hud HP Full
  78.   HP_FULL = "Health_bar"
  79.  
  80.   #Hud HP Empty
  81.   HP_EMPTY = "Health_bar_Empty"
  82.  
  83.   #Hud HP Full
  84.   SP_FULL = "Mana_bar"
  85.  
  86.   #Hud HP Empty
  87.   SP_EMPTY = "Mana_bar_Empty"
  88.  
  89.   #Party Leader Name Color
  90.   #please use one of the following anything else will result in 1
  91.   #1 = Red
  92.   #2 = Blue
  93.   #3 = Green
  94.   #4 = Yellow
  95.   #5 = Orange
  96.   #6 = Purple
  97.   COLOR = 4
  98.   #Health Number in % or [hp/maxhp]
  99.   PERCENT_HP = false #true = hp in % false = hp / maxhp
  100.  
  101.   #Health Number in % or [hp/maxhp]
  102.   PERCENT_SP = false #same as above
  103.  
  104.   end
  105. #=============================================================================
  106. #Hud Draw
  107. #=============================================================================
  108.  
  109. class New_Hud
  110.  
  111.   def initialize
  112.  
  113.       @old_leader = []
  114.       @old_leader.push($network.partyleader)
  115.       @old_party = []
  116.       @old_class = []
  117.       @old_party.push($network.party)
  118.       @old_combine = @old_leader + @old_party.flatten
  119.       @old_combine - [$network.username]
  120.       @old_combine.uniq
  121.       @party_each = $network.party.size
  122.       @background_image = []
  123.       @old_level = []
  124.       @name_level = []
  125.       @class_icon = []
  126.       @health_0_image = []
  127.       @health_1_image = []
  128.       @old_maxhp = []
  129.       @old_hp = []
  130.       @health_2_image = []
  131.       @hnumber = []
  132.      
  133.       @mana_0_image = []
  134.       @mana_1_image = []
  135.       @old_maxsp = []
  136.       @old_sp = []
  137.       @mana_2_image = []
  138.       @mnumber = []
  139.  
  140. #=============================================================================
  141. #Hud Update
  142. #=============================================================================
  143.   def update
  144.     @new_leader = []
  145.     @new_leader.push($network.partyleader)
  146.     @new_party = []
  147.     @new_party.push($network.party)
  148.     @new_combine = @new_leader + @new_party.flatten
  149.     @new_combine = @new_combine - [$network.username]
  150.     @new_combine = @new_combine - [""]
  151.     @new_combine = @new_combine.uniq
  152.     @party_each = @new_combine.size - 1
  153.    
  154.     @new_level = []
  155.        @new_combine.each do |username|
  156.           $network.players.each do |id, player|
  157.                if username == player.username
  158.                    @new_level.push(player.battler.level)
  159.                end
  160.           end
  161.         end
  162.  
  163.     @new_class = []
  164.        @new_combine.each do |username|
  165.           $network.players.each do |id, player|
  166.                if username == player.username
  167.                    @new_class.push(player.battler.class_name)
  168.                end
  169.           end
  170.         end
  171.        
  172.     @new_maxhp = []
  173.        @new_combine.each do |username|
  174.           $network.players.each do |id, player|
  175.                if username == player.username
  176.                    @new_maxhp.push(player.battler.maxhp)
  177.                end
  178.           end
  179.         end
  180.        
  181.     @new_hp = []
  182.        @new_combine.each do |username|
  183.           $network.players.each do |id, player|
  184.                if username == player.username
  185.                    @new_hp.push(player.battler.hp)
  186.                end
  187.           end
  188.         end
  189.  
  190.     @new_maxsp = []
  191.        @new_combine.each do |username|
  192.           $network.players.each do |id, player|
  193.                if username == player.username
  194.                    @new_maxsp.push(player.battler.maxsp)
  195.                end
  196.           end
  197.         end
  198.     @new_sp = []
  199.        @new_combine.each do |username|
  200.           $network.players.each do |id, player|
  201.                if username == player.username
  202.                    @new_sp.push(player.battler.sp)
  203.                end
  204.           end
  205.         end
  206.  
  207.         dispose if @new_party != @old_party
  208.     update_background if  @new_combine != @old_combine
  209.     update_name if @new_party != @old_party || @new_level != @old_level
  210.     update_icon if @new_party != @old_party || @new_class != @old_class
  211.     update_hp if @new_hp != @old_hp || @new_maxhp != @old_maxhp
  212.     update_sp if @new_sp != @old_sp || @new_maxsp != @old_maxsp
  213.   end
  214.  
  215.  
  216.   def update_background
  217.   #draws background
  218.     @old_combine = @new_combine
  219.     @background_image.each {|sprite| sprite.dispose } if @background_image !=  nil
  220.     if NewHUD::BACKGROUND == nil
  221.       #draws background
  222.       @background_image = []
  223.       for i in (0..@party_each)
  224.       @background_image[i] = Sprite.new  
  225.       @background_image[i].bitmap = Bitmap.new(78,30)
  226.       @background_image[i].bitmap.fill_rect(0, 0, 78, 30, Color.new(0, 0, 0,128))
  227.       @background_image[i].x = NewHUD::HUD_X
  228.       @background_image[i].y = NewHUD::HUD_Y + (30 + 1) * i
  229.       @background_image[i].z = 1000
  230.       end
  231.     elsif NewHUD::BACKGROUND == 0
  232.       @background_image = []
  233.       for i in (0..@party_each)
  234.       @background_image[i] = Sprite.new  
  235.       @background_image[i].bitmap = Bitmap.new(78,30)
  236.       @background_image[i].bitmap.fill_rect(0, 0, 78, 30, Color.new(0, 0, 0,0))
  237.       @background_image[i].x = NewHUD::HUD_X
  238.       @background_image[i].y = NewHUD::HUD_Y + (30 + 1) * i
  239.       @background_image[i].z = 1000
  240.       end
  241.     else
  242.         @background_image = []
  243.         for i in (0..@party_each)
  244.         @background_image[i] = Sprite.new
  245.         @background_image[i].bitmap = RPG::Cache.picture(NewHUD::BACKGROUND)
  246.         @background_image[i].x = NewHUD::HUD_X
  247.         @background_image[i].y = NewHUD::HUD_Y + (@background_image[i].bitmap.height + 1) * i
  248.         @background_image[i].z = 1000
  249.       end
  250.     end
  251.   end
  252.  
  253.   def update_name
  254.       @old_party = @new_party
  255.       @old_level = @new_level
  256.       @name_level.each {|sprite| sprite.dispose } if @name_level != []
  257.     #draws name & level
  258.     if NewHUD::BACKGROUND == nil || NewHUD::BACKGROUND == 0
  259.       nmlvw = 78
  260.       nmlvh = 30
  261.     else
  262.       nmlvw = RPG::Cache.picture(NewHUD::BACKGROUND).width
  263.       nmlvh = RPG::Cache.picture(NewHUD::BACKGROUND).height
  264.      end
  265.       nmlvx = NewHUD::HUD_X + NewHUD::NAME_X
  266.       nmlvy = NewHUD::HUD_Y + NewHUD::NAME_Y
  267.       @name_level = []
  268.       for i in (0..@party_each)
  269.       @nm2 = @new_combine - [$network.username]
  270.       @name = '' if @nm2.at(i) == nil
  271.       @name = @nm2.at(i) + ' Lv:' + @new_level.at(i).to_s
  272.       @name_level[i] = Sprite.new
  273.       @name_level[i].bitmap = Bitmap.new(nmlvw,15)
  274.       @name_level[i].bitmap.font.name = "Arial"
  275.       @name_level[i].bitmap.font.size = 12
  276.       @name_level[i].bitmap.font.bold = false
  277.       @leader_color = Color.new(255,50,50,255) if NewHUD::COLOR == 1 || NewHUD::COLOR > 6 or NewHUD::COLOR < 1
  278.       @leader_color = Color.new(87,87,255,255) if NewHUD::COLOR == 2
  279.       @leader_color = Color.new(87,255,87,255) if NewHUD::COLOR == 1
  280.       @leader_color = Color.new(255,255,87,255) if NewHUD::COLOR == 4
  281.       @leader_color = Color.new(255,187,0,255) if NewHUD::COLOR == 5
  282.       @leader_color = Color.new(255,87,255,255) if NewHUD::COLOR == 6
  283.       @name_level[i].bitmap.font.color = Color.new(255, 255, 255,255) if @nm2.at(i) != $network.partyleader
  284.       @name_level[i].bitmap.font.color = @leader_color if @nm2.at(i) == $network.partyleader
  285.       @name_level[i].bitmap.draw_text_full(0, 0, nmlvw, 14, @name, 1)
  286.       @name_level[i].x = nmlvx
  287.       @name_level[i].y = nmlvy - 1 + (nmlvh + 1) * i  
  288.       @name_level[i].z = 1004
  289.       end
  290.     end
  291.  
  292.     def update_icon
  293.       @class_icon.each {|sprite| sprite.dispose } if @class_icon != [] || @class_icon == nil
  294.       @old_class = @new_class
  295.       if  NewHUD::ICONS == true
  296.           nmlvx = NewHUD::HUD_X + NewHUD::NAME_X
  297.           nmlvy = NewHUD::HUD_Y + NewHUD::NAME_Y
  298.           if NewHUD::BACKGROUND == nil || NewHUD::BACKGROUND == 0
  299.           nmlvh = 30
  300.           else
  301.           nmlvh = RPG::Cache.picture(NewHUD::BACKGROUND).height
  302.           end
  303.           #p @new_class.to_s
  304.         for i in (0..@party_each)
  305.           @nm2 = @new_combine - [$network.username]
  306.           @class_nm = @new_class.at(i)
  307.           # p @class_nm
  308.           @class_icon[i] = Sprite.new
  309.           @class_icon[i].bitmap = RPG::Cache.icon("#{@class_nm}")
  310.           @class_icon[i].x = nmlvx - 24 + NewHUD::ICON_X
  311.           @class_icon[i].y = (nmlvy + 3 - 1 + (nmlvh + 1) * i) + NewHUD::ICON_Y
  312.           @class_icon[i].z = 1004
  313.           if i == 0 && @nm2.at(i) == $network.partyleader && NewHUD::ICON_COLOR == true
  314.             @class_icon[i].tone = Tone.new(255, 0, 0, 255)
  315.             elsif i == 0 && @nm2.at(i) != $network.partyleader && NewHUD::ICON_COLOR == true
  316.             @class_icon[i].tone = Tone.new(0, 0, 255, 255)
  317.             elsif i == 1 && @nm2.at(i) != $network.partyleader && NewHUD::ICON_COLOR == true
  318.             @class_icon[i].tone = Tone.new(0, 255, 0, 255)
  319.             elif i > 1 && @nm2.at(i) != $network.partyleader && NewHUD::ICON_COLOR == true
  320.             @class_icon[i].tone = Tone.new(255, 255, 0, 255)
  321.           end
  322.         end
  323.       end
  324.     end
  325.    
  326.   def update_hp
  327.         @old_hp = @new_hp
  328.         @old_maxhp = @new_maxhp
  329.         if NewHUD::BACKGROUND == nil || NewHUD::BACKGROUND == 0
  330.           nmlvh = 30
  331.         else
  332.           nmlvh = RPG::Cache.picture(NewHUD::BACKGROUND).height
  333.          end
  334.       #draws HP Background
  335.       @health_1_image.each {|sprite| sprite.dispose } if @health_1_image != nil
  336.       hpx = NewHUD::HUD_X + NewHUD::HP_X
  337.       hpy = NewHUD::HUD_Y + NewHUD::HP_Y
  338.      
  339.       if NewHUD::BACKGROUND == nil
  340.         hpx = NewHUD::HUD_X + NewHUD::HP_X
  341.         hpy = NewHUD::HUD_Y + NewHUD::HP_Y
  342.         @health_0_image = []
  343.         for i in (0..@party_each)
  344.         @health_0_image[i] = Sprite.new
  345.         @health_0_image[i].bitmap = Bitmap.new(58, 8)
  346.         @health_0_image[i].bitmap.fill_rect(0, 0, 58, 8, Color.new(255, 255, 255, 192))
  347.         @health_0_image[i].x = hpx + 1
  348.         @health_0_image[i].y = hpy + (nmlvh + 1) * i
  349.         @health_0_image[i].z = 1001
  350.         end
  351.        
  352.         @health_1_image = []
  353.         for i in (0..@party_each)
  354.         @health_1_image[i] = Sprite.new
  355.         @health_1_image[i].bitmap = Bitmap.new(57, 6)
  356.         @health_1_image[i].bitmap.gradient_bar_hud(0, -4, 57, 0, 'hud_green_bar', 0)
  357.         @health_1_image[i].x = hpx + NewHUD::HP_OX
  358.         @health_1_image[i].y = hpy + NewHUD::HP_OY + (nmlvh + 1) * i
  359.         @health_1_image[i].z = 1002
  360.         end
  361.       else
  362.       @health_1_image = []
  363.       for i in (0..@party_each)
  364.       @health_1_image[i] = Sprite.new
  365.       @health_1_image[i].bitmap = RPG::Cache.picture(NewHUD::HP_EMPTY)
  366.       @health_1_image[i].x = hpx
  367.       @health_1_image[i].y = hpy + (nmlvh + 1) * i
  368.       @health_1_image[i].z = 1001
  369.     end
  370.   end
  371.      
  372.     #draws HP bars
  373.         @health_2_image.each {|sprite| sprite.dispose } if @health_2_image != nil
  374.         hpi = RPG::Cache.picture(NewHUD::HP_FULL)
  375.         w = hpi.width
  376.         h = hpi.height
  377.         if NewHUD::BACKGROUND == nil
  378.         @health_2_image = []
  379.         for i in (0..@party_each)
  380.           rate = (@new_maxhp.at(i) > 0 ? @new_hp.at(i).to_f / @new_maxhp.at(i) : 0) if @new_maxhp.at(i) != nil
  381.           rate = 0 if @new_maxhp.at(i) == nil
  382.         w2 = w * @new_hp.at(i) /  @new_maxhp.at(i) if @new_hp.at(i) != nil && @new_maxhp.at(i) != nil
  383.         w2 = 0 if @new_hp.at(i) == nil && @new_maxhp.at(i) == nil
  384.         @health_2_image[i] = Sprite.new
  385.         @health_2_image[i].bitmap = Bitmap.new(57,6)
  386.         @health_2_image[i].bitmap.gradient_bar_hud(0, -4, 57, rate, 'hud_green_bar', 1)
  387.         @health_2_image[i].x = hpx + NewHUD::HP_OX
  388.         @health_2_image[i].y = hpy + NewHUD::HP_OY + (nmlvh + 1) * i
  389.         @health_2_image[i].z = 1003
  390.       end
  391.     else
  392.         @health_2_image = []
  393.         for i in (0..@party_each)
  394.         w2 = w * @new_hp.at(i) /  @new_maxhp.at(i) if @new_hp.at(i) != nil && @new_maxhp.at(i) != nil
  395.         w2 = 0 if @new_hp.at(i) == nil && @new_maxhp.at(i) == nil
  396.         @health_2_image[i] = Sprite.new
  397.         @health_2_image[i].bitmap = Bitmap.new(w,h)
  398.         @health_2_image[i].bitmap.fill_rect(0, 0, w, h, Color.new(250, 0, 0,0))
  399.         @health_2_image[i].x = hpx + NewHUD::HP_OX
  400.         @health_2_image[i].y = hpy + NewHUD::HP_OY + (nmlvh + 1) * i
  401.         @health_2_image[i].z = 1002
  402.         @health_2_image[i].bitmap.blt(0, 0, hpi, Rect.new(0, 0, w2, h))
  403.       end
  404.     end
  405.    
  406.        
  407.       #draw HP number
  408.         @hnumber.each {|sprite| sprite.dispose } if @hnumber != nil
  409.         hpi = RPG::Cache.picture(NewHUD::HP_FULL)
  410.         w = hpi.width
  411.         h = hpi.height
  412.        
  413.         @hnumber = []
  414.         for i in (0..@party_each)
  415.         hp_number = 'Offline' if @new_hp.at(i) == nil && @new_maxhp.at(i) == nil
  416.         hp_number = @new_hp.at(i).to_s + ' / ' + @new_maxhp.at(i).to_s if NewHUD::PERCENT_HP == false
  417.         hp_number = @new_hp.at(i) * 100 / @new_maxhp.at(i) if NewHUD::PERCENT_HP == true
  418.         @hnumber[i] = Sprite.new
  419.         @hnumber[i].bitmap = Bitmap.new(300,15)
  420.         @hnumber[i].bitmap.font.name = "Arial"
  421.         @hnumber[i].bitmap.font.size = 12
  422.         @hnumber[i].bitmap.font.bold = false
  423.         @hnumber[i].bitmap.draw_text_full(0,0,w,h+5,' ' + hp_number,1) if NewHUD::PERCENT_HP == false
  424.         @hnumber[i].bitmap.draw_text_full(0,0,w,h+5,' ' + hp_number.to_s + '%',1) if NewHUD::PERCENT_HP == true
  425.         @hnumber[i].x = hpx
  426.         @hnumber[i].y = hpy - 2 + (nmlvh + 1) * i
  427.         @hnumber[i].z = 1004
  428.       end
  429.     end
  430.  
  431.   def update_sp
  432.       @old_sp = @new_sp
  433.       @old_maxsp = @new_maxsp
  434.       if NewHUD::BACKGROUND == nil || NewHUD::BACKGROUND == 0
  435.           nmlvh = 30
  436.         else
  437.           nmlvh = RPG::Cache.picture(NewHUD::BACKGROUND).height
  438.          end
  439.       @mana_1_image.each {|sprite| sprite.dispose } if @mana_1_image != nil
  440.       spx = NewHUD::HUD_X + NewHUD::SP_X
  441.         spy = NewHUD::HUD_Y + NewHUD::SP_Y
  442.        
  443.         if NewHUD::BACKGROUND == nil
  444.         hpx = NewHUD::HUD_X + NewHUD::HP_X
  445.         hpy = NewHUD::HUD_Y + NewHUD::HP_Y
  446.        
  447.         @mana_0_image = []
  448.         for i in (0..@party_each)
  449.         @mana_0_image[i] = Sprite.new
  450.         @mana_0_image[i].bitmap = Bitmap.new(58, 8)
  451.         @mana_0_image[i].bitmap.fill_rect(0, 0, 58, 8, Color.new(255, 255, 255, 192))
  452.         @mana_0_image[i].x = spx + 1
  453.         @mana_0_image[i].y = spy + (nmlvh + 1) * i
  454.         @mana_0_image[i].z = 1001
  455.       end
  456.        
  457.         @mana_1_image = []
  458.         for i in (0..@party_each)
  459.         @mana_1_image[i] = Sprite.new
  460.         @mana_1_image[i].bitmap = Bitmap.new(57, 6)
  461.         @mana_1_image[i].bitmap.gradient_bar_hud(0, -4, 57, 0, 'hud_blue_bar', 0)
  462.         @mana_1_image[i].x = hpx + NewHUD::HP_OX
  463.         @mana_1_image[i].y = hpy + NewHUD::HP_OY + (nmlvh + 1) * i
  464.         @mana_1_image[i].z = 1002
  465.       end
  466.     else
  467.      
  468.         @mana_1_image = []
  469.         for i in (0..@party_each)
  470.         @mana_1_image[i] = Sprite.new
  471.         @mana_1_image[i].bitmap = RPG::Cache.picture(NewHUD::SP_EMPTY)
  472.         @mana_1_image[i].x = spx
  473.         @mana_1_image[i].y = spy + (nmlvh + 1) * i
  474.         @mana_1_image[i].z = 1001
  475.       end
  476.     end
  477.    
  478.        
  479.       #draws SP bars
  480.         spi = RPG::Cache.picture(NewHUD::SP_FULL)
  481.         sw = spi.width
  482.         sh = spi.height
  483.         @mana_2_image.each {|sprite| sprite.dispose } if @mana_2_image != []
  484.        
  485.          if NewHUD::BACKGROUND == nil
  486.            
  487.         @mana_2_image = []
  488.         for i in (0..@party_each)
  489.           rate = (@new_maxsp.at(i) > 0 ? @new_sp.at(i).to_f / @new_maxsp.at(i) : 0) if @new_maxhp.at(i) != nil
  490.           rate = 0 if @new_maxsp.at(i) == nil
  491.         sw2 = sw * @new_sp.at(i) /  @new_maxsp.at(i) if @new_sp.at(i) != nil && @new_maxsp.at(i) != nil
  492.         sw2 = 0 if @new_sp.at(i) == nil && @new_maxsp.at(i) == nil
  493.         @mana_2_image[i] = Sprite.new
  494.         @mana_2_image[i].bitmap = Bitmap.new(57,6)
  495.         @mana_2_image[i].bitmap.gradient_bar_hud(0, -4, 57, rate, 'hud_blue_bar', 0)
  496.         @mana_2_image[i].x = spx + NewHUD::SP_OX
  497.         @mana_2_image[i].y = spy + NewHUD::SP_OY + (nmlvh + 1) * i
  498.         @mana_2_image[i].z = 1003
  499.       end
  500.     else
  501.      
  502.         @mana_2_image = []
  503.         for i in (0..@party_each)
  504.         sw2 = sw * @new_sp.at(i) /  @new_maxsp.at(i) if @new_sp.at(i) != nil && @new_maxsp.at(i) != nil
  505.         sw2 = 0 if @new_sp.at(i) == nil && @new_maxsp.at(i) == nil
  506.         @mana_2_image[i] = Sprite.new
  507.         @mana_2_image[i].bitmap = Bitmap.new(sw,sh)
  508.         @mana_2_image[i].bitmap.fill_rect(0, 0, sw, sh, Color.new(0, 0, 0, 0))
  509.         @mana_2_image[i].x = spx + NewHUD::SP_OX
  510.         @mana_2_image[i].y = spy + NewHUD::SP_OY + (nmlvh + 1) * i
  511.         @mana_2_image[i].z = 1002
  512.         @mana_2_image[i].bitmap.blt(0, 0, spi, Rect.new(0, 0, sw2, sh))
  513.       end
  514.     end
  515.    
  516.        
  517.       #draw SP number
  518.         @mnumber.each {|sprite| sprite.dispose } if @mnumber != nil
  519.         @mnumber = []
  520.         for i in (0..@party_each)
  521.          sp_number = 'Offline' if @new_sp.at(i) == nil && @new_maxsp.at(i) == nil
  522.          sp_number = @new_sp.at(i).to_s+' / '+ @new_maxsp.at(i).to_s if NewHUD::PERCENT_SP == false
  523.          sp_number = @new_sp.at(i) * 100 / @new_maxsp.at(i) if NewHUD::PERCENT_SP == true
  524.         @mnumber[i] = Sprite.new
  525.         @mnumber[i].bitmap = Bitmap.new(sw,sh+4)
  526.         @mnumber[i].bitmap.font.name = "Arial"
  527.         @mnumber[i].bitmap.font.size = 12
  528.         @mnumber[i].bitmap.font.bold = false
  529.         @mnumber[i].bitmap.draw_text_full(0,0,sw,sh+5,' ' + sp_number,1) if NewHUD::PERCENT_SP == false
  530.         @mnumber[i].bitmap.draw_text_full(0,0,sw,sh+5,' ' + sp_number.to_s + '%',1) if NewHUD::PERCENT_SP == true
  531.         @mnumber[i].x = spx
  532.         @mnumber[i].y = spy - 2 + (nmlvh + 1) * i
  533.         @mnumber[i].z = 1004
  534.       end
  535.   end
  536. #=============================================================================
  537. #Hud Dispose
  538. #=============================================================================
  539.       def dispose
  540.          @old_party = []
  541.          @old_combine = []
  542.          @old_hp = []
  543.         @old_maxhp = []
  544.          @old_sp = []
  545.         @old_maxsp = []
  546.         @old_level = []
  547.         @old_class = []
  548.         @background_image.each {|sprite| sprite.dispose } if @background_image !=  nil
  549.         @name_level.each {|sprite| sprite.dispose } if @name_level != []
  550.         @class_icon.each {|sprite| sprite.dispose } if @class_icon != []
  551.         if @health_0_image != nil || @health_0_image != []
  552.         @health_0_image.each {|sprite| sprite.dispose }
  553.       end
  554.         @health_1_image.each {|sprite| sprite.dispose } if @health_1_image != []
  555.         @health_2_image.each {|sprite| sprite.dispose } if @health_2_image != []
  556.         @hnumber.each {|sprite| sprite.dispose } if @hnumber != []
  557.         if @mana_0_image != nil || @mana_0_image != []
  558.         @mana_0_image.each {|sprite| sprite.dispose }
  559.       end
  560.         @mana_1_image.each {|sprite| sprite.dispose } if @mana_1_image != []
  561.         @mana_2_image.each {|sprite| sprite.dispose } if @mana_2_image != []
  562.         @mnumber.each {|sprite| sprite.dispose } if @mnumber != []
  563.       end
  564.     end
  565.   end
  566.   class Scene_Map
  567.     alias hud_main main
  568.       def main
  569.         @newhud = New_Hud.new
  570.         @newhud.dispose
  571.         hud_main
  572.         @newhud = nil
  573.       end
  574.   alias phud_update update
  575.     def update
  576.       phud_update
  577.       if $scene != Scene_Map
  578.         @newhud.dispose
  579.         end
  580.       if $game_system.hud == true
  581.       @newhud.update
  582.       elsif $game_system.hud != true
  583.       @newhud.dispose
  584.         end
  585.     end
  586. end  
  587.  
  588. class Hud
  589.     alias draw_name_online draw_name
  590.     def draw_name
  591.       if @name != $network.username || @old_leader != $network.partyleader
  592.        
  593.       #set username
  594.       @name = $network.username
  595.       #setup bitmap
  596.       self.bitmap.fill_rect(@name_x, @name_y, 104, 19, Color.new(0, 0, 0, 128))
  597.     # set font color
  598.     if $network.partyleader != $network.username || $network.partyleader == ''
  599.       self.bitmap.font.color = Color.new(255, 255, 255)
  600.     else
  601.       @leader_color = Color.new(0,0,0,255) if NewHUD::COLOR > 6 or NewHUD::COLOR < 1
  602.       @leader_color = Color.new(255,50,50,255) if NewHUD::COLOR == 1
  603.       @leader_color = Color.new(87,87,255,255) if NewHUD::COLOR == 2
  604.       @leader_color = Color.new(87,255,87,255) if NewHUD::COLOR == 1
  605.       @leader_color = Color.new(255,255,87,255) if NewHUD::COLOR == 4
  606.       @leader_color = Color.new(255,187,0,255) if NewHUD::COLOR == 5
  607.       @leader_color = Color.new(255,87,255,255) if NewHUD::COLOR == 6
  608.       self.bitmap.font.color = @leader_color
  609.       end
  610.     # draw actor's name
  611.     self.bitmap.draw_text_full(@name_x, @name_y, 104, 20, @name)
  612.     end
  613.   end
  614. end
RAW Paste Data