Partagez
Aller en bas
leothegeek
leothegeek
Membre

Nombre de messages : 72
Localisation : Station de recherche Olduvai...
Distinction : aucune
Date d'inscription : 15/09/2010

Modification du script Vampyr SBABS Empty Modification du script Vampyr SBABS

le Dim 23 Juin 2013 - 19:20
Bonjour !
Voulant faire un jeu de tir en A-RPG, je suis tombé sur un os : Comment modifier le script Vampyr SBABS pour qu'à la place de m'afficher une barre de PM, il m'affiche une variable du jeu au choix ? 
Je voudrai que le script m'affiche une barre correspondant au nombre de munitions restantes (la variable 1 par exemple) , en dessous de la barre des PV.

Je joins la page du script en question, en espérant que c'est celui-ci qui doit être modifié..

Il s'agit du script "Bloody HUD"
Code:
#==============================================================================
# Vampyr HUD
#==============================================================================
# Switch ID that show or hide the HUD
OnOff_Switch = 1

# Text displayed on skills window
Skills_Text = "Objets"

# Text displayed on items window
Items_Text = "Munitions"

# Text displayed on ammunitions window
Ammo_Text = "Armes"

# The name of the font
Font_Name = Font.default_name

# The size of the font
Font_Size = 16

#------------------------------------------------------------------------------
if Vampyr_Kernel.enabled?("Vampyr SBABS")
#------------------------------------------------------------------------------
Vampyr_Kernel.register("Vampyr HUD", 1.0, "09/01/2009")
#------------------------------------------------------------------------------
class Vampyr_HUD1 < Window_Base
 
  def initialize
    super(-32, -32, 224, 140)
    self.opacity = 0
    @actor = $game_party.members[0]
    @old_hp = @actor.hp if @actor != nil
    @old_mp = @actor.mp if @actor != nil
    update
    refresh
  end
 
  def update
    return if $game_party.members.size <= 0
    @actor = $game_party.members[0] if @actor != $game_party.members[0]
    return unless @old_hp != @actor.hp or @old_mp != @actor.mp or @old_exp != @actor.exp
    @old_hp = @actor.hp
    @old_mp = @actor.mp
    refresh
  end
 
  def refresh
    return if $game_party.members.size <= 0
    self.contents.clear
    draw_hpbar(@actor, 42, 16)
    draw_mpbar(@actor, 42, 38)
    self.contents.font.name = Font_Name
    self.contents.font.size = Font_Size
    self.contents.draw_outlined_text(18, 14, 24, 24, Vocab::hp_a)
    self.contents.draw_outlined_text(18, 36, 24, 24, Vocab::mp_a)
  end
 
  def draw_hpbar(actor, x, y)
    base = Cache.system("Base")
    self.contents.blt(x, y, base, base.rect)
    bar = Cache.system("HP Bar")
    meter = Rect.new(0, 0, base.width * actor.hp / actor.maxhp, base.height)
    self.contents.blt(x, y, bar, meter)
  end 
 
  def draw_mpbar(actor, x, y)
    base = Cache.system("Base")
    self.contents.blt(x, y, base, base.rect)
    bar = Cache.system("MP Bar")
    meter = Rect.new(0, 0, base.width * actor.mp / actor.maxmp, base.height)
    self.contents.blt(x, y, bar, meter)
  end
 
  def draw_expbar(actor, x, y)
    base = Cache.system("Base")
    self.contents.blt(x, y, base, base.rect)
    bar = Cache.system("Exp Bar")
    meter = Rect.new(0, 0, base.width * actor.current_exp / actor.next_exp, base.height)
    self.contents.blt(x, y, bar, meter)
  end
 
end

