设为首页收藏本站|繁體中文

Project1

 找回密码
 注册会员
搜索
查看: 1377|回复: 1
打印 上一主题 下一主题

[已经解决] 仿碧轨地图信息显示脚本的刷新问题

[复制链接]

Lv3.寻梦者

梦石
0
星屑
1594
在线时间
715 小时
注册时间
2013-1-26
帖子
101
跳转到指定楼层
1
发表于 2016-2-16 13:02:30 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式

加入我们,或者,欢迎回来。

您需要 登录 才可以下载或查看,没有帐号?注册会员

x
就是那个喜闻乐见的仿碧轨地图血条显示脚本,因为附带了Q键和W键,于是加入了喵呜喵5大大的Q键切换领队脚本,并且由于游戏需要所以我把血条脚本修改了一下,让它只显示领队的信息,也就是把原脚本的76,77行改成了
    actor = $game_party.battle_members[0]
    rect = item_rect(0)
之后问题来了!按下Q键的时候虽然切换了领队,但是地图血条的信息显示没有变啊!必须打开菜单然后关闭菜单才能刷新血条信息!
我的内心是崩溃的……
想了想,大概是地图血条脚本刷新的问题……以下是在原脚本里找到的疑似刷新的部分
  #--------------------------------------------------------------------------
  # ● フレーム更新
  #--------------------------------------------------------------------------
  def update
    super
    if $game_switches[Saba::KisekiStatus::INVISIBLE_SWITCH] == true &&
      ! $game_message.busy? && ! $game_message.visible
      self.visible = true
    else
      self.visible = false
      return
    end
    hps = []
    mps = []
    tps = []
    for actor in $game_party.battle_members
      hps.push(actor.hp_rate)
      mps.push(actor.mp_rate)
      tps.push(actor.tp_rate)
    end

    if @last_hps != hps || @last_mps != mps || @last_tps != tps
      refresh
    end
  end
然而我看不懂脚本不会改啊!!
于是想求助一下各位大大,这该怎么改哦……【土下座
以下是原脚本(未经过改动):
#==============================================================================
# ■ 碧の軌跡っぽいステータス表示
#   @version 0.13 12/01/07
#   @author さば缶
#------------------------------------------------------------------------------
#  マップ画面下にステータスが表示されます
#
#  ■用意するもの
#    Graphics\System の下に Actor_bg1 ~ Actor_bg3
#    Graphics\Faces の下に 顔グラを50%に縮小したファイル "通常のファイル名_s"
#    例 Actor1.png → Actor1_s.png
#    ※このファイルが存在しない場合、プログラムで縮小するため非常に荒くなります
#
#==============================================================================
module Saba
  module KisekiStatus
    # このスイッチがONの場合、ステータスを表示します
    INVISIBLE_SWITCH = 3 #使用开关
   
    # TPを表示する場合、true に設定します。
    SHOW_TP = false
  end
end

