l0rdph0enix
Member
Ok so I found this script at CA
D&D Currencies
and I would like to be able to use it with LegACy's 1-scene CMS Alternative
along with using it with this Hud I have.
Thanks in advance.
D&D Currencies
and I would like to be able to use it with LegACy's 1-scene CMS Alternative
along with using it with this Hud I have.
Code:
#===============================================================================
# ** L0rdph0enix_SettingsHUD
#===============================================================================
module L0rdph0enix_SettingsHUD
#-----------------------------------------------------------------------------
# * Switch ID : The ID of the switch that activates the hud.
#-----------------------------------------------------------------------------
SwitchID = 2
#-----------------------------------------------------------------------------
# * Corner : Corner is found represented to the numpad key coordinates
#-----------------------------------------------------------------------------
Corner = 3
#-----------------------------------------------------------------------------
# * Bar Width
#-----------------------------------------------------------------------------
Bar_Width = 112
#-----------------------------------------------------------------------------
# * Icon_HP : The icon representing player's HP
#-----------------------------------------------------------------------------
Icon_HP = 'heart'
#-----------------------------------------------------------------------------
# * Icon_HP : The icon representing player's SP
#-----------------------------------------------------------------------------
Icon_SP = 'mana'
#-----------------------------------------------------------------------------
# * Icon_HP : The icon representing player's Gold
#-----------------------------------------------------------------------------
Icon_Gold = 'gold'
#-----------------------------------------------------------------------------
# * HP Color 1 : Start Color of HP Bar
#-----------------------------------------------------------------------------
HP_Color1 = Color.new(150, 0, 0, 255)
#-----------------------------------------------------------------------------
# * HP Color 2 : End Color of HP Bar
#-----------------------------------------------------------------------------
HP_Color2 = Color.new(255, 255, 60, 255)
#-----------------------------------------------------------------------------
# * SP Color 1 : Start Color of SP Bar
#-----------------------------------------------------------------------------
SP_Color1 = Color.new(0, 0, 150, 255)
#-----------------------------------------------------------------------------
# * SP Color 2 : End Color of SP Bar
#-----------------------------------------------------------------------------
SP_Color2 = Color.new(60, 255, 255, 255)
#-----------------------------------------------------------------------------
# * Text Font : Font name used for HUD Window text
#-----------------------------------------------------------------------------
Text_Font = 'Black'
#-----------------------------------------------------------------------------
# * Text Size : Font size used for HUD Window text
#-----------------------------------------------------------------------------
Text_Size = 16
#-----------------------------------------------------------------------------
# * Opacity : Opacity to set the hud
#-----------------------------------------------------------------------------
Opacity = 160
#-----------------------------------------------------------------------------
# * Zoom : The Z priority of the HUD window comparised to map objects
#-----------------------------------------------------------------------------
Zoom = 8000
end
#===============================================================================
# * Window_Base
#===============================================================================
class Window_Base < Window
#-----------------------------------------------------------------------------
# * Draw Icon
#-----------------------------------------------------------------------------
def draw_icon(filename, x, y, enabled = true)
begin ; bitmap = RPG::Cache.icon(filename)
rescue ; bitmap = Bitmap.new(24, 24)
end
rect = Rect.new(0, 0, bitmap.width, bitmap.height)
self.contents.blt(x, y, bitmap, rect, enabled ? 255 : 128)
end
#-----------------------------------------------------------------------------
# * Draw Slant Bar
#-----------------------------------------------------------------------------
def draw_slant_bar(x, y, min, max, color1 = nil, color2 = nil, w = 152, h = 10)
color1 = color1.nil? ? default_color_1 : color1
color2 = color2.nil? ? default_color_2 : color2
# Draw Border
rect = Rect.new(x + 10, y, w - 10, h)
self.contents.fill_rect(rect, Color.new(50, 50, 50, 255))
# Draw Background
self.contents.gradient_fill_rect(Rect.new(x, y, w+10, h), Color.new(0,0,0),
Color.new(128, 128, 128), true)
# Draw Bar
for i in 1..((min / max.to_f) * (w-1))
for j in 1..(h - 1)
r = color1.red * (w - i) / w + color2.red * i / w
g = color1.green * (w - i) / w + color2.green * i / w
b = color1.blue * (w - i) / w + color2.blue * i / w
a = color1.alpha * (w - i) / w + color2.alpha * i / w
self.contents.fill_rect((x+i+j), (y+h-j), 1, 1, Color.new(r, g, b, a))
end
end
end
end
#===============================================================================
# * L0rdph0enix_HUD
#===============================================================================
class L0rdph0enix_HUD < Window_Base
#-----------------------------------------------------------------------------
# * Included Modules
#-----------------------------------------------------------------------------
include L0rdph0enix_SettingsHUD
#-----------------------------------------------------------------------------
# * Object Initialization
#-----------------------------------------------------------------------------
def initialize
super(0, 0, 176, Bar_Width)
self.contents = Bitmap.new(140,80)
self.contents.font.name = Text_Font
self.contents.font.size = Text_Size
self.back_opacity = Opacity
self.z = Zoom
self.position(-Corner)
update
end
#-----------------------------------------------------------------------------
# * Refresh HP
#-----------------------------------------------------------------------------
def refresh_hp
self.contents.clear_rect(4, 8, self.width, 25)
@hp = @actor.hp
c1, c2 = HP_Color1, HP_Color2
draw_slant_bar(4, 12, @actor.hp, @actor.maxhp, c1, c2, self.width - 48)
draw_icon(Icon_HP, 0, 0)
draw_actor_hp(@actor, 4, 4)
end
#-----------------------------------------------------------------------------
# * Refresh SP
#-----------------------------------------------------------------------------
def refresh_sp
self.contents.clear_rect(4, 34, self.width, 25)
@sp = @actor.sp
c1, c2 = SP_Color1, SP_Color2
draw_slant_bar(4, 38, @actor.sp, @actor.maxsp, c1, c2, self.width - 48)
draw_icon(Icon_SP, 0, 24)
draw_actor_sp(@actor, 4, 28)
end
#-----------------------------------------------------------------------------
# * Refresh Gold
#-----------------------------------------------------------------------------
def refresh_gold
self.contents.clear_rect(4, 58, self.width, 25)
@gold = $game_party.gold
self.contents.draw_text(4, 64, 132, 20, $game_party.gold.to_s, 2)
draw_icon(Icon_Gold, 4, 58)
end
#-----------------------------------------------------------------------------
# * Update
#-----------------------------------------------------------------------------
def update
super
if $game_switches[SwitchID]
self.position(Corner)
else
self.position(-Corner)
end
@actor = $game_party.actors[0] if @actor != $game_party.actors[0]
refresh_hp if @hp != @actor.hp
refresh_sp if @sp != @actor.sp
refresh_gold if @gold != $game_party.gold
end
end
#===============================================================================
# ** Scene_Map
#===============================================================================
class Scene_Map
#-----------------------------------------------------------------------------
# * Alias Listings
#-----------------------------------------------------------------------------
alias_method :l0rdph0enix_hud_main, :main
alias_method :l0rdph0enix_hud_update, :update
#-----------------------------------------------------------------------------
# * Main Processing
#-----------------------------------------------------------------------------
def main
@hud = L0rdph0enix_HUD.new
l0rdph0enix_hud_main
@hud.dispose
end
#-----------------------------------------------------------------------------
# * Update
#-----------------------------------------------------------------------------
def update
@hud.update
l0rdph0enix_hud_update
end
end
Thanks in advance.