| 
 
| 赞 | 2 |  
| VIP | 0 |  
| 好人卡 | 1 |  
| 积分 | 1 |  
| 经验 | 16088 |  
| 最后登录 | 2023-9-12 |  
| 在线时间 | 596 小时 |  
 Lv1.梦旅人 神仙 
	梦石0 星屑69 在线时间596 小时注册时间2007-5-14帖子1289 | 
| 
本帖最后由 李梦遥 于 2010-8-16 15:17 编辑
x
加入我们,或者,欢迎回来。您需要 登录 才可以下载或查看,没有帐号?注册会员  
 这个脚本是在地图上直接显示血条和法条的。但是当有4个角色进来的时候,血法条旁边的人物框全部是一样的。。都是角色1的样子。能不能修改成当角色ID4或ID5,进入队伍时,则显示bar4或bar5,我好直接修改图片的样式。而角色ID1便是bar1 同理
 复制代码class Game_Actor < Game_Battler
  def now_exp
    return @exp - @exp_list[@level]
  end
  def next_exp
    return @exp_list[@level+1] > 0 ? @exp_list[@level+1] - @exp_list[@level] : 0
  end
end
class Sprite_Bar < Sprite
  def initialize(v,actor)
    super(v)
    self.bitmap = RPG::Cache.picture("bar")
    self.visible = false
    @actor = actor
    refresh
  end
  def refresh
    self.bitmap.clear
    self.bitmap.dispose
    self.bitmap = nil
    bar = RPG::Cache.picture("bar")
    self.bitmap = bar.dup
    bitmap = RPG::Cache.picture("血法条/01001")
    hp_w = @actor.hp * bitmap.width / @actor.maxhp
    rect = Rect.new(0, 0, hp_w,bitmap.height)
    self.bitmap.blt(48, 16, bitmap, rect)
    
    bitmap = RPG::Cache.picture("血法条/01002")
    hp_w = @actor.sp * bitmap.width / @actor.maxsp
    rect = Rect.new(0, 0, hp_w,bitmap.height)
    self.bitmap.blt(48, 29, bitmap, rect)
    
    bitmap = RPG::Cache.picture("血法条/01003")
    if @actor.next_exp == 0
      hp_w = @actor.now_exp
    else
      hp_w = @actor.now_exp * bitmap.width / @actor.next_exp
    end
    rect = Rect.new(0, 0, hp_w,bitmap.height)
    self.bitmap.blt(48, 3, bitmap, rect)
    
    # 3 16 29
    
    @hp = @actor.hp
    @sp = @actor.sp
    @exp = @actor.now_exp
  end
  def update
    super
    self.visible = $game_switches[999]
    return unless self.visible
    refresh if @hp != @actor.hp || @sp != @actor.sp || @exp != @actor.now_exp
  end
end
class Scene_Map
  alias new_main main unless method_defined?("new_main")
  alias new_update update unless method_defined?("new_update")
  def main
    @bar = []
    @vie = []
    for actor in $game_party.actors
      v = Viewport.new(640-((actor.index+1) * 129), 0, 129, 45)
      v.z += 1000
      @bar.push(Sprite_Bar.new(v, actor))
      @vie.push(v)
    end
    new_main
    @bar.each{|bar|bar.dispose}
    @vie.each{|vie|vie.dispose}
  end
  def update
    @bar.each{|bar|bar.update}
    new_update
  end
end
 | 
 |