查看: 2056|回复: 1

[已经解决] 这个物品详细说明脚本如何让他在战斗中也能显示?

[复制链接]
梦石
0
星屑
1581
在线时间
253 小时
注册时间
2019-4-11
回帖
32
发表于 2021-7-22 02:28:23 | 显示全部楼层 |阅读模式

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

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

×
[pre lang="ruby"]#===============================================================================
#物品界面、技能界面按SHIFT打开介绍窗口
#2019/1/14   By:真·可乐
#===============================================================================

module ZCL_Detail_Set
  #窗口的皮肤名称
  WINDOWSKILL = "Window"
  #窗口的宽度
  WWIDTH = Graphics.width / 2.3
  #窗口的高度
  WHEIGHT = Graphics.height / 1.5
  #窗口物品名称栏的背景色,最后一项是不透明度,填成0的话就没颜色了
  ITEMNAMEBACKCOLOR = [0,255,0,100]
  #禁用设定 , 1 为禁用 物品界面细明窗口 ,2 为禁用 技能界面细明窗口 , 3 为全部禁用
  DISABLE = 0
end


module RPG
  class BaseItem
    def detail
      /\[de\](.*)\[ta\]/ =~ self.note
      return ($1.is_a?(String) ? $1 : "")
    end
  end
end

class Window_Detail < Window_Base
  attr_accessor           :item
  include ZCL_Detail_Set
  def initialize(y)
    super(x = 0,y,WWIDTH,WHEIGHT)
    self.windowskin = Cache.system(WINDOWSKILL)
    @item = nil
  end
  
  def refresh
    self.contents.clear
    return self.hide if @item.nil?
    co = ITEMNAMEBACKCOLOR
    contents.fill_rect(0,0,self.width,32,Color.new(co[0],co[1],co[2],co[3]))
    text = @item.detail.gsub("\\n"){"\n"}
    draw_item_name(@item,0,2,true);draw_text_ex(0,36,text)
  end
  
  def item=(titem)
    @item = titem
    self.refresh
  end
end

class Scene_ItemBase
  attr_reader   :detail_window
  alias startzcl2019114 start
  def start
    startzcl2019114;create_detail_window
  end
  
  def create_detail_window
    @detail_window = Window_Detail.new(0)
   
    @detail_window.hide
  end
   alias updatezcl2019114 update
  def update
    updatezcl2019114
    update_detail
  end
  
  def update_detail
  return @detail_window.hide unless @item_window.active
    if Input.trigger?(Input::A)
      return if self.is_a?(Scene_Item) && ZCL_Detail_Set::DISABLE == 1
      return if self.is_a?(Scene_Skill) && ZCL_Detail_Set::DISABLE == 2
      return unless ZCL_Detail_Set::DISABLE.between?(0,2)
      refresh_detail_window;end
    @detail_window.hide if Input.trigger?(:UP) || Input.trigger?(:DOWN) ||
       Input.trigger?(:LEFT) || Input.trigger?(:RIGHT)
   end
   
   def refresh_detail_window
    if @item_window.item.nil?
      @detail_window.hide
      return Sound.play_buzzer
    end
     @detail_window.y = @item_window.y
     @detail_window.z = @item_window.z + 100
     @detail_window.height =  [Graphics.height - @detail_window.y , ZCL_Detail_Set::WHEIGHT ].min
     @detail_window.create_contents
      wx = Graphics.width/2 + (@item_window.index % 2 == 0 ? 0 : -@detail_window.width)
      @detail_window.item = @item_window.item
      @detail_window.x = wx
      Sound.play_ok
      @detail_window.visible = !@detail_window.visible
    end
   
    alias use_itemzcl2019114 use_item
    def use_item
      use_itemzcl2019114
      refresh_detail_window
    end
end[/pre]

这个物品详细说明可以很好的解决不够写说明的问题,但是突然发现在战斗中,这个说明窗口不起作用,应该如何进行更改?
梦石
0
星屑
29901
在线时间
5734 小时
注册时间
2016-3-8
回帖
1653
发表于 2021-7-22 05:25:44 | 显示全部楼层
本帖最后由 alexncf125 于 2021-7-22 05:29 编辑

去Scene_Battle复制一遍这脚本的54-102行, 不就行了么

评分

参与人数 1赞 +1 收起 理由
sxjkjly8010 + 1 认可答案

查看全部评分

回复 1 0

使用道具 举报

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

本版积分规则

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

在本版发帖返回顶部