#------------------------------------------------------------------------------
class Vampyr_HUD2 < Window_Base
 
  def initialize
    super(-32, -32, 608, 480)
    self.opacity = 0
    @actor  = $game_party.members[0]
    @skills = (@actor.nil? ? nil : @actor.skill_hotkeys.values)
    @items  = (@actor.nil? ? nil : @actor.item_hotkeys.values)
    refresh
  end
 
  def update
    return if $game_party.members.size <= 0
    refresh if something_changed?
  end
 
  def something_changed?
    return true if @actor != $game_party.members[0]
    return true if @actor != nil and @skills != @actor.skill_hotkeys.values
    return true if @actor != nil and @items  != @actor.item_hotkeys.values
    return false
  end
 
  def refresh
    return if $game_party.members.size <= 0
    @actor = $game_party.members[0]
    @skills = @actor.skill_hotkeys.values
    @items = @actor.item_hotkeys.values
    self.contents.clear
    self.contents.font.name = Font_Name
    self.contents.font.size = Font_Size
    bitmap = Cache.system("HUD")
    rect = Rect.new(0, 0, 544, 416)
    self.contents.blt(16, 16, bitmap, rect)
    draw_items(466, 8)
    draw_ammo(16, 384)
    draw_skills(402, 384)
  end
 
  def draw_items(x, y)
    count = 0
    @actor.item_hotkeys.each { |key, value|
    next if value.nil?
    item = $data_items[value]
    next if item.nil?
    draw_icon(item.icon_index, x+(32*count), y+18)
    self.contents.draw_outlined_text((32*count)+x+5, y+28, 64, 24, Keys.name(key))
    count += 1
    }
    self.contents.draw_outlined_text(x, y, 96, WLH, Items_Text, 1)
  end
 
  def draw_skills(x, y)
    count = 0
    @actor.skill_hotkeys.each { |key, value|
    next if value.nil?
    skill = $data_skills[value]
    next if skill.nil?
    draw_icon(skill.icon_index, x+(32*count), y+18)
    self.contents.draw_outlined_text(x+(32*count)+7, y+28, 64, 24, Keys.name(key))
    count += 1
    }
    self.contents.draw_outlined_text(x, y, 32*@actor.skill_hotkeys.values.size, WLH, Skills_Text, 1)
  end
 
  def draw_ammo(x, y)
    if @actor.weapons[0] != nil and @actor.weapons[0].ranged?
      if @actor.weapons[0].ammo1 != nil
        draw_icon(@actor.equips[0].ammo1.icon_index, x+4, y+18) if @actor.equips[0].ammo1 != nil
      end
      if @actor.weapons[0].ammo2 != nil
        draw_icon(@actor.equips[0].ammo2.icon_index, x+36, y+18) if @actor.equips[0].ammo2 != nil
      end
      self.contents.draw_outlined_text(x, y+28, 32, WLH, Keys.name($Vampyr_SBABS.attack_key1), 1)
      self.contents.draw_outlined_text(x+32, y+28, 32, WLH, Keys.name($Vampyr_SBABS.attack_key2), 1)
    end
    self.contents.draw_outlined_text(x, y, 64, WLH, Ammo_Text, 1)
  end
 
end

#------------------------------------------------------------------------------
class Scene_Map < Scene_Base
 
  alias vampyr_hud_start start
  alias vampyr_hud_update update
  alias vampyr_hud_terminate terminate
 
  def start
    vampyr_hud_start
    @hud_window1 = Vampyr_HUD1.new
    @hud_window2 = Vampyr_HUD2.new
    @hud_window1.visible = false
    @hud_window2.visible = false
    showing_hud
  end
 
  def update
    vampyr_hud_update
    showing_hud
    @hud_window1.update if @hud_window1.visible
    @hud_window2.update if @hud_window2.visible
  end
 
  def terminate
    vampyr_hud_terminate
    @hud_window1.dispose
    @hud_window2.dispose
  end
 
  def showing_hud
    if OnOff_Switch <= 0 or $game_switches[OnOff_Switch]
      @hud_window1.visible = true
      @hud_window2.visible = true
    else
      @hud_window1.visible = false
      @hud_window2.visible = false
    end
  end

end
#------------------------------------------------------------------------------
end


Merci d'avance pour votre aide, cela me rendrai grandement service Very Happy
Revenir en haut
Permission de ce forum:
Vous ne pouvez pas répondre aux sujets dans ce forum