Cerca nel Forum
Showing results for tags 'HUD su Mappa'.
Trovato 1 risultato
-
Nome Script: HUD su Mappa Versione: N/D Autore/i: Jet Informazioni: HUD che inserisce barre HP, MP etc, e da la possibilità di inserire anche picture extra nel caso voleste aggiungere altro su mappa. Screenshots: Istruzioni: Inserite lo script sotto Material. Nella demo comunque sono presenti (oltre che allo script) istruzioni e immagini necessarie per il corretto funzionamento dell'HUD. Script: #=============================================================================== # HUD # By Jet10985 (Jet) #=============================================================================== # This script will allow you to have a fully customizable hud displaying # multiple pictures and actor-related information. # This script has: 7 customization options. #=============================================================================== # Overwritten Methods: # None #------------------------------------------------------------------------------- # Aliased methods: # Spriteset_Map: initialize, update, dispose #=============================================================================== =begin Note: all pictures used in this HUD must be in the Graphics/Pictures folder. =end module Jet module HUD # These are the bars of the HUD. These takes highest display priority of # the entire hud. It follows this format: # :stat => ["Background", "Bar Image", "Overlay", x, y, switch] # Bars have 3 layers, drawn in this order: background, bar, overlay. # If you don't need one of these layers, leave the configuration as a "", # EX: :hp => ["Bar Back", "Hp Bar", "", 0, 10, 0] # switch is the visibility switch for the bar. 0 for none. BARS = { :hp => ["Bar Back", "HP Bar", "HP Overlay", 0, 10, 0], :mp => ["Bar Back", "MP Bar", "MP Overlay", 0, 40, 0], :tp => ["Bar Back", "TP Bar", "TP Overlay", 0, 70, 0] } # These are extra parts of the HUD which relate to the 1st actor. This # takes middle display priority in the HUD. Follow's this format: # :symbol => [x, y] # :symbol can be any of the following: # :graphic (Character Sprite) # :face (Character Face) # :name (Character name) # :class (Character class) # :nickname (Character nickname) # :level (Character Level) # :icons (Character buffs and states represented by icons) # :hp (Character hp in text along with default gauge) # :mp (Character mp in text along with default gauge) # :tp (Character tp in text along with default gauge) ACTOR_EXTRAS = { :face => [544 - 96, 0] } # This is the font used for the extra's sprite if text is drawn. ACTOR_EXTRAS_FONT = "Verdana" # This is the switch to make the extra's layer invisible ACTOR_EXTRAS_SWITCH = 0 # These are pictures displayed with the HUD. These take the lowest display # priority of the 3 sections. Follow this format: # "Picture Name" => [x, y, switch] # switch is the visiblility switch for this specific picture. PICTURES = { "Bar Back" => [250, 250, 0] } # Turning this switch on will make the entire HUD invisible. FULL_HUD_SWITCH = 1 # Do you want the HUD to follow any map shaking/scrolling/tinting? FOLLOW_MAP = true end end #=============================================================================== # DON'T EDIT FURTHER UNLESS YOU KNOW WHAT TO DO. #=============================================================================== ($imported ||= {})[:jet] ||= {} $imported[:jet][:HUD] = true class Spriteset_Map alias jet4856_initialize initialize def initialize(*args, &block) create_hud jet4856_initialize(*args, &block) @hudset.viewport = Jet::HUD::FOLLOW_MAP ? @viewport1 : nil end def create_hud @hudset = Spriteset_HUD.new end alias jet3745_update update def update(*args, &block) jet3745_update(*args, &block) update_hud end def update_hud if [email protected]? @hudset.visible = !$game_switches[Jet] @hudset.update end end alias jet7355_dispose dispose def dispose(*args, &block) dispose_hud jet7355_dispose(*args, &block) end def dispose_hud @hudset.dispose end end class Spriteset_HUD attr_reader :sprites, :actor attr_accessor :viewport def initialize(viewport = nil) @sprites = {} @actor = $game_party.members[0] @actor_extras = !Jet::HUD::ACTOR_EXTRAS.empty? if @actor_extras @actor_struct = Struct.new(*Jet::HUD::ACTOR_EXTRAS.keys).new Jet::HUD::ACTOR_EXTRAS.each_key {|a| @actor_struct.send("#{a}=".to_sym, (@actor.send(a) rescue true)) } end @viewport = viewport create_bars create_actor_extras if @actor_extras create_pictures @visible = 0 self.visible = !$game_switches[Jet] update end def create_bars @sprites[:bars] = {} Jet::HUD::BARS.each {|a, b| @sprites[:bars][a] = [] b[0..2].each {|c| if c == "" @sprites[:bars][a].push(Sprite.new) next end bitmap = Cache.picture(c) sprite = b.index(c) == 1 ? Sprite_Bar.new(@actor, a) : Sprite.new sprite.bitmap = bitmap sprite.x = b[3] sprite.y = b[4] @sprites[:bars][a].push(sprite) sprite.z = 1002 } } end def create_actor_extras f = Window_Base.new(0, 0, 32, 32) x = 0 - f.padding; y = 0 - f.padding width = Graphics.width + f.padding * 2 height = Graphics.height + f.padding * 2 f.dispose @sprites[:extras] = Window_Base.new(x, y, width, height) @sprites[:extras].opacity = 0 @sprites[:extras].contents.font.name = Jet::HUD::ACTOR_EXTRAS_FONT @sprites[:extras].z = 1001 Jet::HUD::ACTOR_EXTRAS.each {|a, b| @sprites[:extras].send("draw_actor_#{a}", @actor, b[0], b[1]) } end def create_pictures @sprites[:pictures] = {} Jet::HUD::PICTURES.each {|a, b| bitmap = Cache.picture(a) sprite = Sprite.new(nil) sprite.bitmap = bitmap sprite.x, sprite.y = *b[0...2] @sprites[:pictures][a] = sprite sprite.z = 1000 } end def update if @actor != $game_party.members[0] @actor = $game_party.members[0] dispose_actor_extras create_actor_extras dispose_bars create_bars end if @actor_extras do_refresh = false Jet::HUD::ACTOR_EXTRAS.each_key {|a| if @actor_struct.send(a) != (@actor.send(a) rescue true) do_refresh = true @actor_struct.send("#{a}=".to_sym, (@actor.send(a) rescue true)) end } if do_refresh dispose_actor_extras create_actor_extras end end return if !@visible update_bars update_actor_extras if @actor_extras update_pictures end def update_bars @sprites[:bars].each {|sym, a| a.each {|b| b.visible = !$game_switches[Jet][5]] b.update if b.visible b.viewport = @viewport } } end def update_actor_extras @sprites[:extras].visible = !$game_switches[Jet] @sprites[:extras].viewport = @viewport end def update_pictures @sprites[:pictures].each {|string, a| a.visible = !$game_switches[Jet][2]] a.viewport = @viewport } end def update_visibility @sprites[:pictures].each {|string, a| a.visible = @visible } @sprites[:extras].visible = @visible if @actor_extras @sprites[:bars].each {|sym, a| a.each {|b| b.visible = @visible } } end def dispose dispose_bars dispose_actor_extras if @actor_extras dispose_pictures end def dispose_bars @sprites[:bars].each_value {|a| a.each {|b| b.dispose } } end def dispose_actor_extras @sprites[:extras].dispose end def dispose_pictures @sprites[:pictures].each_value {|a| a.dispose } end def visible=(t) if @visible != t @visible = t update_visibility end end end class Sprite_Bar < Sprite def initialize(actor, type) super(nil) @actor = actor @type = type end def update begin max = @actor.send(("m" + @type.to_s).to_sym) rescue max = @actor.send(("max_" + @type.to_s).to_sym) end cur = @actor.send(@type) self.src_rect.width = (self.bitmap.width * (cur / max.to_f)).round end end Demo:http://dl.dropbox.com/u/35988679/HUD%20Demo.exe