设为首页收藏本站同能贴吧 切换语言 繁体中文
开启辅助访问 切换到窄版
扫描二维码关注官方公众号
返回列表
+ 发新帖
查看: 110|回复: 0

[转载发布] Simple Map HUD with Variable Gauge

[复制链接]
累计送礼:
0 个
累计收礼:
1 个
  • TA的每日心情
    开心
    2026-7-12 04:10
  • 签到天数: 209 天

    连续签到: 2 天

    [LV.7]常住居民III

    9071

    主题

    864

    回帖

    6万

    积分

    管理员

    Rank: 9Rank: 9Rank: 9

    VIP
    7
    卡币
    58883
    OK点
    16
    推广点
    0
    同能卷
    50
    积分
    68848

    灌水之王

    发表于 2026-8-2 13:19:52 | 显示全部楼层 |阅读模式
    Map HUD

    Introduction
    This script was created to display the HUD on the map.
    HUD Contains information on Face, character, name, class, HP, MP, Exp, Map, and you can add variables as gauge.
    Terms of Use
    Free to use in commercial and non-commercial project.
    Credit me for use this script.

    Script
    Spoiler                Ruby:       
    1. #===============================================================================
    2. # ♦ IneptAttorney Simple Map HUD
    3. #-------------------------------------------------------------------------------
    4. # Author: IneptAttorney
    5. # Date  : 8th April 2020
    6. # Engine: RMVX Ace
    7. # Type  : Graphics Scripts
    8. #-------------------------------------------------------------------------------
    9. # ♦ Introduction
    10. #   This script was created to display the HUD on the map.
    11. #   HUD Contains information on Face, character, name, class, HP, MP, Exp, Map,
    12. #   and you can add variables as gauge.
    13. #-------------------------------------------------------------------------------
    14. # ♦ Instruction
    15. #   Set the configuration below.
    16. #   Use script calls to show or hide HUD.
    17. #-------------------------------------------------------------------------------
    18. # ♦ Script Call
    19. #   hud <------ To show the HUD. or you can use ------> hud(true)
    20. #   hud(false) <---------- To hide the HUD.
    21. #-------------------------------------------------------------------------------
    22. # ♦ Terms of Use
    23. #   Free to use for non-commercial and commercial projects.
    24. #   Credit me in your project.
    25. #===============================================================================
    26. module INPTATTRNY
    27.   module MAP_HUD
    28.     #-------------------------------------------------------------
    29.     # Set this to true if you want to display the actor's face.
    30.     # Set this to false to display the actor's character.
    31.     #-------------------------------------------------------------
    32.     USE_FACE = true
    33.     #-------------------------------------------------------------
    34.     # Set the background for your HUD. leave configuration ""
    35.     # if you don't want to use Background.
    36.     #-------------------------------------------------------------
    37.     BACK_GRAPHIC = ""
    38.     #-------------------------------------------------------------
    39.     # Set the background Opacity.
    40.     #-------------------------------------------------------------
    41.     BACK_OPAC = 255
    42.     #-------------------------------------------------------------
    43.     # Set this to true if you want to use custom geague
    44.     #-------------------------------------------------------------
    45.     USE_VARIABLE = true
    46.     #-------------------------------------------------------------
    47.     # Set the name displayed Set the name to display on the custom gauge.
    48.     #-------------------------------------------------------------
    49.     VAR_NAME = "Variable"
    50.     #-------------------------------------------------------------
    51.     # Set the color for the gauge.
    52.     #-------------------------------------------------------------
    53.     # Format:  Color.new(R,     G,   B, Alpha)
    54.     COLOR1 =   Color.new(110, 255,   0, 255)
    55.     COLOR2 =   Color.new(0,   255, 213, 255)
    56.     #-------------------------------------------------------------
    57.     # Set the Variable ID to display on custom gauge.
    58.     #-------------------------------------------------------------
    59.     VARIABLE_ID = 1
    60.     #-------------------------------------------------------------
    61.     # Set the Variable Max to display on sutom gauge.
    62.     #-------------------------------------------------------------
    63.     VARIABLE_MAX = 100
    64.    
    65.   end
    66. end
    67. #===============================================================================
    68. # Below there is no configuration area anymore!
    69. # Don't change all the texts below unless you know how they work
    70. #===============================================================================
    71. #---------------------------------------------------------
    72. # * Window IAHUD
    73. #---------------------------------------------------------
    74. class Window_IAHUD < Window_Base
    75.   def initialize
    76.     super(0,0,Graphics.width,Graphics.width)
    77.     self.opacity = 0
    78.     @actor = $game_party.leader
    79.     refresh
    80.   end
    81.   def show
    82.     self.visible = true
    83.     self
    84.   end
    85.   def hide
    86.     self.visible = false
    87.     self
    88.   end
    89.   def refresh
    90.     contents.clear
    91.     var = INPTATTRNY::MAP_HUD::VARIABLE_ID
    92.     if INPTATTRNY::MAP_HUD::USE_FACE == true
    93.       draw_actor_face(@actor,0,-32)
    94.     else
    95.       draw_actor_graphic(@actor, 62, line_height+18)
    96.     end
    97.     draw_actor_name(@actor,96+32,0)
    98.     draw_actor_class(@actor,96+32,line_height)
    99.     draw_actor_hp(@actor,220,0)
    100.     draw_actor_mp(@actor,220,line_height)
    101.     draw_iaactor_exp(@actor,124,Graphics.height-50,Graphics.width-156)
    102.     draw_currency_value($game_party.gold,Vocab::currency_unit,366,0,154)
    103.     draw_map_name(0,Graphics.height-50,124)
    104.     draw_variable_geague(var,366,line_height,154) if INPTATTRNY::MAP_HUD::USE_VARIABLE == true
    105.   end
    106.   #-----------------------------------------------
    107.   # * Draw Map Name
    108.   #-----------------------------------------------
    109.   def draw_map_name(x,y,width)
    110.     unless $game_map.display_name.empty?
    111.       text = $game_map.display_name
    112.       draw_text(x,y,width,line_height,text)
    113.     end
    114.   end
    115.   #-----------------------------------------------
    116.   # * Draw Custom Gauge
    117.   #_----------------------------------------------
    118.   def draw_variable_geague(var_id,x,y,width)
    119.     ecolor = INPTATTRNY::MAP_HUD::COLOR1
    120.     ecolor2 = INPTATTRNY::MAP_HUD::COLOR2
    121.     varer = $game_variables[var_id]
    122.     varer_max = INPTATTRNY::MAP_HUD::VARIABLE_MAX
    123.     draw_gauge(x, y, width, varer, ecolor, ecolor2)
    124.     change_color(system_color)
    125.     draw_text(x, y, 100, line_height, INPTATTRNY::MAP_HUD::VAR_NAME)
    126.     draw_current_and_max_values(x, y, width, varer, varer_max,
    127.      system_color, normal_color)
    128.   end
    129.   #-----------------------------------------------
    130.   # * Draw_exp
    131.   #-----------------------------------------------
    132.   def draw_iaactor_exp(actor, x, y, width = 124)
    133.     nicolor = Color.new(255,238,0,255)
    134.     nicolor2 = Color.new(255,157,0,255)
    135.     next_exp = actor.exp_for_level(@actor.level+1)
    136.     eexp = actor.exp
    137.     draw_gauge(x, y, width, actor.exp, nicolor, nicolor2)
    138.     change_color(system_color)
    139.     draw_text(x, y, 30, line_height, "Exp")
    140.     draw_current_and_max_values(x, y, width, eexp, next_exp,
    141.      mp_color(actor), normal_color)
    142.   end
    143. end
    144. #===============================================================================
    145. class Sprite_Back < Sprite_Base
    146. #===============================================================================
    147.   def initialize(viewport)
    148.     super(viewport)
    149.     update
    150.   end
    151.   def dispose
    152.     bitmap.dispose if bitmap
    153.     super
    154.   end
    155.   def show
    156.     self.visible = true
    157.   end
    158.   def hide
    159.     self.visible = false
    160.   end
    161.   def update
    162.     super
    163.     update_bitmap
    164.     update_origin
    165.     update_bright
    166.   end
    167.   def update_bright
    168.     self.opacity = INPTATTRNY::MAP_HUD::BACK_OPAC
    169.   end
    170.   def update_bitmap
    171.     if INPTATTRNY::MAP_HUD::BACK_GRAPHIC == ""
    172.       self.bitmap = nil
    173.     else
    174.       self.bitmap = Cache.picture(INPTATTRNY::MAP_HUD::BACK_GRAPHIC)
    175.     end
    176.   end
    177.   def update_origin
    178.       self.ox = 0
    179.       self.oy = 0
    180.   end
    181. end
    182. #===============================================================================
    183. class Scene_Map < Scene_Base
    184. #===============================================================================
    185.   alias inpt_hud_allwindow create_all_windows
    186.   def create_all_windows
    187.     create_hud_window
    188.     create_back_sprite
    189.     inpt_hud_allwindow
    190.   end
    191.   def create_back_sprite
    192.     @sprite_back = Sprite_Back.new(@viewport)
    193.   end
    194.    
    195.   def create_hud_window
    196.     @hud_window = Window_IAHUD.new
    197.     @hud_window.viewport = @viewport
    198.   end
    199.   def show_hud
    200.     @hud_window.show
    201.     @sprite_back.show
    202.   end
    203.   def hide_hud
    204.     @hud_window.hide
    205.     @sprite_back.hide
    206.   end
    207. end
    208. #===============================================================================
    209. class Game_Interpreter
    210. #===============================================================================
    211.   def hud(bool=true)
    212.     if bool == true
    213.       SceneManager.scene.show_hud
    214.     else
    215.       SceneManager.scene.hide_hud
    216.     end
    217.   end
    218. end
    复制代码





    Indonesian version
    Spoiler                Ruby:       
    1. #===============================================================================
    2. # ♦ IneptAttorney Simple Map HUD
    3. #-------------------------------------------------------------------------------
    4. # Author: IneptAttorney
    5. # Date  : 8th April 2020
    6. # Engine: RMVX Ace
    7. # Type  : Graphics Scripts
    8. #-------------------------------------------------------------------------------
    9. # ♦ Introduction
    10. #   Skrip ini gunanya buat nampilin HUD pada Map.
    11. #   HUD berisi Nama, kelas, wajah, karakter, HP, MP, Exp, nama Map
    12. #   dan kamu bisa bikin variable gauge.
    13. #-------------------------------------------------------------------------------
    14. # ♦ Instruction
    15. #   Atur konfigurasi dibawah
    16. #   Gunain script call buat nampilin dan nyembunyiin HUD
    17. #-------------------------------------------------------------------------------
    18. # ♦ Script Call
    19. #   hud <------ Buat nampilin HUD. Ato bisa juga make ------> hud(true)
    20. #   hud(false) <---------- Buat nyembunyiin HUD
    21. #-------------------------------------------------------------------------------
    22. # ♦ Terms of Use
    23. #   Gratis buat dipake di proyek komersil maupun nonkomersil
    24. #   Credit saya di proyek kamu. \(0=0\)
    25. #===============================================================================
    26. module INPTATTRNY
    27.   module MAP_HUD
    28.     #-------------------------------------------------------------
    29.     # Atur ke true kalo kamu mau nampilin wajah aktor di HUD nya
    30.     # Atur ke false kalo kamu mau nampilin karakter aktor di HUD nya
    31.     #-------------------------------------------------------------
    32.     USE_FACE = true
    33.     #-------------------------------------------------------------
    34.     # Atur background buat HUD kamu. kosongin aja kalo gamau pake Background.
    35.     #-------------------------------------------------------------
    36.     BACK_GRAPHIC = ""
    37.     #-------------------------------------------------------------
    38.     # Atur Opasitas background kamu
    39.     #-------------------------------------------------------------
    40.     BACK_OPAC = 255
    41.     #-------------------------------------------------------------
    42.     # Atur ini ke true kalo kamu mau ngegunain Variable gauge.
    43.     #-------------------------------------------------------------
    44.     USE_VARIABLE = true
    45.     #-------------------------------------------------------------
    46.     # Atur nama yang bakal ditampilin di variable gauge.
    47.     #-------------------------------------------------------------
    48.     VAR_NAME = "Variable"
    49.     #-------------------------------------------------------------
    50.     # Atur Warna buat Variable gauge nya
    51.     #-------------------------------------------------------------
    52.     # Formatnya:  Color.new(R,     G,   B, Alpha)
    53.     COLOR1 =      Color.new(110, 255,   0, 255)
    54.     COLOR2 =      Color.new(0,   255, 213, 255)
    55.     #-------------------------------------------------------------
    56.     # Atur Variable ID buat dipake sebagai variable gauge.
    57.     #-------------------------------------------------------------
    58.     VARIABLE_ID = 1
    59.     #-------------------------------------------------------------
    60.     # Atur maksimal variable buat dipake sebagai variable gauge.
    61.     #-------------------------------------------------------------
    62.     VARIABLE_MAX = 100
    63.    
    64.   end
    65. end
    66. #===============================================================================
    67. # Dibawah sini udah bukan area konfigurasi!
    68. # Jangan ganti teks yang ada dibawah kecuali kalian tau cara kerja nya.
    69. #===============================================================================
    70. #---------------------------------------------------------
    71. # * Window IAHUD
    72. #---------------------------------------------------------
    73. class Window_IAHUD < Window_Base
    74.   def initialize
    75.     super(0,0,Graphics.width,Graphics.width)
    76.     self.opacity = 0
    77.     @actor = $game_party.leader
    78.     refresh
    79.   end
    80.   def show
    81.     self.visible = true
    82.     self
    83.   end
    84.   def hide
    85.     self.visible = false
    86.     self
    87.   end
    88.   def refresh
    89.     contents.clear
    90.     var = INPTATTRNY::MAP_HUD::VARIABLE_ID
    91.     if INPTATTRNY::MAP_HUD::USE_FACE == true
    92.       draw_actor_face(@actor,0,-32)
    93.     else
    94.       draw_actor_graphic(@actor, 62, line_height+18)
    95.     end
    96.     draw_actor_name(@actor,96+32,0)
    97.     draw_actor_class(@actor,96+32,line_height)
    98.     draw_actor_hp(@actor,220,0)
    99.     draw_actor_mp(@actor,220,line_height)
    100.     draw_iaactor_exp(@actor,124,Graphics.height-50,Graphics.width-156)
    101.     draw_currency_value($game_party.gold,Vocab::currency_unit,366,0,154)
    102.     draw_map_name(0,Graphics.height-50,124)
    103.     draw_variable_geague(var,366,line_height,154) if INPTATTRNY::MAP_HUD::USE_VARIABLE == true
    104.   end
    105.   #-----------------------------------------------
    106.   # * Draw Map Name
    107.   #-----------------------------------------------
    108.   def draw_map_name(x,y,width)
    109.     unless $game_map.display_name.empty?
    110.       text = $game_map.display_name
    111.       draw_text(x,y,width,line_height,text)
    112.     end
    113.   end
    114.   #-----------------------------------------------
    115.   # * Draw Custom Gauge
    116.   #_----------------------------------------------
    117.   def draw_variable_geague(var_id,x,y,width)
    118.     ecolor = INPTATTRNY::MAP_HUD::COLOR1
    119.     ecolor2 = INPTATTRNY::MAP_HUD::COLOR2
    120.     varer = $game_variables[var_id]
    121.     varer_max = INPTATTRNY::MAP_HUD::VARIABLE_MAX
    122.     draw_gauge(x, y, width, varer, ecolor, ecolor2)
    123.     change_color(system_color)
    124.     draw_text(x, y, 100, line_height, INPTATTRNY::MAP_HUD::VAR_NAME)
    125.     draw_current_and_max_values(x, y, width, varer, varer_max,
    126.      system_color, normal_color)
    127.   end
    128.   #-----------------------------------------------
    129.   # * Draw_exp
    130.   #-----------------------------------------------
    131.   def draw_iaactor_exp(actor, x, y, width = 124)
    132.     nicolor = Color.new(255,238,0,255)
    133.     nicolor2 = Color.new(255,157,0,255)
    134.     next_exp = actor.exp_for_level(@actor.level+1)
    135.     eexp = actor.exp
    136.     draw_gauge(x, y, width, actor.exp, nicolor, nicolor2)
    137.     change_color(system_color)
    138.     draw_text(x, y, 30, line_height, "Exp")
    139.     draw_current_and_max_values(x, y, width, eexp, next_exp,
    140.      mp_color(actor), normal_color)
    141.   end
    142. end
    143. #===============================================================================
    144. class Sprite_Back < Sprite_Base
    145. #===============================================================================
    146.   def initialize(viewport)
    147.     super(viewport)
    148.     update
    149.   end
    150.   def dispose
    151.     bitmap.dispose if bitmap
    152.     super
    153.   end
    154.   def show
    155.     self.visible = true
    156.   end
    157.   def hide
    158.     self.visible = false
    159.   end
    160.   def update
    161.     super
    162.     update_bitmap
    163.     update_origin
    164.     update_bright
    165.   end
    166.   def update_bright
    167.     self.opacity = INPTATTRNY::MAP_HUD::BACK_OPAC
    168.   end
    169.   def update_bitmap
    170.     if INPTATTRNY::MAP_HUD::BACK_GRAPHIC == ""
    171.       self.bitmap = nil
    172.     else
    173.       self.bitmap = Cache.picture(INPTATTRNY::MAP_HUD::BACK_GRAPHIC)
    174.     end
    175.   end
    176.   def update_origin
    177.       self.ox = 0
    178.       self.oy = 0
    179.   end
    180. end
    181. #===============================================================================
    182. class Scene_Map < Scene_Base
    183. #===============================================================================
    184.   alias inpt_hud_allwindow create_all_windows
    185.   def create_all_windows
    186.     create_hud_window
    187.     create_back_sprite
    188.     inpt_hud_allwindow
    189.   end
    190.   def create_back_sprite
    191.     @sprite_back = Sprite_Back.new(@viewport)
    192.   end
    193.    
    194.   def create_hud_window
    195.     @hud_window = Window_IAHUD.new
    196.     @hud_window.viewport = @viewport
    197.   end
    198.   def show_hud
    199.     @hud_window.show
    200.     @sprite_back.show
    201.   end
    202.   def hide_hud
    203.     @hud_window.hide
    204.     @sprite_back.hide
    205.   end
    206. end
    207. #===============================================================================
    208. class Game_Interpreter
    209. #===============================================================================
    210.   def hud(bool=true)
    211.     if bool == true
    212.       SceneManager.scene.show_hud
    213.     else
    214.       SceneManager.scene.hide_hud
    215.     end
    216.   end
    217. end
    复制代码





    Credits

    • Enterbrain
    • IneptAttorney



    本贴来自国际rpgmaker官方论坛作者:IneptAttoney处,因国际论坛即将永久关站,为了存档多年珍贵资料,署名转载到本论坛存档,由于官方帖子为英文原帖,需要中文翻译请点击论坛顶部切换语言为中文就可以将帖子翻译成中文浏览,方便大家随时查看,原文地址:https://forums.rpgmakerweb.com/threads/simple-map-hud-with-variable-gauge.119931/
    天天去同能,天天有童年!
    回复 送礼论坛版权

    使用道具 举报

    文明发言,和谐互动
    文明发言,和谐互动
    高级模式
    您需要登录后才可以回帖 登录 | 立即注册

    本版积分规则

    简体中文
    繁體中文
    English(英语)
    日本語(日语)
    Deutsch(德语)
    Русский язык(俄语)
    بالعربية(阿拉伯语)
    Türkçe(土耳其语)
    Português(葡萄牙语)
    ภาษาไทย(泰国语)
    한어(朝鲜语/韩语)
    Français(法语)
    关闭

    幸运抽奖

    社区每日抽奖来袭,快来试试你是欧皇还是非酋~

    立即查看

    聊天机器人
    Loading...

    QQ|Archiver|手机版|小黑屋|同能RPG制作大师 ( 沪ICP备12027754号-3 )

    GMT+8, 2026-8-17 11:36 , Processed in 0.138750 second(s), 54 queries .

    Powered by Discuz! X3.4

    Copyright © 2001-2020, Tencent Cloud.

    快速回复 返回顶部 返回列表