adiktuzmiko

Map HUD v1.20

Jan 20th, 2014
2,143
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Ruby 16.75 KB | None | 0 0
  1. =begin
  2. ======================================================
  3.  
  4.   Map HUD v1.20
  5.   by Adiktuzmiko                  
  6.  
  7.   Date Created: 01/21/2014
  8.   Date Last Updated: 01/30/2014
  9.   Requires: N/A
  10.   Difficulty: Easy
  11.  
  12. ======================================================
  13.  Overview
  14. ======================================================
  15.  
  16.  This script allows you to display an in-map HUD for
  17.  HP,MP,TP and EXP.
  18.  
  19.  You can make it have a constant maximum
  20.  width, or you can make the width scale with max HP/MP.
  21.  You can use either images,single color or a dual color
  22.  gradient for the bars. You can also have an image or
  23.  color based background and icons for the bars.
  24.  
  25. ======================================================
  26.  Usage
  27. ======================================================
  28.  
  29.  Put this script into your scripts editor, probably
  30.  below any other script that might modify Scene_Map
  31.  and DataManager
  32.  
  33.  Modify the values in the module below to suit your
  34.  needs
  35.  
  36.  Images should be placed in your game's Graphics/System
  37.  folder
  38.  
  39.  To set which actor to show the HUD for, make a script call:
  40.  
  41.  ADIK::MAP_HUD.change_actor(actor_id)
  42.  
  43.  To turn on/off the HUD, make a script call:
  44.  
  45.  ADIK::MAP_HUD.toggle
  46.  
  47.  Take note that the HUD is off by default
  48.  
  49.  The actor and on/off settings are saved and loaded
  50.  from your save file
  51.  
  52. ======================================================
  53.  Compatibility
  54. ======================================================
  55.  
  56.  Aliases DataManager's save/load methods, Scene_Title's
  57.  start method, Scene_Map's start,update and pre terminate
  58.  methods
  59.  
  60. ======================================================
  61.  Terms and Conditions
  62. ======================================================
  63.  
  64.  View it here: http://lescripts.wordpress.com/terms-and-conditions/
  65.  
  66. ======================================================
  67. =end
  68.  
  69.  
  70. module ADIK
  71.   module MAP_HUD
  72.   #HUD modes
  73.     #"constant" => maximum length of bars/gauges is constant
  74.     #"scaling" => maximum length of bars/gauges scale depending on maximum
  75.   MODE = "constant"
  76.     #Maximum width of hp gauges : constant mode
  77.     GAUGE_WIDTH_HP = 544/4
  78.     #Height of hp gauges
  79.     GAUGE_HEIGHT_HP = 10
  80.     #Maximum width of mp gauges : constant mode
  81.     GAUGE_WIDTH_MP = 544/4
  82.     #Height of mp gauges
  83.     GAUGE_HEIGHT_MP = 10
  84.     #HP per pixel : scaling mode
  85.     HP_PER_PIXEL = 10
  86.     #MP per pixel : scaling mode
  87.     MP_PER_PIXEL = 10
  88.   #Maximum width of tp gauges : constant mode
  89.     GAUGE_WIDTH_TP = 544/4
  90.     #Height of tp gauges
  91.     GAUGE_HEIGHT_TP = 10
  92.   #Maximum width of exp gauges : all modes
  93.     GAUGE_WIDTH_XP = 500
  94.     #Height of exp gauges
  95.     GAUGE_HEIGHT_XP = 10
  96.   #TP per pixel : scaling mode
  97.     TP_PER_PIXEL = 10
  98.   #Show hp gauge?
  99.   SHOW_HP = true
  100.   #Show mp gauge?
  101.   SHOW_MP = true
  102.   #Show tp gauge?
  103.   SHOW_TP = false
  104.   #Show exp gauge?
  105.   SHOW_XP = true
  106.   #Font name used
  107.   FONT = "VL Gothic"
  108.   #Font size used
  109.   FONT_SIZE = 18
  110.   #Height buffer for the texts
  111.   HP_BUFFER = 10
  112.   MP_BUFFER = 10
  113.   TP_BUFFER = 10
  114.   XP_BUFFER = 10
  115.   #The following draw varaibles can
  116.   #be set to:
  117.   #:both => draws current and max values
  118.   #:current => draws current value
  119.   #:max => draws max value
  120.   #:percent => draws percentage value
  121.   #:none => draw nothing
  122.   #Draw HP text
  123.   DRAW_HP = :both
  124.   #Draw MP text
  125.   DRAW_MP = :both
  126.   #Draw TP text
  127.   DRAW_TP = :none
  128.   #Draw EXP text
  129.   DRAW_XP = :percent
  130.   #How many decimals to show for percent?
  131.   DECIMALS = 2
  132.     #Use gauge images?
  133.     GAUGE_IMAGES = false
  134.     #If true:
  135.       #HP Gauge background
  136.       GAUGE_BG_HP = ""
  137.       #MP Gauge background
  138.       GAUGE_BG_MP = ""
  139.     #TP Gauge background
  140.       GAUGE_BG_TP = ""
  141.     #XP Gauge background
  142.       GAUGE_BG_XP = ""
  143.       #HP Gauge image
  144.       GAUGE_HP = ""
  145.       #MP Gauge image
  146.       GAUGE_MP = ""
  147.     #TP Gauge image
  148.       GAUGE_TP = ""
  149.     #XP Gauge image
  150.       GAUGE_XP = ""
  151.     #else
  152.       #Color.new(R,G,B,A)
  153.       #Set A to 0 if you want invisible
  154.       #HP Gauge background color
  155.       GAUGE_BGC_HP = Color.new(50,50,50,150)
  156.       #MP Gauge background color
  157.       GAUGE_BGC_MP = Color.new(50,50,50,150)
  158.     #TP Gauge background color
  159.       GAUGE_BGC_TP = Color.new(0,0,0,0)
  160.     #EXP Gauge background color
  161.       GAUGE_BGC_XP = Color.new(50,50,50,150)
  162.       #HP Gauge color
  163.       GAUGE_C_HP = Color.new(0,255,0,200)
  164.       #MP Gauge color
  165.       GAUGE_C_MP = Color.new(0,0,255,200)
  166.     #TP Gauge color
  167.       GAUGE_C_TP = Color.new(0,0,0,0)
  168.     #EXP Gauge color
  169.       GAUGE_C_XP = Color.new(200,200,0,255)
  170.       #Use gradient color?
  171.       GAUGE_GRADIENT = true
  172.       #HP Gauge color 2
  173.       GAUGE_C_HP_2 = Color.new(200,255,0,200)
  174.       #MP Gauge color 2
  175.       GAUGE_C_MP_2 = Color.new(200,0,255,200)
  176.     #TP Gauge color 2
  177.       GAUGE_C_TP_2 = Color.new(0,0,0,0)
  178.     #EXP Gauge color 2
  179.       GAUGE_C_XP_2 = Color.new(200,200,0,200)
  180.     #end
  181.   #Use icons?
  182.   USE_ICONS = true
  183.   #HP Icon index
  184.   HP_ICON = 189
  185.   #MP Icon Index
  186.   MP_ICON = 188
  187.   #TP Icon Index
  188.   TP_ICON = 0
  189.   #EXP Icon Index
  190.   XP_ICON = 0
  191.   #HP Icon alpha
  192.   HP_ICON_ALPHA = 255
  193.   #MP Icon alpha
  194.   MP_ICON_ALPHA = 255
  195.   #TP Icon alpha
  196.   TP_ICON_ALPHA = 0
  197.   #EXP Icon alpha
  198.   XP_ICON_ALPHA = 0
  199.     #X position of hp gauge
  200.     X_HP = 24
  201.     #Y position of hp gauge
  202.     Y_HP = 9
  203.     #X position of mp gauge
  204.     X_MP = 24
  205.     #Y position of mp gauge
  206.     Y_MP = 34
  207.   #X position of tp gauge
  208.     X_TP = 24
  209.     #Y position of tp gauge
  210.     Y_TP = 60
  211.   #X position of exp gauge
  212.     X_XP = 22
  213.     #Y position of xp gauge
  214.     Y_XP = 416-16
  215.   #X position of hp icon
  216.     X_HP_ICON = 2
  217.     #Y position of hp icon
  218.     Y_HP_ICON = 1
  219.     #X position of mp icon
  220.     X_MP_ICON = 2
  221.     #Y position of mp icon
  222.     Y_MP_ICON = 26
  223.   #X position of tp icon
  224.     X_TP_ICON = 0
  225.     #Y position of tp icon
  226.     Y_TP_ICON = 0
  227.   #X position of xp icon
  228.     X_XP_ICON = 0
  229.     #Y position of xp icon
  230.     Y_XP_ICON = 0
  231.     #Z of gauges
  232.     GAUGES_Z = 500
  233.     #Actor ID
  234.     ACTOR = 1
  235.  
  236.   #Background properties
  237.   #Not advisable for scaling mode
  238.  
  239.   #Background image, set to nil if you don't want it
  240.   BACKGROUND = nil
  241.   #Opacity of BACKGROUND
  242.   OPACITY = 255
  243.   #Use background color?
  244.   USE_BG_COLOR = false
  245.   #Background color, appears above image
  246.   BG_COLOR = Color.new(50,50,50,100)
  247.   #Use gradient color?
  248.   BG_GRADIENT = false
  249.   #2nd color, used for gradient
  250.   BG_COLOR_2 = nil
  251.   #X position of background
  252.   BG_X = 0
  253.   #Y position of background
  254.   BG_Y = 0
  255.   #Width of background
  256.   BG_WIDTH = 165
  257.   #Height of background
  258.   BG_HEIGHT = 55
  259.  
  260. #==================================================================
  261. # DO NOT EDIT BEYOND THIS POINT
  262. #==================================================================
  263.    
  264.     def self.init
  265.       @use_hud = false
  266.       @viewport = Viewport.new(0,0,544,416)
  267.     @viewport.z = GAUGES_Z
  268.       @sprite_bg = Sprite_Base.new(@viewport)
  269.       @sprite_bg.z = GAUGES_Z
  270.       @sprite_bg.bitmap = Bitmap.new(544,416)
  271.       @sprite_b = Sprite_Base.new(@viewport)
  272.       @sprite_b.z = GAUGES_Z+1
  273.       @sprite_b.bitmap = Bitmap.new(544,416)
  274.       if GAUGE_IMAGES
  275.         @hp_bg_bit = Cache.system(GAUGE_BG_HP)
  276.           @mp_bg_bit = Cache.system(GAUGE_BG_MP)
  277.           @hp_b_bit = Cache.system(GAUGE_HP)
  278.           @mp_b_bit = Cache.system(GAUGE_MP)
  279.       @tp_bg_bit = Cache.system(GAUGE_BG_TP)
  280.           @tp_b_bit = Cache.system(GAUGE_TP)
  281.       @xp_bg_bit = Cache.system(GAUGE_BG_XP)
  282.           @tp_b_bit = Cache.system(GAUGE_XP)
  283.     end
  284.     @bg = Cache.system(BACKGROUND) unless BACKGROUND.nil?
  285.       @hp = []
  286.       @mp = []
  287.       @maxhp = []
  288.       @maxmp = []
  289.     @tp = []
  290.     @exp = []
  291.     @sprite_b.bitmap.font.name = FONT
  292.     @sprite_b.bitmap.font.size = FONT_SIZE
  293.     end
  294.    
  295.     def self.toggle
  296.       @use_hud = !@use_hud
  297.       if SceneManager.scene_is?(Scene_Map)
  298.         if @use_hud
  299.           self.update(true)
  300.         else
  301.           @sprite_b.bitmap.clear
  302.         @sprite_bg.bitmap.clear
  303.         end
  304.       end
  305.     end
  306.    
  307.     def self.change_actor(id)
  308.       @actor = $game_actors[id]
  309.       self.update if SceneManager.scene_is?(Scene_Map)
  310.     end
  311.    
  312.   def self.use_hud
  313.     return @use_hud
  314.   end
  315.  
  316.   def self.load_hud(wat)
  317.     @use_hud = wat
  318.   end
  319.  
  320.   def self.actor
  321.     return @actor.id
  322.   end
  323.  
  324.   def self.clear
  325.     @sprite_b.bitmap.clear
  326.     @sprite_bg.bitmap.clear
  327.   end
  328.  
  329.     def self.update(forced=false)
  330.       unless forced
  331.         return if not @use_hud
  332.         return if not SceneManager.scene_is?(Scene_Map)
  333.         return if not @actor
  334.         return if (@actor.hp == @hp[@actor.id] and @actor.mp == @mp[@actor.id] and @actor.mhp == @maxhp[@actor.id] and @actor.mmp == @maxmp[@actor.id] and @actor.tp == @tp[@actor.id] and @actor.exp == @exp[@actor.id])
  335.     end
  336.       @hp[@actor.id] = @actor.hp
  337.       @mp[@actor.id] = @actor.mp
  338.       @maxhp[@actor.id] = @actor.mhp
  339.       @maxmp[@actor.id] = @actor.mmp
  340.     @tp[@actor.id] = @actor.tp
  341.     @exp[@actor.id] = @actor.exp
  342.       @sprite_b.bitmap.clear
  343.       @sprite_bg.bitmap.clear
  344.     rect_bg = Rect.new(BG_X,BG_Y,BG_WIDTH,BG_HEIGHT)
  345.     if not @bg.nil?
  346.       rect = Rect.new(0,0,@bg.width,@bg.height)
  347.       @sprite_bg.bitmap.stretch_blt(rect_hp,@bg,rect,OPACITY)
  348.     end
  349.     if USE_BG_COLOR
  350.       if BG_GRADIENT
  351.         @sprite_bg.bitmap.gradient_fill_rect(rect_bg,BG_COLOR,BG_COLOR_2)
  352.       else
  353.         @sprite_bg.bitmap.fill_rect(rect_bg,BG_COLOR)
  354.       end
  355.     end
  356.       if MODE == "constant"
  357.         rect_hp = Rect.new(X_HP,Y_HP,GAUGE_WIDTH_HP,GAUGE_HEIGHT_HP)
  358.         rect_mp = Rect.new(X_MP,Y_MP,GAUGE_WIDTH_MP,GAUGE_HEIGHT_MP)
  359.       rect_tp = Rect.new(X_TP,Y_TP,GAUGE_WIDTH_TP,GAUGE_HEIGHT_TP)
  360.       else
  361.         rect_hp = Rect.new(X_HP,Y_HP,@actor.mhp/HP_PER_PIXEL,GAUGE_HEIGHT_HP)
  362.           rect_mp = Rect.new(X_MP,Y_MP,@actor.mmp/MP_PER_PIXEL,GAUGE_HEIGHT_MP)
  363.       rect_tp = Rect.new(X_TP,Y_TP,100/TP_PER_PIXEL,GAUGE_HEIGHT_TP)
  364.       end
  365.     rect_xp = Rect.new(X_XP,Y_XP,GAUGE_WIDTH_XP,GAUGE_HEIGHT_XP)
  366.       if GAUGE_IMAGES
  367.       if SHOW_HP
  368.           rect = Rect.new(0,0,@hp_bg_bit.width,@hp_bg_bit.height)
  369.         @sprite_bg.bitmap.stretch_blt(rect_hp,@hp_bg_bit,rect)
  370.         rect = Rect.new(0,0,@hp_b_bit.width*@actor.hp_rate,@hp_b_bit.height)
  371.         rect_hp.width *= @actor.hp_rate
  372.         @sprite_b.bitmap.stretch_blt(rect_hp,@hp_b_bit,rect)
  373.       end
  374.       if SHOW_MP
  375.         rect = Rect.new(0,0,@mp_bg_bit.width,@mp_bg_bit.height)
  376.         @sprite_bg.bitmap.stretch_blt(rect_mp,@mp_bg_bit,rect)
  377.         rect = Rect.new(0,0,@mp_b_bit.width*@actor.mp_rate,@mp_b_bit.height)
  378.         rect_mp.width *= @actor.mp_rate
  379.         @sprite_b.bitmap.stretch_blt(rect_mp,@mp_b_bit,rect)
  380.       end
  381.       if SHOW_TP
  382.         rect = Rect.new(0,0,@tp_bg_bit.width,@tp_bg_bit.height)
  383.         @sprite_bg.bitmap.stretch_blt(rect_tp,@tp_bg_bit,rect)
  384.         rect = Rect.new(0,0,@tp_b_bit.width*@actor.tp_rate,@tp_b_bit.height)
  385.         rect_tp.width *= @actor.tp_rate
  386.         @sprite_b.bitmap.stretch_blt(rect_tp,@tp_b_bit,rect)
  387.       end
  388.       if SHOW_XP
  389.         rect = Rect.new(0,0,@xp_bg_bit.width,@xp_bg_bit.height)
  390.         @sprite_bg.bitmap.stretch_blt(rect_xp,@xp_bg_bit,rect)
  391.         rect = Rect.new(0,0,@xp_b_bit.width*@actor.xp_rate,@xp_b_bit.height)
  392.         rect_xp.width *= @actor.xp_rate
  393.         @sprite_b.bitmap.stretch_blt(rect_xp,@xp_b_bit,rect)
  394.       end
  395.       else
  396.       @sprite_bg.bitmap.fill_rect(rect_hp,GAUGE_BGC_HP) if SHOW_HP
  397.           @sprite_bg.bitmap.fill_rect(rect_mp,GAUGE_BGC_MP) if SHOW_MP
  398.       @sprite_bg.bitmap.fill_rect(rect_tp,GAUGE_BGC_TP) if SHOW_TP
  399.       @sprite_bg.bitmap.fill_rect(rect_xp,GAUGE_BGC_XP) if SHOW_XP
  400.           rect_hp.width *= @actor.hp_rate
  401.           rect_mp.width *= @actor.mp_rate
  402.       rect_tp.width *= @actor.tp_rate
  403.       rect_xp.width *= @actor.exp_rate
  404.           if GAUGE_GRADIENT
  405.             @sprite_b.bitmap.gradient_fill_rect(rect_hp,GAUGE_C_HP,GAUGE_C_HP_2) if SHOW_HP
  406.             @sprite_b.bitmap.gradient_fill_rect(rect_mp,GAUGE_C_MP,GAUGE_C_MP_2) if SHOW_MP
  407.         @sprite_b.bitmap.gradient_fill_rect(rect_tp,GAUGE_C_TP,GAUGE_C_TP_2) if SHOW_TP
  408.         @sprite_b.bitmap.gradient_fill_rect(rect_xp,GAUGE_C_XP,GAUGE_C_XP_2) if SHOW_XP
  409.       else
  410.             @sprite_b.bitmap.fill_rect(rect_hp,GAUGE_C_HP) if SHOW_HP
  411.             @sprite_b.bitmap.fill_rect(rect_mp,GAUGE_C_MP) if SHOW_MP
  412.         @sprite_b.bitmap.fill_rect(rect_tp,GAUGE_C_TP) if SHOW_TP
  413.             @sprite_b.bitmap.fill_rect(rect_xp,GAUGE_C_XP) if SHOW_XP
  414.           end
  415.       end
  416.     if USE_ICONS
  417.         bitmap = Cache.system("Iconset")
  418.         if SHOW_HP
  419.           rect = Rect.new(HP_ICON % 16 * 24, HP_ICON / 16 * 24, 24, 24)
  420.           @sprite_b.bitmap.blt(X_HP_ICON, Y_HP_ICON, bitmap, rect, HP_ICON_ALPHA)
  421.         end
  422.         if SHOW_MP
  423.           rect = Rect.new(MP_ICON % 16 * 24, MP_ICON / 16 * 24, 24, 24)
  424.           @sprite_b.bitmap.blt(X_MP_ICON, Y_MP_ICON, bitmap, rect, MP_ICON_ALPHA)
  425.         end
  426.         if SHOW_TP
  427.           rect = Rect.new(TP_ICON % 16 * 24, TP_ICON / 16 * 24, 24, 24)
  428.           @sprite_b.bitmap.blt(X_TP_ICON, Y_TP_ICON, bitmap, rect, TP_ICON_ALPHA)
  429.         end
  430.         if SHOW_XP
  431.           rect = Rect.new(XP_ICON % 16 * 24, XP_ICON / 16 * 24, 24, 24)
  432.           @sprite_b.bitmap.blt(X_XP_ICON, Y_XP_ICON, bitmap, rect, XP_ICON_ALPHA)
  433.         end
  434.     end
  435.     if SHOW_HP and DRAW_HP != :none
  436.       case DRAW_HP
  437.       when :both
  438.         @sprite_b.bitmap.draw_text(X_HP,Y_HP,GAUGE_WIDTH_HP,GAUGE_HEIGHT_HP + HP_BUFFER, @actor.hp.to_s + "/" + @actor.mhp.to_s)
  439.       when :current
  440.         @sprite_b.bitmap.draw_text(X_HP,Y_HP,GAUGE_WIDTH_HP,GAUGE_HEIGHT_HP + HP_BUFFER, @actor.hp.to_s)
  441.       when :max
  442.         @sprite_b.bitmap.draw_text(X_HP,Y_HP,GAUGE_WIDTH_HP,GAUGE_HEIGHT_HP + HP_BUFFER, @actor.mhp.to_s)
  443.       when :percent
  444.         @sprite_b.bitmap.draw_text(X_HP,Y_HP,GAUGE_WIDTH_HP,GAUGE_HEIGHT_HP + HP_BUFFER, get_decimal((@actor.hp*100/@actor.mhp).to_s) + "%")
  445.       end
  446.     end
  447.     if SHOW_MP and DRAW_MP != :none
  448.       case DRAW_MP
  449.       when :both
  450.         @sprite_b.bitmap.draw_text(X_MP,Y_MP,GAUGE_WIDTH_MP,GAUGE_HEIGHT_MP + MP_BUFFER, @actor.mp.to_s + "/" + @actor.mmp.to_s)
  451.       when :current
  452.         @sprite_b.bitmap.draw_text(X_MP,Y_MP,GAUGE_WIDTH_MP,GAUGE_HEIGHT_MP + MP_BUFFER, @actor.mp.to_s)
  453.       when :max
  454.         @sprite_b.bitmap.draw_text(X_MP,Y_MP,GAUGE_WIDTH_MP,GAUGE_HEIGHT_MP + MP_BUFFER, @actor.mmp.to_s)
  455.       when :percent
  456.         @sprite_b.bitmap.draw_text(X_MP,Y_MP,GAUGE_WIDTH_MP,GAUGE_HEIGHT_MP + MP_BUFFER, get_decimal((@actor.mp*100/@actor.mmp).to_s) + "%")
  457.       end
  458.     end
  459.     if SHOW_TP and DRAW_TP != :none
  460.       case DRAW_TP
  461.       when :both
  462.         @sprite_b.bitmap.draw_text(X_TP,Y_TP,GAUGE_WIDTH_TP,GAUGE_HEIGHT_TP + TP_BUFFER, @actor.tp.to_s + "/100" )
  463.       when :current
  464.         @sprite_b.bitmap.draw_text(X_TP,Y_TP,GAUGE_WIDTH_TP,GAUGE_HEIGHT_TP + TP_BUFFER, @actor.tp.to_s)
  465.       when :max
  466.         @sprite_b.bitmap.draw_text(X_TP,Y_TP,GAUGE_WIDTH_TP,GAUGE_HEIGHT_TP + TP_BUFFER, "100")
  467.       when :percent
  468.         @sprite_b.bitmap.draw_text(X_TP,Y_TP,GAUGE_WIDTH_TP,GAUGE_HEIGHT_TP + TP_BUFFER, get_decimal(@actor.tp.to_s) + "%")
  469.       end
  470.     end
  471.     if SHOW_XP and DRAW_XP != :none
  472.       case DRAW_XP
  473.       when :both
  474.         @sprite_b.bitmap.draw_text(X_XP,Y_XP,GAUGE_WIDTH_XP,GAUGE_HEIGHT_XP + XP_BUFFER, (@actor.exp-@actor.current_level_exp).to_s + "/" + (@actor.next_level_exp-@actor.current_level_exp).to_s)
  475.       when :current
  476.         @sprite_b.bitmap.draw_text(X_XP,Y_XP,GAUGE_WIDTH_XP,GAUGE_HEIGHT_XP + XP_BUFFER, (@actor.exp-@actor.current_level_exp).to_s)
  477.       when :max
  478.         @sprite_b.bitmap.draw_text(X_XP,Y_XP,GAUGE_WIDTH_XP,GAUGE_HEIGHT_XP + XP_BUFFER, (@actor.next_level_exp-@actor.current_level_exp).to_s)
  479.       when :percent
  480.         @sprite_b.bitmap.draw_text(X_XP,Y_XP,GAUGE_WIDTH_XP,GAUGE_HEIGHT_XP + XP_BUFFER, get_decimal((@actor.exp_rate*100).to_s) + "%")
  481.       end
  482.     end
  483.     end
  484.    
  485.   def self.get_decimal(text)
  486.     return text[0,text.index(".")+DECIMALS]
  487.   end
  488.  
  489.   end
  490. end
  491.  
  492. class Scene_Map
  493.  
  494.   alias start_adik_map_hud start
  495.   def start
  496.     start_adik_map_hud
  497.     ADIK::MAP_HUD.update(true) if ADIK::MAP_HUD.use_hud
  498.   end
  499.  
  500.   alias update_adik_map_hud update
  501.   def update
  502.     update_adik_map_hud
  503.       ADIK::MAP_HUD.update
  504.   end
  505.  
  506.   alias terminate_adik_map_hud pre_terminate
  507.   def pre_terminate
  508.     terminate_adik_map_hud
  509.     ADIK::MAP_HUD.clear if ADIK::MAP_HUD.use_hud
  510.   end
  511.  
  512. end
  513.  
  514. class Scene_Title
  515.   alias start_adik_map_hud start
  516.   def start
  517.     start_adik_map_hud
  518.     ADIK::MAP_HUD.init
  519.   end
  520. end
  521.  
  522. module DataManager
  523.   class <<self; alias make_save_contents_adik_map_hud make_save_contents; end
  524.   def self.make_save_contents
  525.     contents = make_save_contents_adik_map_hud
  526.     contents[:use_adik_map_hud] = ADIK::MAP_HUD.use_hud
  527.     contents[:actor_adik_map_hud] = ADIK::MAP_HUD.actor
  528.     contents
  529.   end
  530.  
  531.   class <<self; alias extract_save_contents_adik_map_hud extract_save_contents; end
  532.   def self.extract_save_contents(contents)
  533.     extract_save_contents_adik_map_hud(contents)
  534.     ADIK::MAP_HUD.load_hud(contents[:use_adik_map_hud]) if contents[:use_adik_map_hud] != nil
  535.     ADIK::MAP_HUD.change_actor(contents[:actor_adik_map_hud]) if contents[:actor_adik_map_hud] != nil
  536.   end
  537. end
  538.  
  539. class Game_Actor
  540.   def exp_rate
  541.     return (exp-current_level_exp).to_f/(next_level_exp-current_level_exp)
  542.   end
  543. end
Advertisement
Add Comment
Please, Sign In to add comment