查看: 2121|回复: 1

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

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

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

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

×
  1. #===============================================================================
  2. #物品界面、技能界面按SHIFT打开介绍窗口
  3. #2019/1/14   By:真·可乐
  4. #===============================================================================

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


  17. module RPG
  18.   class BaseItem
  19.     def detail
  20.       /\[de\](.*)\[ta\]/ =~ self.note
  21.       return ($1.is_a?(String) ? $1 : "")
  22.     end
  23.   end
  24. end

  25. class Window_Detail < Window_Base
  26.   attr_accessor           :item
  27.   include ZCL_Detail_Set
  28.   def initialize(y)
  29.     super(x = 0,y,WWIDTH,WHEIGHT)
  30.     self.windowskin = Cache.system(WINDOWSKILL)
  31.     @item = nil
  32.   end
  33.   
  34.   def refresh
  35.     self.contents.clear
  36.     return self.hide if @item.nil?
  37.     co = ITEMNAMEBACKCOLOR
  38.     contents.fill_rect(0,0,self.width,32,Color.new(co[0],co[1],co[2],co[3]))
  39.     text = @item.detail.gsub("\\n"){"\n"}
  40.     draw_item_name(@item,0,2,true);draw_text_ex(0,36,text)
  41.   end
  42.   
  43.   def item=(titem)
  44.     @item = titem
  45.     self.refresh
  46.   end
  47. end

  48. class Scene_ItemBase
  49.   attr_reader   :detail_window
  50.   alias startzcl2019114 start
  51.   def start
  52.     startzcl2019114;create_detail_window
  53.   end
  54.   
  55.   def create_detail_window
  56.     @detail_window = Window_Detail.new(0)
  57.    
  58.     @detail_window.hide
  59.   end
  60.    alias updatezcl2019114 update
  61.   def update
  62.     updatezcl2019114
  63.     update_detail
  64.   end
  65.   
  66.   def update_detail
  67.   return @detail_window.hide unless @item_window.active
  68.     if Input.trigger?(Input::A)
  69.       return if self.is_a?(Scene_Item) && ZCL_Detail_Set::DISABLE == 1
  70.       return if self.is_a?(Scene_Skill) && ZCL_Detail_Set::DISABLE == 2
  71.       return unless ZCL_Detail_Set::DISABLE.between?(0,2)
  72.       refresh_detail_window;end
  73.     @detail_window.hide if Input.trigger?(:UP) || Input.trigger?(:DOWN) ||
  74.        Input.trigger?(:LEFT) || Input.trigger?(:RIGHT)
  75.    end
  76.    
  77.    def refresh_detail_window
  78.     if @item_window.item.nil?
  79.       @detail_window.hide
  80.       return Sound.play_buzzer
  81.     end
  82.      @detail_window.y = @item_window.y
  83.      @detail_window.z = @item_window.z + 100
  84.      @detail_window.height =  [Graphics.height - @detail_window.y , ZCL_Detail_Set::WHEIGHT ].min
  85.      @detail_window.create_contents
  86.       wx = Graphics.width/2 + (@item_window.index % 2 == 0 ? 0 : -@detail_window.width)
  87.       @detail_window.item = @item_window.item
  88.       @detail_window.x = wx
  89.       Sound.play_ok
  90.       @detail_window.visible = !@detail_window.visible
  91.     end
  92.    
  93.     alias use_itemzcl2019114 use_item
  94.     def use_item
  95.       use_itemzcl2019114
  96.       refresh_detail_window
  97.     end
  98. end
复制代码


这个物品详细说明可以很好的解决不够写说明的问题,但是突然发现在战斗中,这个说明窗口不起作用,应该如何进行更改?
梦石
0
星屑
30103
在线时间
5741 小时
注册时间
2016-3-8
回帖
1662
发表于 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.

在本版发帖返回顶部