Le deal à ne pas rater :
Manga Chainsaw Man : où acheter le Tome 17 édition Collector de ...
19.99 €
Voir le deal

Aller en bas
Naru'
Naru'
Membre

Nombre de messages : 97
Age : 28
Localisation : Dans le nord
Distinction : Voleur de nounours rose
[Coco']
Date d'inscription : 08/03/2009

Adapter ces script s'il vous plaît... Empty Adapter ces script s'il vous plaît...

Sam 11 Juil 2009 - 22:04
Bonjour, voici deux scripts de l'ABS de Vlad.
Le premier permet l'affichage de differentes barres sur la Map.
Le second permet que les héros se suivent avec leurbarre de vie affichée et que l'on puisse changer de héros avec TAB.
Je voudrais que vous adaptiez ces scripts pour qu'ils marchent sans l'ABS, et j voudrais aussi que la touche pour changer de héros soit "S" (donc "Y") au lieu de TAB.
Merci.
Code:
#==============================================================================
# Requiem HP Bars
#==============================================================================
#------------------------------------------------------------------------------
if Requiem_Masterpiece.enabled?("Requiem ABS", 7.0)
#------------------------------------------------------------------------------
Requiem_Masterpiece.register("Requiem HP Bars", 1.0, "06/07/2009")
#------------------------------------------------------------------------------
class Requiem_EnemyHPBars < Sprite
 
  def initialize(enemy, viewport)
    super(viewport)
    @enemy = enemy
    @old_x = 0
    @old_y = 0
    @old_hp = @enemy.actor.hp
    self.bitmap = Bitmap.new(45, 8)
    update
  end
 
  def update
    super
    return unless something_changed?
    @old_x = self.x = @enemy.screen_x-(self.bitmap.width/2)
    @old_y = self.y = @enemy.screen_y
    @old_hp = @enemy.actor.hp
    self.bitmap.clear
    meter = (self.bitmap.width-2) * @enemy.actor.hp / @enemy.actor.maxhp
    self.bitmap.fill_rect(0, 0, self.bitmap.width, self.bitmap.height, Color.new(0,0,0))
    self.bitmap.gradient_fill_rect(1, 2, meter, (self.bitmap.height-4)/2, Color.new(255,160,160), Color.new(224,0,0))
    self.bitmap.gradient_fill_rect(1, 2+((self.bitmap.height-4)/2), meter, (self.bitmap.height-4)/2, Color.new(224,64,64), Color.new(96,0,0))
  end
 
  def dispose
    super
    self.bitmap.dispose
  end
 
  def something_changed?
    return true if @old_x != @enemy.screen_x-(self.bitmap.width/2)
    return true if @old_y != @enemy.screen_y
    return true if @old_hp != @enemy.actor.hp
    return false
  end
 
end

#------------------------------------------------------------------------------
class Requiem_AlliesHPBars < Sprite
 
  attr_reader :ally
 
  def initialize(ally, viewport)
    super(viewport)
    @ally = ally
    @old_x = 0
    @old_y = 0
    @old_hp = @ally.actor.hp
    self.bitmap = Bitmap.new(45, 8)
    update
  end
 
  def update
    super
    return unless something_changed?
    @old_x = self.x = @ally.screen_x-(self.bitmap.width/2)
    @old_y = self.y = @ally.screen_y
    @old_hp = @ally.actor.hp
    self.bitmap.clear
    meter = (self.bitmap.width-2) * @ally.actor.hp / @ally.actor.maxhp
    self.bitmap.fill_rect(0, 0, self.bitmap.width, self.bitmap.height, Color.new(0,0,0))
    self.bitmap.gradient_fill_rect(1, 2, meter, (self.bitmap.height-4)/2, Color.new(145,190,240), Color.new(0,125,185))
    self.bitmap.gradient_fill_rect(1, 2+((self.bitmap.height-4)/2), meter, (self.bitmap.height-4)/2, Color.new(100,150,200), Color.new(0,65,145))
  end
 
  def dispose
    super
    self.bitmap.dispose
  end
 
  def something_changed?
    return true if @old_x != @ally.screen_x-(self.bitmap.width/2)
    return true if @old_y != @ally.screen_y
    return true if @old_hp != @ally.actor.hp
    return false
  end
 
end

#------------------------------------------------------------------------------
class Requiem_BossHPBar < Sprite
 
  def initialize(event, viewport)
    super(viewport)
    @enemy = event
    @hp = @enemy.actor.hp
    @base = Cache.system("Boss Base")
    @bar = Cache.system("Boss Bar")
    self.bitmap = Bitmap.new(@base.width, @base.height)
    self.x = (544 - self.bitmap.width) / 2
    self.y = 416 - self.bitmap.height - 64
    update
  end
 
  def update
    super
    return if @hp == @enemy.actor.hp
    @hp = @enemy.actor.hp
    self.bitmap.clear
    self.bitmap.blt(0, 0, @base, @base.rect)
    meter = Rect.new(0, 0, @base.width * @enemy.actor.hp / @enemy.actor.maxhp, @base.height)
    self.bitmap.blt(0, 0, @bar, meter)
  end
 
  def dispose
    super
    self.bitmap.dispose
  end
 
end

#------------------------------------------------------------------------------
class Scene_Map < Scene_Base
 
  alias requiem_abs_enemyhp_smap_start start
  alias requiem_abs_enemyhp_smap_update update
  alias requiem_abs_enemyhp_smap_terminate terminate
  alias requiem_abs_enemyhp_smap_update_transfer_player update_transfer_player
  alias requiem_abs_enemyhp_smap_refresh_sprites refresh_sprites
 
  def start
    @monsters_hp_bars ={}
    @enemies_hp_bars = {}
    @allies_hp_bars = {}
    requiem_abs_enemyhp_smap_start
  end
 
  def update
    requiem_abs_enemyhp_smap_update
    update_monsters_hp_bars
    update_enemies_hp_bars
    update_allies_hp_bars
  end
 
  def terminate
    requiem_abs_enemyhp_smap_terminate
    dispose_bars
  end
 
  def update_transfer_player
    dispose_bars if $game_player.transfer?
    requiem_abs_enemyhp_smap_update_transfer_player
  end
 
  def update_enemies_hp_bars
    for event in $game_map.events.values
      next unless event.in_battle
      if event.boss
        if @boss_hud.nil? and !event.actor.dead?
          @boss_hud = Requiem_BossHPBar.new(event, @spriteset.viewport3)
        elsif @boss_hud != nil and !event.actor.dead?
          @boss_hud.update
        elsif @boss_hud != nil and event.actor.dead?
          @boss_hud.dispose
          @boss_hud = nil
        end
      else
        if $game_player.in_range?($game_player, event, 3) and @enemies_hp_bars[event.id].nil? and !event.actor.dead?
          next if event.object or event.puzzle
          @enemies_hp_bars[event.id] = Requiem_EnemyHPBars.new(event, @spriteset.viewport3)
        elsif $game_player.in_range?($game_player, event, 3) and @enemies_hp_bars[event.id] != nil and !event.actor.dead?
          @enemies_hp_bars[event.id].update
        elsif @enemies_hp_bars[event.id] != nil
          @enemies_hp_bars[event.id].dispose
          @enemies_hp_bars[event.id] = nil
        end
      end
    end
  end
 
  def update_monsters_hp_bars
    for monster in $game_monsters
      next if monster.nil?
      if $game_player.in_range?($game_player, monster, 3) and @monsters_hp_bars[monster.id].nil? and !monster.actor.dead?
        @monsters_hp_bars[monster.id] = Requiem_EnemyHPBars.new(monster, @spriteset.viewport3)
      elsif $game_player.in_range?($game_player, monster, 3) and @monsters_hp_bars[monster.id] != nil and !monster.actor.dead?
        @monsters_hp_bars[monster.id].update
      elsif @monsters_hp_bars[monster.id] != nil
        @monsters_hp_bars[monster.id].dispose
        @monsters_hp_bars[monster.id] = nil
      end
    end
  end
 
  def update_allies_hp_bars
    for ally in $game_allies
      next if ally.nil?
      next if ally.map_id != $game_map.map_id
      if $game_player.in_range?($game_player, ally, 3) and @allies_hp_bars[ally.id].nil? and !ally.actor.dead? and !$game_player.in_vehicle?
        @allies_hp_bars[ally.id] = Requiem_AlliesHPBars.new(ally, @spriteset.viewport3)
      elsif $game_player.in_range?($game_player, ally, 3) and @allies_hp_bars[ally.id] != nil and !ally.actor.dead? and !$game_player.in_vehicle?
        @allies_hp_bars[ally.id].update
      elsif @allies_hp_bars[ally.id] != nil
        @allies_hp_bars[ally.id].dispose
        @allies_hp_bars[ally.id] = nil
      end
    end
  end
 
  def refresh_sprites
    requiem_abs_enemyhp_smap_refresh_sprites
    dispose_bars
  end
 
  def dispose_bars
    if @boss_hud != nil
      @boss_hud.dispose
      @boss_hud = nil
    end
    for bar in @monsters_hp_bars.values
      next if bar.nil?
      bar.dispose
    end
    @monsters_hp_bars.clear
    for bar in @enemies_hp_bars.values
      next if bar.nil?
      bar.dispose
    end
    @enemies_hp_bars.clear
    for bar in @allies_hp_bars.values
      next if bar.nil?
      bar.dispose
    end
    @allies_hp_bars.clear
  end
 
end
#------------------------------------------------------------------------------
end
Code:
#==============================================================================
# Requiem Group Command
#==============================================================================
#------------------------------------------------------------------------------
if Requiem_Masterpiece.enabled?("Requiem ABS", 7.0)
#------------------------------------------------------------------------------
Requiem_Masterpiece.register("Requiem Group Command", 1.0, "06/07/2009")
#------------------------------------------------------------------------------
class Window_RequiemGroupCommand < Window_Base
 
  def initialize
    super(220, 356, 80, 80)
    self.visible = self.active = false
    self.opacity = self.contents_opacity = 0
    refresh
  end
 
  def refresh
    self.contents.clear
    bitmap = Cache.system("Face_Base")
    self.contents.blt(0, 0, bitmap, bitmap.rect)
    return if $game_party.members.size <= 1 or $game_allies.empty?
    draw_actor_head($game_party.members[$ally_index], 4, 8, enabled?)
  end
 
  def enabled?
    return false if $game_party.members[$ally_index].dead?
    return false if $game_party.members[$ally_index].piece.map_id != $game_map.map_id
    return true
  end
 
end

#------------------------------------------------------------------------------
class Window_RequiemGroupActions < Window_Base
 
  def initialize
    super(260, 356, 80, 80)
    self.visible = self.active = false
    self.opacity = self.contents_opacity = 0
    refresh
  end
 
  def refresh
    self.contents.clear
    bitmap = Cache.system("Face_Base")
    self.contents.blt(0, 0, bitmap, bitmap.rect)
    return if $game_party.members.size <= 1 or $game_allies.empty?
    case $game_allies[$ally_index].command
    when 0
      draw_icon(2, 8, 8, enabled?)
    when 1
      draw_icon(119,8, 8, enabled?)
    when 2
      draw_icon(52, 8, 8, enabled?)
    when 3
      draw_icon(128, 8, 8, enabled?)
    end
  end
 
  def enabled?
    return false if $game_party.members[$ally_index].dead?
    return false if $game_party.members[$ally_index].piece.map_id != $game_map.map_id
    return true
  end
 
end

#------------------------------------------------------------------------------
class Scene_Map < Scene_Base
 
  alias requiem_group_command_start start
  alias requiem_group_command_update update
  alias requiem_group_command_terminate terminate
 
  def start
    requiem_group_command_start
    $ally_index = 1
    @group_window = Window_RequiemGroupCommand.new
    @group_action = Window_RequiemGroupActions.new
  end
 
  def update
    requiem_group_command_update
    return if $game_allies.empty?
    call_control_allies_window
  end
 
  def terminate
    requiem_group_command_terminate
    @group_window.dispose
    @group_action.dispose
  end
 
  def call_control_allies_window
    return if $game_party.members.size <= 1 or $game_allies.empty?
    if Input.press?(Input::Ctrl)
      @group_window.refresh unless @group_window.active
      @group_action.refresh unless @group_action.active
      @group_window.visible = @group_window.active = true
      @group_action.visible = @group_action.active = true
      @group_window.contents_opacity += 5
      @group_action.contents_opacity += 5
      update_allies_window
      update_allies_actions
    else
      @group_window.contents_opacity -= 5 if @group_window.contents_opacity > 0
      @group_action.contents_opacity -= 5 if @group_action.contents_opacity > 0
      @group_window.visible = @group_window.active = false if @group_window.contents_opacity <= 0
      @group_action.visible = @group_action.active = false if @group_action.contents_opacity <= 0
    end
  end
 
  def update_allies_window
    if Input.trigger?(Input::C) and @group_window.active
      if $ally_index < ($game_party.members.size-1)
        $ally_index += 1
      else
        $ally_index = 1
      end
      @group_window.refresh
      @group_action.refresh
    end
  end
 
  def update_allies_actions
    if Input.trigger?(Input::Tab) and @group_action.active
      return unless enabled?
      if $game_allies[$ally_index].command < 3
        $game_allies[$ally_index].command += 1
      else
        $game_allies[$ally_index].command = 0
      end
      @group_window.refresh
      @group_action.refresh
    end
  end
 
  def enabled?
    return false if $game_party.members[$ally_index].dead?
    return false if $game_party.members[$ally_index].piece.map_id != $game_map.map_id
    return true
  end
 
end
#------------------------------------------------------------------------------
end
Revenir en haut
Permission de ce forum:
Vous ne pouvez pas répondre aux sujets dans ce forum