累计送礼: 0 个 累计收礼: 1 个 TA的每日心情 开心 2026-7-12 04:10
签到天数: 209 天
连续签到: 2 天
[LV.7]常住居民III
管理员
VIP
7
卡币
58883
OK点
16
推广点
0
同能卷
50
积分 68848
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:
#------------------------------------------------------------------------------ # HP Color Controller - Version R1.02 # Developed by AceOfAces # Licensed under GPLv3 license #------------------------------------------------------------------------------ #------------------------------------------------------------------------------ # This script provides additional hp gauge and text colors similar to the # Pokemon series. #------------------------------------------------------------------------------ #------------------------------------------------------------------------------ # Installation: # Place this script below ▼ Materials but above Main. # If you use a script that modifies the colors on the Window_Base, place this # script below it for maximum compatibility. #------------------------------------------------------------------------------ module FSE module HPCONTROL #------------------------------------------------------------------------------ # Config #------------------------------------------------------------------------------ # This option is used for compatibiity mode. Turn this on if you adjust # :hp_gauge1, :hp_gauge2, and :crisis_color from a different script # (Yanfly Ace Engine for example). This will ignore :hp_crisis, :hpgaugenomal # (1 and 2) and :hp_ko on the color settings. COMPAT_MODE = false # This option enables the extra "Warning" color. WARN_COLOR = false # Adjust the low hp and critical hp limits here. These will be used to check # when to change colours, depending on the remaining hp LOW_HP = 0.3 CRIT_HP = 0.15 WARN_HP = 0.5 # Adjust the colours here. If you have enabled the compatibility mode, adjust # :hp_low, :hpgauge_low1, hp_gaugelow2, hp_gaugecri1 and hp_gaugecrit2. COLOURS ={ # :text => ID (found on the Window.png file) :warn_hp_text => 17, # Default: 17 :low_hp_text => 2, # Default: 2 :hp_crisis => 18, # Default: 18 :hp_ko => 15, # Default: 15 :hp_gaugenormal1 => 11, # Default: 11 :hp_gaugenormal2 => 3, # Default: 3 :hp_gaugewarn1 => 17, # Default: 17 :hp_gaugewarn2 => 6, # Default: 6 :hp_gaugelow1 => 20, # Default: 20 :hp_gaugelow2 => 21, # Default: 6 :hp_gaugecri1 => 18, # Default: 18 :hp_gaugecri2 => 2, # Default: 2 } #Leave this bracket alone. # # end end #------------------------------------------------------------------------------ # WARNING! DO NOT EDIT ANYTHING BEYOND THIS POINT IF YOU DON'T KNOW WHAT ARE # YOU DOING! Editing beyond this point may render your game innoperable. #------------------------------------------------------------------------------ class Window_Base < Window #------------------------------------------------------------------------------ # Adding new colors #------------------------------------------------------------------------------ def hp_crisis_color; text_color(FSE::HPCONTROL::COLOURS[:hp_crisis]); end; def hp_low_color; text_color(FSE::HPCONTROL::COLOURS[:low_hp_text]); end; def hp_warn_color; text_color(FSE::HPCONTROL::COLOURS[:warn_hp_text]); end; def hp_knockout; text_color(FSE::HPCONTROL::COLOURS[:hp_ko]); end; def hp_gaugenormal1; text_color(FSE::HPCONTROL::COLOURS[:hp_gaugenormal1]); end; def hp_gaugenormal2; text_color(FSE::HPCONTROL::COLOURS[:hp_gaugenormal2]); end; def hp_gauge_warn1; text_color(FSE::HPCONTROL::COLOURS[:hp_gaugewarn1]); end; def hp_gauge_warn2; text_color(FSE::HPCONTROL::COLOURS[:hp_gaugewarn2]); end; def hp_gauge_low1; text_color(FSE::HPCONTROL::COLOURS[:hp_gaugelow1]); end; def hp_gauge_low2; text_color(FSE::HPCONTROL::COLOURS[:hp_gaugelow2]); end; def hp_gauge_crit1; text_color(FSE::HPCONTROL::COLOURS[:hp_gaugecri1]); end; def hp_gauge_crit2; text_color(FSE::HPCONTROL::COLOURS[:hp_gaugecri2]); end; #------------------------------------------------------------------------------ # Introduce a new method: hpbar_color1 #------------------------------------------------------------------------------ def hpbar_color1(actor) return hp_gauge_crit1 if actor.hp < actor.mhp * FSE::HPCONTROL::CRIT_HP return hp_gauge_low1 if actor.hp > actor.mhp * FSE::HPCONTROL::CRIT_HP && actor.hp < actor.mhp * FSE::HPCONTROL::LOW_HP 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) return hp_gauge_color1 if FSE::HPCONTROL::COMPAT_MODE != false return hp_gaugenormal1 end #-------------------------------------------------------------------------- # Introduce a new method: hpbar_color2 #-------------------------------------------------------------------------- def hpbar_color2(actor) return hp_gauge_crit2 if actor.hp < actor.mhp * FSE::HPCONTROL::CRIT_HP return hp_gauge_low2 if actor.hp > actor.mhp * FSE::HPCONTROL::CRIT_HP && actor.hp < actor.mhp * FSE::HPCONTROL::LOW_HP 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) return hp_gauge_color2 if FSE::HPCONTROL::COMPAT_MODE != false return hp_gaugenormal2 end #-------------------------------------------------------------------------- # Overwrites hp_color #-------------------------------------------------------------------------- def hp_color(actor) return hp_knockout if actor.hp ==0 return knockout_color if actor.hp == 0 && FSE::HPCONTROL::COMPAT_MODE return hp_crisis_color if (actor.hp < actor.mhp * FSE::HPCONTROL::CRIT_HP) return crisis_color if (actor.hp < actor.mhp * FSE::HPCONTROL::CRIT_HP) && FSE::HPCONTROL::COMPAT_MODE return hp_low_color if actor.hp > actor.mhp * FSE::HPCONTROL::CRIT_HP && actor.hp < actor.mhp * FSE::HPCONTROL::LOW_HP 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) return normal_color end #----------------------------------------------------------------------------- # Overwrites draw_actor_hp #----------------------------------------------------------------------------- def draw_actor_hp(actor, dx, dy, width = 124) draw_gauge(dx, dy, width, actor.hp_rate, hpbar_color1(actor), hpbar_color2(actor)) change_color(system_color) cy = (Font.default_size - contents.font.size) / 2 + 1 draw_text(dx+2, dy+cy, 30, line_height, Vocab::hp_a) draw_current_and_max_values(dx, dy+cy, width, actor.hp, actor.mhp, hp_color(actor), normal_color) end end #------------------------------------------------------------------------------- # Doing some overwrites on the Window_BattleStatus #------------------------------------------------------------------------------- class Window_BattleStatus < Window_Selectable #----------------------------------------------------------------------------- # Overwrites draw_actor_hp #----------------------------------------------------------------------------- def draw_actor_hp(actor, dx, dy, width = 124) draw_gauge(dx, dy, width, actor.hp_rate, hpbar_color1(actor), hpbar_color2(actor)) change_color(system_color) cy = (Font.default_size - contents.font.size) / 2 + 1 draw_text(dx+2, dy+cy, 30, line_height, Vocab::hp_a) draw_current_and_max_values(dx, dy+cy, width, actor.hp, actor.mhp, hp_color(actor), normal_color) end 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