class Window_KisekiStatus < Window_Selectable
  #--------------------------------------------------------------------------
  # ● オブジェクト初期化
  #--------------------------------------------------------------------------
  def initialize
    super(0, Graphics.height-window_height+18, Graphics.width, window_height)
    self.opacity = 0
    self.visible = $game_switches[Saba::KisekiStatus::INVISIBLE_SWITCH]
  
    refresh
  end
  def refresh
    @last_hps = []
    @last_mps = []
    @last_tps = []
    super
  end
  #--------------------------------------------------------------------------
  # ● 項目数の取得
  #--------------------------------------------------------------------------
  def item_max
    $game_party.battle_members.size
  end
  #--------------------------------------------------------------------------
  # ● ウィンドウの高さを取得
  #--------------------------------------------------------------------------
  def window_height
    item_height+32
  end
  #--------------------------------------------------------------------------
  # ● 項目の高さを取得
  #--------------------------------------------------------------------------
  def item_height
    52
  end
  #--------------------------------------------------------------------------
  # ● 項目の幅を取得
  #--------------------------------------------------------------------------
  def item_width
    return 70
  end
  #--------------------------------------------------------------------------
  # ● 桁数の取得
  #--------------------------------------------------------------------------
  def col_max
    return $game_party.battle_members.size
  end
  #--------------------------------------------------------------------------
  # ● 項目の描画
  #--------------------------------------------------------------------------
  def draw_item(index)
    actor = $game_party.battle_members[index]
    rect = item_rect(index)
   
    #SR Q-Button
    q_bitmap = Cache.system("Q_button")
    contents.blt(484, 20, q_bitmap, q_bitmap.rect)
   
    #SR M-Button
    w_bitmap = Cache.system("W_button")
    contents.blt(444, 20, w_bitmap, w_bitmap.rect)
   
    bg_bitmap = Cache.system("Actor_bg1")
    contents.blt(rect.x, rect.y, bg_bitmap, bg_bitmap.rect)
   
    small_bitmap = Bitmap.new(48, 48)
    begin
      bitmap = Cache.face(actor.face_name + "_s")
    rescue
    end
    if bitmap == nil
      bitmap = Cache.face(actor.face_name)
      face_rect = Rect.new(actor.face_index % 4 * 96, actor.face_index / 4 * 96, 96, 96)
      small_bitmap.stretch_blt(Rect.new(0, 0, 48, 48), bitmap, face_rect)
    else
      small_bitmap.blt(0, 0, bitmap, Rect.new(actor.face_index % 4 * 48,  actor.face_index / 4 * 48, 48, 48))
    end
    bitmap.dispose
    clear_edge(small_bitmap)
   
    contents.blt(rect.x+2, 2, small_bitmap, Rect.new(0, 0, 48, 48))
    small_bitmap.dispose
   
    if actor.dead?
      bg_bitmap = Cache.system("Actor_bg1")
      contents.blt(rect.x, rect.y, bg_bitmap, bg_bitmap.rect)
      bg_bitmap = Cache.system("Actor_bg3")
    else
      bg_bitmap = Cache.system("Actor_bg2")
    end
    contents.blt(rect.x, rect.y, bg_bitmap, bg_bitmap.rect)
   
    draw_gauge(rect.x + 47, rect.y+20, 50, actor.hp_rate, hp_gauge_color1, hp_gauge_color2)
    draw_gauge(rect.x + 42, rect.y+24, 50, actor.mp_rate, mp_gauge_color1, mp_gauge_color2)
    if Saba::KisekiStatus::SHOW_TP
      draw_gauge(rect.x + 37, rect.y+28, 50, actor.tp_rate, tp_gauge_color1, tp_gauge_color2)
    end
    @last_hps.push(actor.hp_rate)
    @last_mps.push(actor.mp_rate)
    @last_tps.push(actor.tp_rate)
  end
  #--------------------------------------------------------------------------
  # ● 顔画像の端を消します
  #--------------------------------------------------------------------------
  def clear_edge(bitmap)
    22.times  { |i|
      bitmap.clear_rect(0, i, 22 - i, 1)
      bitmap.clear_rect(26 + i, i, 22 - i, 1)
      bitmap.clear_rect(0, i + 26, i, 1)
      bitmap.clear_rect(48 - i, i + 26, i, 1)
    }
  end
  #--------------------------------------------------------------------------
  # ● ゲージの描画
  #     rate   : 割合(1.0 で満タン)
  #     color1 : グラデーション 左端
  #     color2 : グラデーション 右端
  #--------------------------------------------------------------------------
  def draw_gauge(x, y, width, rate, color1, color2)
    fill_w = (width * rate).to_i
    gauge_y = y + line_height - 8
   
    contents.fill_rect(x-2, gauge_y-1, width+4, 4, text_color(15))
    contents.fill_rect(x-1, gauge_y-2, width+2, 6, text_color(15))
    contents.fill_rect(x, gauge_y, width, 2, gauge_back_color)
    contents.gradient_fill_rect(x, gauge_y, fill_w, 2, color1, color2)
  end
  #--------------------------------------------------------------------------
  # ● フレーム更新
  #--------------------------------------------------------------------------
  def update
    super
    if $game_switches[Saba::KisekiStatus::INVISIBLE_SWITCH] == true &&
      ! $game_message.busy? && ! $game_message.visible
      self.visible = true
    else
      self.visible = false
      return
    end
    hps = []
    mps = []
    tps = []
    for actor in $game_party.battle_members
      hps.push(actor.hp_rate)
      mps.push(actor.mp_rate)
      tps.push(actor.tp_rate)
    end

    if @last_hps != hps || @last_mps != mps || @last_tps != tps
      refresh
    end
  end
end

class Scene_Map
  #--------------------------------------------------------------------------
  # ● 全ウィンドウの作成
  #--------------------------------------------------------------------------
  alias saba_kiseki_status_create_all_windows create_all_windows
  def create_all_windows
    saba_kiseki_status_create_all_windows
    @kiseki_status_window = Window_KisekiStatus.new
  end
end

话说论坛的代码框要怎么用……?

Lv4.逐梦者

「Pemercyia」


Urhurrenna

梦石
0
星屑
9335
在线时间
2745 小时
注册时间
2008-9-5
帖子
3540

开拓者短篇八RM组冠军短篇九导演组亚军白银编剧

2
发表于 2016-2-16 14:11:02 | 只看该作者
本帖最后由 cinderelmini 于 2016-2-16 14:12 编辑
  1. class Window_KisekiStatus < Window_Selectable
  2. alias sn_160216_initialize initialize
  3. def initialize
  4. @party_old = $game_party.battle_members
  5. sn_160216_initialize
  6. end

  7. alias sn_160216_update update
  8. def update
  9. sn_160216_update
  10. if @party_old != $game_party.battle_members
  11. refresh
  12. @party_old = $game_party.battle_members
  13. end
  14. end
  15. end
复制代码
放到碧轨地图状态脚本的下面试试看。

点评

哦哦哦哦成功了!谢谢大大!!!  发表于 2016-2-16 14:22

评分

参与人数 1星屑 +15 收起 理由
ylylhl + 15 感谢!!!

查看全部评分

回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 注册会员

本版积分规则

拿上你的纸笔,建造一个属于你的梦想世界,加入吧。
 注册会员
找回密码

站长信箱:[email protected]|手机版|小黑屋|无图版|Project1游戏制作

GMT+8, 2024-4-20 04:18

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

快速回复 返回顶部 返回列表