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

[转载发布] HP Color Controller Script

[复制链接]
累计送礼:
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-1 21:41:33 | 显示全部楼层 |阅读模式

    HP Color Controller Script
    by AceOfAces_Mod
    Version R1.02 (26/4/2018)


    This script expands the customization by adding additional HP bar colors and one additional HP text color to the engine. This allows the developer to change the color depending on the actor's remaining HP.

    Features:


    • Easy to use and configure.
    • Compatibility mode for use with scripts that have their own HP color (Normal only).
    Screenshots:






    Demo:
        Pretty self-explanatory. No demo needed.

    How to Use:
    Place this script under Materials but above main. If you use a script to change the colors, place this script under that too.
    After installation, adjust the settings to your liking.

    Compatibility:
    Compatible with most scripts. Some gauge scripts that fundamentally change how the bars are drawn (such as the Luna Engine) will render this script not working (your game will still work).

    Script:

    Spoiler                Code:       
    1. #------------------------------------------------------------------------------
    2. # HP Color Controller - Version R1.02
    3. # Developed by AceOfAces
    4. # Licensed under GPLv3 license
    5. #------------------------------------------------------------------------------
    6. #------------------------------------------------------------------------------
    7. # This script provides additional hp gauge and text colors similar to the
    8. # Pokemon series.
    9. #------------------------------------------------------------------------------
    10. #------------------------------------------------------------------------------
    11. # Installation:
    12. # Place this script below ▼ Materials but above Main.
    13. # If you use a script that modifies the colors on the Window_Base, place this
    14. # script below it for maximum compatibility.
    15. #------------------------------------------------------------------------------
    16. module FSE
    17.    module HPCONTROL
    18. #------------------------------------------------------------------------------
    19. # Config
    20. #------------------------------------------------------------------------------
    21. # This option is used for compatibiity mode. Turn this on if you adjust
    22. # :hp_gauge1, :hp_gauge2, and :crisis_color from a different script
    23. # (Yanfly Ace Engine for example). This will ignore :hp_crisis, :hpgaugenomal
    24. # (1 and 2) and :hp_ko on the color settings.
    25. COMPAT_MODE = false
    26. # This option enables the extra "Warning" color.
    27. WARN_COLOR = false
    28. # Adjust the low hp and critical hp limits here. These will be used to check
    29. # when to change colours, depending on the remaining hp
    30. LOW_HP = 0.3
    31. CRIT_HP = 0.15
    32. WARN_HP = 0.5
    33. # Adjust the colours here. If you have enabled the compatibility mode, adjust
    34. # :hp_low, :hpgauge_low1, hp_gaugelow2, hp_gaugecri1 and hp_gaugecrit2.
    35.    COLOURS ={
    36.     # :text       => ID (found on the Window.png file)
    37.       :warn_hp_text       => 17,  # Default: 17
    38.       :low_hp_text        =>  2,  # Default:  2
    39.       :hp_crisis          => 18,  # Default: 18
    40.       :hp_ko              => 15,  # Default: 15
    41.       :hp_gaugenormal1    => 11,  # Default: 11
    42.       :hp_gaugenormal2    =>  3,  # Default:  3
    43.       :hp_gaugewarn1      => 17,  # Default: 17
    44.       :hp_gaugewarn2      =>  6,  # Default:  6
    45.       :hp_gaugelow1       => 20,  # Default: 20
    46.       :hp_gaugelow2       => 21,  # Default:  6
    47.       :hp_gaugecri1       => 18,  # Default: 18
    48.       :hp_gaugecri2       =>  2,  # Default:  2
    49.       } #Leave this bracket alone.
    50. #
    51. #
    52. end
    53. end
    54. #------------------------------------------------------------------------------
    55. # WARNING! DO NOT EDIT ANYTHING BEYOND THIS POINT IF YOU DON'T KNOW WHAT ARE
    56. # YOU DOING! Editing beyond this point may render your game innoperable.
    57. #------------------------------------------------------------------------------
    58. class Window_Base < Window
    59. #------------------------------------------------------------------------------
    60. # Adding new colors
    61. #------------------------------------------------------------------------------
    62.   def hp_crisis_color;   text_color(FSE::HPCONTROL::COLOURS[:hp_crisis]); end;
    63.   def hp_low_color;      text_color(FSE::HPCONTROL::COLOURS[:low_hp_text]); end;
    64.   def hp_warn_color;     text_color(FSE::HPCONTROL::COLOURS[:warn_hp_text]); end;
    65.   def hp_knockout;       text_color(FSE::HPCONTROL::COLOURS[:hp_ko]); end;
    66.   def hp_gaugenormal1;   text_color(FSE::HPCONTROL::COLOURS[:hp_gaugenormal1]); end;
    67.   def hp_gaugenormal2;   text_color(FSE::HPCONTROL::COLOURS[:hp_gaugenormal2]); end;
    68.   def hp_gauge_warn1;    text_color(FSE::HPCONTROL::COLOURS[:hp_gaugewarn1]); end;
    69.   def hp_gauge_warn2;    text_color(FSE::HPCONTROL::COLOURS[:hp_gaugewarn2]); end;
    70.   def hp_gauge_low1;     text_color(FSE::HPCONTROL::COLOURS[:hp_gaugelow1]); end;
    71.   def hp_gauge_low2;     text_color(FSE::HPCONTROL::COLOURS[:hp_gaugelow2]); end;
    72.   def hp_gauge_crit1;    text_color(FSE::HPCONTROL::COLOURS[:hp_gaugecri1]); end;
    73.   def hp_gauge_crit2;    text_color(FSE::HPCONTROL::COLOURS[:hp_gaugecri2]); end;
    74. #------------------------------------------------------------------------------
    75. # Introduce a new method: hpbar_color1
    76. #------------------------------------------------------------------------------
    77.   def hpbar_color1(actor)
    78.     return hp_gauge_crit1 if actor.hp < actor.mhp * FSE::HPCONTROL::CRIT_HP
    79.     return hp_gauge_low1 if actor.hp > actor.mhp * FSE::HPCONTROL::CRIT_HP && actor.hp < actor.mhp * FSE::HPCONTROL::LOW_HP
    80.     return hp_gauge_warn1 if FSE::HPCONTROL::WARN_COLOR == true && (actor.hp > actor.mhp * FSE::HPCONTROL::LOW_HP && actor.hp < actor.mhp * FSE::HPCONTROL::WARN_HP)
    81.     return hp_gauge_color1 if FSE::HPCONTROL::COMPAT_MODE != false
    82.     return hp_gaugenormal1
    83.   end
    84. #--------------------------------------------------------------------------
    85. # Introduce a new method: hpbar_color2
    86. #--------------------------------------------------------------------------
    87.   def hpbar_color2(actor)
    88.     return hp_gauge_crit2 if actor.hp < actor.mhp * FSE::HPCONTROL::CRIT_HP
    89.     return hp_gauge_low2 if actor.hp > actor.mhp * FSE::HPCONTROL::CRIT_HP && actor.hp < actor.mhp * FSE::HPCONTROL::LOW_HP
    90.     return hp_warn_color if FSE::HPCONTROL::WARN_COLOR == true && (actor.hp > actor.mhp * FSE::HPCONTROL::LOW_HP && actor.hp < actor.mhp * FSE::HPCONTROL::WARN_HP)
    91.     return hp_gauge_color2 if FSE::HPCONTROL::COMPAT_MODE != false
    92.     return hp_gaugenormal2
    93.   end
    94. #--------------------------------------------------------------------------
    95. # Overwrites hp_color
    96. #--------------------------------------------------------------------------
    97.   def hp_color(actor)
    98.     return hp_knockout if actor.hp ==0
    99.     return knockout_color if actor.hp == 0 && FSE::HPCONTROL::COMPAT_MODE
    100.     return hp_crisis_color if (actor.hp < actor.mhp * FSE::HPCONTROL::CRIT_HP)
    101.     return crisis_color if (actor.hp < actor.mhp * FSE::HPCONTROL::CRIT_HP) && FSE::HPCONTROL::COMPAT_MODE
    102.     return hp_low_color if actor.hp > actor.mhp * FSE::HPCONTROL::CRIT_HP && actor.hp < actor.mhp * FSE::HPCONTROL::LOW_HP
    103.     return hp_gauge_warn1 if FSE::HPCONTROL::WARN_COLOR == true && (actor.hp > actor.mhp * FSE::HPCONTROL::LOW_HP && actor.hp < actor.mhp * FSE::HPCONTROL::WARN_HP)
    104.     return normal_color
    105.   end
    106. #-----------------------------------------------------------------------------
    107. # Overwrites draw_actor_hp
    108. #-----------------------------------------------------------------------------
    109.   def draw_actor_hp(actor, dx, dy, width = 124)
    110.     draw_gauge(dx, dy, width, actor.hp_rate, hpbar_color1(actor), hpbar_color2(actor))
    111.     change_color(system_color)
    112.     cy = (Font.default_size - contents.font.size) / 2 + 1
    113.     draw_text(dx+2, dy+cy, 30, line_height, Vocab::hp_a)
    114.     draw_current_and_max_values(dx, dy+cy, width, actor.hp, actor.mhp,
    115.       hp_color(actor), normal_color)
    116.     end
    117.   end
    118. #-------------------------------------------------------------------------------
    119. # Doing  some overwrites on the Window_BattleStatus
    120. #-------------------------------------------------------------------------------
    121.   class Window_BattleStatus < Window_Selectable
    122. #-----------------------------------------------------------------------------
    123. # Overwrites draw_actor_hp
    124. #-----------------------------------------------------------------------------
    125.   def draw_actor_hp(actor, dx, dy, width = 124)
    126.     draw_gauge(dx, dy, width, actor.hp_rate, hpbar_color1(actor), hpbar_color2(actor))
    127.     change_color(system_color)
    128.     cy = (Font.default_size - contents.font.size) / 2 + 1
    129.     draw_text(dx+2, dy+cy, 30, line_height, Vocab::hp_a)
    130.     draw_current_and_max_values(dx, dy+cy, width, actor.hp, actor.mhp,
    131.       hp_color(actor), normal_color)
    132.      end
    133.    end
    复制代码






    Credits:
        AceOfAces_Mod

    Misc:
    Full plugin documentation here (covers technical info as well).
    You can post issues with the plugin here or on Github.


    Changelog:
    R1.02:
    -Added an extra color (currently called "Warning" color).
        R1.01:
    -Added the knockout color setting.
        R1.00:
    -Initial release.​




    本贴来自国际rpgmaker官方论坛作者:AceOfAces处,因国际论坛即将永久关站,为了存档多年珍贵资料,署名转载到本论坛存档,由于官方帖子为英文原帖,需要中文翻译请点击论坛顶部切换语言为中文就可以将帖子翻译成中文浏览,方便大家随时查看,原文地址:https://forums.rpgmakerweb.com/threads/hp-color-controller-script.72119/

    本帖子中包含更多资源

    您需要 登录 才可以下载或查看,没有账号?立即注册

    x
    天天去同能,天天有童年!
    回复 送礼论坛版权

    使用道具 举报

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

    本版积分规则

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

    幸运抽奖

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

    立即查看

    聊天机器人
    Loading...

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

    GMT+8, 2026-8-17 13:37 , Processed in 0.137442 second(s), 53 queries .

    Powered by Discuz! X3.4

    Copyright © 2001-2020, Tencent Cloud.

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