RadethDart
Sponsor
Could someone here please tell me how I can display the party leader's weapon name and icon? Like, I need the syntax to be able to display them.
weapon = $data_weapons[$game_party.actors[0].weapon_id]
return if weapon.nil?
weapon_name = weapon.name
weapon_icon = RPG::Cache.icon(weapon.icon_name)#Bitmap.new('Graphics/Icons/' + weapon.icon_name)
self.contents.blt(x, y, weapon_icon, weapon_icon.rect)
self.contents.draw_text(x + 26, y, width - (32 + 26), 32, weapon_name)
#-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:
# Shifter HUD
# v 1.0
# Author - Joshua Long
# This HUD is made for Shifter.
#-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:
class Scene_Map
alias jlhud_main main
alias jlhud_update update
def main
@jlhud = Window_hud.new
jlhud_main
@jlhud.dispose
end
def update
@jlhud.update
jlhud_update
end
end
class Window_hud < Window_Base
def initialize
super(-10, -10, 650, 650)
self.contents = Bitmap.new(width - 32, height - 32)
self.contents.font.name = "Arial"
self.contents.font.size = 16
self.back_opacity = 0
refresh
end
def refresh
self.contents.clear
reset_variables
return if !@actor
draw_actor_graphic(@actor, 590, 58)
draw_bar(0, 450, @actor.sp, @actor.maxsp, 90, 8, Color.new(88, 200, 244, 255), Color.new(0, 56, 200, 255))
self.contents.draw_text(0, 420, 120, 32, "Stamina")
draw_actor_name(@actor, 578, -10.5)
self.contents.draw_text(20, 0, 100, 32, "Strength: " +$game_party.actors[0].str.to_s)
self.contents.draw_text(20, 14, 100, 32, "Agility: " +$game_party.actors[0].agi.to_s)
self.contents.draw_text(20, 26, 100, 32, "Intelligence: " +$game_party.actors[0].int.to_s)
self.contents.draw_text(20, 38, 100, 32, "Dexterity: " +$game_party.actors[0].dex.to_s)
end
def reset_variables
@actor = $game_party.actors[0]
@oldsp = @actor ? @actor.sp : 0
@oldmaxsp = @actor ? @actor.maxsp : 0
@str = @actor ? @actor.str : 0
@agi = @actor ? @actor.agi : 0
@int = @actor ? @actor.int : 0
@eva = @actor ? @actor.dex : 0
end
def update
super
actor = $game_party.actors[0]
refresh if actor != @actor ||
@oldsp != actor.sp ||
@oldmaxsp != actor.maxsp ||
@str != actor.str ||
@agi != actor.agi ||
@int != actor.int ||
@eva != actor.dex
end
end
#================================================= =============================
# ** Window_Base
#------------------------------------------------------------------------------
# This class is for all in-game windows.
#================================================= =============================
class Window_Base < Window
#--------------------------------------------------------------------------
# * Draw Slant Bar
#--------------------------------------------------------------------------
def draw_bar(x, y, min, max, width = 152, height = 6,
bar_color = Color.new(150, 0, 0, 255), end_color = Color.new(255, 255, 60, 255))
# Draw Border
for i in 0..height
self.contents.fill_rect(x, y + height - i, width, 1, Color.new(50, 50, 50, 255))
end
# Draw Background
for i in 1..(height - 1)
r = 100 * (height - i) / height + 0 * i / height
g = 100 * (height - i) / height + 0 * i / height
b = 100 * (height - i) / height + 0 * i / height
a = 255 * (height - i) / height + 255 * i / height
self.contents.fill_rect(x, y + height - i, width, 1, Color.new(r, b, g, a))
end
# Draws Bar
for i in 1..( (min / max.to_f) * width - 1)
for j in 1..(height - 1)
r = bar_color.red * (width - i) / width + end_color.red * i / width
g = bar_color.green * (width - i) / width + end_color.green * i / width
b = bar_color.blue * (width - i) / width + end_color.blue * i / width
a = bar_color.alpha * (width - i) / width + end_color.alpha * i / width
self.contents.fill_rect(x + i - 1, y + height - j, 1, 1, Color.new(r, g, b, a))
end
end
end
end
weapon = $data_weapons[$game_party.actors[0].weapon_id]
weapon_name = weapon.name
weapon_icon = RPG::Cache.icon(weapon.icon_name)
self.contents.blt(0, 72, weapon_icon, weapon_icon.rect)
self.contents.draw_text(26, 72, 120, 32, weapon_name)
def initialize
super(0, 0, 200, 200)
self.contents = Bitmap.new(width - 32, height - 32)
self.contents.font.name = "Arial"
self.contents.font.size = 15
self.back_opacity = 0
self.opacity = 0 # I don't want to see a border.
refresh
end
weapon = $data_weapons[$game_party.actors[0].weapon_id]
unless weapon.nil?
weapon_name = weapon.name
weapon_icon = RPG::Cache.icon(weapon.icon_name)
self.contents.blt(0, 72, weapon_icon, weapon_icon.rect)
self.contents.draw_text(26, 72, 120, 32, weapon_name)
end
def update
refresh if something_changed?
end
end
#--------------------------------------------------------------------------
# * Something Changed?
#--------------------------------------------------------------------------
def something_changed?
return false if Graphics.frame_count % 30 != 0
return true if @actor != $game_party.actors[0]
return true if @old_sp != @actor.sp
return true if @str != actor.str
return true if @agi != actor.agi
return true if @gold_n != $game_party.gold
return true if @int != actor.int
return true if @dex != actor.dex
return true if $kts != nil and @time != $kts.time.to_s
return true if $kts == nil and @time != game_time
return false
end