################## HUD Actor ################
# Auteur : Biward
# Nom du Script : HUD Actor
# Version : 2.0
# Date 19/08/2013 04:03
# Pour : forum Eclipso
# Utilité :
# Permet l'affichage d'un HUD en fonction d'un personnage
module X3
# N° de l'interrupteur qui permet d'afficher le tout !
Int = 100
# Icone de l'argent !
Gold = 205
# Indiquez ici l'opacité des fenêtres
Opacity = 100
# Texte si jamais il n'y a pas d'équipement ------> Pas plus de 5 Lettres !!!" è_é
Noweapon = "Aucune"
end
class Game_Interpreter
def actor_hud(number)
Scene_Map.actor_hud = number
Scene_Map.need_refresh = true
print "o"
end
def enable_gold; Scene_Map.gold = true; Scene_Map.need_refresh = true; end
def disable_gold; Scene_Map.gold = nil; Scene_Map.need_refresh = true; end
def enable_level; Scene_Map.level = true; Scene_Map.need_refresh = true; end
def disable_level; Scene_Map.level = nil; Scene_Map.need_refresh = true; end
def enable_equip; Scene_Map.equip = true; Scene_Map.need_refresh = true; end
def disable_equip; Scene_Map.equip = nil; Scene_Map.need_refresh = true; end
def enable_state; Scene_Map.state = true; Scene_Map.need_refresh = true; end
def disable_state; Scene_Map.state = nil; Scene_Map.need_refresh = true; end
def enable_hud
Scene_Map.gold = true
Scene_Map.equip = true
Scene_Map.level = true
Scene_Map.state = true
Scene_Map.need_refresh = true
end
def disable_hud
Scene_Map.gold = false
Scene_Map.equip = false
Scene_Map.level = false
Scene_Map.state = false
Scene_Map.need_refresh = true
end
end
class Scene_Map
alias add_start start
alias add_terminate terminate
alias add_update update
class << self
attr_accessor :actor_hud, :need_refresh, :gold, :level, :equip, :state
end
def start
add_start
create_map_window if $game_switches[X3::Int] && Scene_Map.actor_hud
end # start
def terminate
add_terminate
dispose_map_window if $game_switches[X3::Int] && Scene_Map.actor_hud
end # terminate
def update
update_map_window if $game_switches[X3::Int] && Scene_Map.actor_hud
refresh_window if Scene_Map.need_refresh
add_update
end #update
def create_map_window
@actor = Scene_Map.actor_hud
if Scene_Map.state && ! @win1
@win1 = State.new(150, 0, 224, 55, @actor)
@win1.z = 0
@win1.opacity = X3::Opacity
end
if Scene_Map.equip && ! @win2
@win2 = Equips.new(374, 0, 170, 55, @actor)
@win2.z = 0
@win2.opacity = X3::Opacity
end
if Scene_Map.gold && ! @win3
@win3 = Gold.new(Graphics.width - 100, Graphics.height - 55, 100, 55)
@win3.z = 0
@win3.opacity = X3::Opacity
end
if Scene_Map.level && ! @win4
@win4 = Level.new(0, 0, 150, 55, @actor)
@win4.z = 0
@win4.opacity = X3::Opacity
end
end
def dispose_map_window
@win4.dispose if @win4
@win3.dispose if @win3
@win2.dispose if @win2
@win1.dispose if @win1
@win1 = nil
@win2 = nil
@win3 = nil
@win4 = nil
end
def update_map_window
create_map_window
@win4.refresh if @win4
@win3.refresh if @win3
@win2.refresh if @win2
@win1.refresh if @win1
end
def refresh_window
if $game_switches[X3::Int] && Scene_Map.actor_hud
dispose_map_window
create_map_window
end
Scene_Map.need_refresh = nil
end
end #Scene_Map
##################################
### WINDOWS
##################################
class State < Window_Base
def initialize(x, y, w, h, actor)
super(x, y, w, h)
@actor = $game_actors[actor]
refresh
end #initialize
def refresh
self.contents.clear
draw_actor_icons(@actor, 0, 0)
end #refresh
end #state
class Equips < Window_Base
def initialize(x, y, w, h, actor)
super(x, y, w, h)
@actor = actor
refresh
end # initialize
def refresh
self.contents.clear
@arme = $game_actors[@actor.to_i].weapons[0].id if $game_actors[@actor.to_i].weapons[0] #ID de l'arme
@icon = 0 if @arme == 0
@name = $data_weapons[@arme.to_i].name if @arme > 0 # nom de l'arme
@icon = $data_weapons[@arme.to_i].icon_index if @arme > 0
@text = X3::Noweapon if @arme == 0
@text = @name.to_s if @arme > 0
self.contents.draw_text(0, -195, 544, 416, @text,0)
draw_icon(@icon, 115, 0)
end # refresh
end #equips
class Gold < Window_Base
def initialize(x, y, w, h)
super(x, y, w, h)
@icone = X3::Gold
refresh
end #initialize
def refresh
self.contents.clear
@gold = $game_party.gold
@text1 = @gold.to_s
self.contents.draw_text(24,-195, 544, 416, @text1, 0)
draw_icon(@icone, 0, 0)
end
end
class Level < Window_Base
def initialize(x, y, w, h, actor)
super(x, y, w, h)
@actor = actor
end
def refresh
self.contents.clear
name = $game_actors[@actor].name
level = $game_actors[@actor].level
act = "#{name.to_s} : #{level.to_s}"
draw_actor_graphic($game_actors[@actor], 16, 32)
self.contents.draw_text(30, -60, 150, 150, act, 0)
end
end