查看: 1807|回复: 1

[已经过期] 发一个修改过的地图显示领队状态的脚本

[复制链接]
梦石
0
星屑
50
在线时间
18 小时
注册时间
2015-12-25
回帖
23
发表于 2016-3-27 16:38:16 | 显示全部楼层 |阅读模式

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

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

×
这是945窗口教程进行修改之后的脚本,增加了按F6打开关闭状态栏的功能。不过我是要请教一下,如何在状态栏开闭渐变过程中,角色依旧可以行走。求高手解答。


[pre lang="ruby"]
#==============================================================================
# ■ Class_Actor
#==============================================================================
class Game_Actor < Game_Battler

  alias moming_refresh refresh
  alias moming_tp tp=
  alias moming_add_state add_state
  #--------------------------------------------------------------------------
  # ● 刷新
  #--------------------------------------------------------------------------
  def refresh
    moming_refresh
    $refresh = true
  end
  #----------------------------------------------------------------------------
  # ● 更改 TP
  #----------------------------------------------------------------------------
  def tp=(tp)
    moming_tp(tp)
    $refresh = true
  end
  #----------------------------------------------------------------------------
  # ● 附加状态
  #----------------------------------------------------------------------------
  def add_state(state_id)
    moming_add_state(state_id)
    $refresh = true
  end
end

#==============================================================================
# ■ Game_Party
#==============================================================================
class Game_Party
  
  alias moming_swap_order swap_order
  #----------------------------------------------------------------------------
  # ● 交换顺序
  #----------------------------------------------------------------------------
  def swap_order(index1, index2)
    moming_swap_order(index1, index2)
    $refresh = true
  end
end
#==============================================================================
# ■ Window_MapStatus
#==============================================================================
class Window_MapStatus < Window_Base
  #----------------------------------------------------------------------------
  # ● 初始化
  #----------------------------------------------------------------------------
   def initialize
    super(0, 0, 273, 144)
    self.opacity = 0
    refresh
  end
  
  #----------------------------------------------------------------------------
  # ● 刷新画面
  #----------------------------------------------------------------------------
  def update
    super
   
    refresh if $refresh
    $refresh = false
    if contents_opacity != 0
      if $game_player.screen_x >= 0 and $game_player.screen_x <= self.width and
       $game_player.screen_y >= 0 and $game_player.screen_y <= self.height
      self.contents_opacity = 75
      else self.contents_opacity = 255
      end
    end
  end
  #----------------------------------------------------------------------------
  # ● 更新内容
  #----------------------------------------------------------------------------
  def refresh
    contents.clear
    draw_actor_face($game_party.members[0], 0, 0)
    contents.draw_text(0,0,contents.width,24,$game_party.members[0].name,2)
    draw_actor_level($game_party.members[0], 101, 0)
    draw_actor_icons($game_party.members[0], 0, 72)
    draw_actor_hp($game_party.members[0], 101, 24, self.contents.width - 101)
    draw_actor_mp($game_party.members[0], 101, 48, self.contents.width - 101)
    draw_actor_tp($game_party.members[0], 101, 72, self.contents.width - 101)
    draw_actor_exp($game_party.members[0], 0, 96, self.contents.width)
  end
  #----------------------------------------------------------------------------
  # ● 描绘EXP槽
  #----------------------------------------------------------------------------
  def draw_actor_exp(actor, x, y, width=124)
    rate = actor.exp.to_f / actor.next_level_exp.to_f
    draw_gauge(x, y, width, rate, Color.new(0, 255, 0), Color.new(100, 255, 100))
    self.contents.font.color = text_color(16)
    self.contents.draw_text(x, y, 56, 24, "EXP")
    self.contents.font.color = Color.new(255, 255, 255)
    en = "#{actor.exp}/#{actor.next_level_exp}"
    self.contents.draw_text(x, y, width, 24, en, 2)
  end
  #----------------------------------------------------------------------------
  # ● 描绘值槽
  #----------------------------------------------------------------------------
  def draw_gauge(x, y, width, rate, color1, color2)
    fill_w = (width * rate).to_i
    self.contents.gradient_fill_rect(x, y+12, fill_w, 6, color1, color2, true)
    self.contents.gradient_fill_rect(x, y+18, fill_w, 6, color2, color1, true)
    self.contents.fill_rect(x, y+12, width, 1, Color.new(255, 255, 255))
    self.contents.fill_rect(x, y+22, width, 1, Color.new(255, 255, 255))
    self.contents.fill_rect(x, y+14, 1, 8, Color.new(255, 255, 255))
    self.contents.fill_rect(x+width-2, y+14, 1, 8, Color.new(255, 255, 255))
  end
end

#==============================================================================
# ■ Scene_Map
#==============================================================================


class Scene_Map < Scene_Base
  #----------------------------------------------------------------------------
  # ● 重命名方法
  #----------------------------------------------------------------------------
  alias moming_sta start
  alias moming_update update
  #----------------------------------------------------------------------------
  # ● 开始处理
  #----------------------------------------------------------------------------
  def start
    moming_sta
    @mapstatus_window = Window_MapStatus.new
  end
  #----------------------------------------------------------------------------
  # ● 更新处理
  #----------------------------------------------------------------------------
  def update
    moming_update
    ms_update_input
  end
  #----------------------------------------------------------------------------
  # ● 按键检测
  #----------------------------------------------------------------------------  
  def ms_update_input
    if Input.trigger?(:F6)
      if @mapstatus_window.contents_opacity != 0
        gra_close
      else
        gra_open
      end
    end
  end
  #----------------------------------------------------------------------------
  # ● 定义窗口淡入、淡出
  #----------------------------------------------------------------------------  
  def gra_close
    60.times do |i|
      @mapstatus_window.contents_opacity -= 4.25
      Graphics.update
      
    end
  end
  
  def gra_open
    60.times do |i|
      @mapstatus_window.contents_opacity += 4.25
      Graphics.update
    end
  end
   
end
#转自945窗口脚本教程,并稍作修改。
  
  


   
   
   
   
   
   
    [/pre]
梦石
0
星屑
50
在线时间
18 小时
注册时间
2015-12-25
回帖
23
 楼主| 发表于 2016-3-28 22:01:30 来自手机 | 显示全部楼层
这就沉了?咋没人愿意试试呢?
回复

使用道具 举报

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

本版积分规则

Powered by Discuz! X5.0 © 2001-2026 Discuz! Team.

在本版发帖返回顶部