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

Project1

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

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

[复制链接]

Lv2.观梦者

梦石
0
星屑
867
在线时间
194 小时
注册时间
2019-4-11
帖子
56
跳转到指定楼层
1
发表于 2021-7-22 02:28:23 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式

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

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

x
RUBY 代码复制
  1. #===============================================================================
  2. #物品界面、技能界面按SHIFT打开介绍窗口
  3. #2019/1/14   By:真·可乐
  4. #===============================================================================
  5.  
  6. module ZCL_Detail_Set
  7.   #窗口的皮肤名称
  8.   WINDOWSKILL = "Window"
  9.   #窗口的宽度
  10.   WWIDTH = Graphics.width / 2.3
  11.   #窗口的高度
  12.   WHEIGHT = Graphics.height / 1.5
  13.   #窗口物品名称栏的背景色,最后一项是不透明度,填成0的话就没颜色了
  14.   ITEMNAMEBACKCOLOR = [0,255,0,100]
  15.   #禁用设定 , 1 为禁用 物品界面细明窗口 ,2 为禁用 技能界面细明窗口 , 3 为全部禁用
  16.   DISABLE = 0
  17. end
  18.  
  19.  
  20. module RPG
  21.   class BaseItem
  22.     def detail
  23.       /\[de\](.*)\[ta\]/ =~ self.note
  24.       return ($1.is_a?(String) ? $1 : "")
  25.     end
  26.   end
  27. end
  28.  
  29. class Window_Detail < Window_Base
  30.   attr_accessor           :item
  31.   include ZCL_Detail_Set
  32.   def initialize(y)
  33.     super(x = 0,y,WWIDTH,WHEIGHT)
  34.     self.windowskin = Cache.system(WINDOWSKILL)
  35.     @item = nil
  36.   end
  37.  
  38.   def refresh
  39.     self.contents.clear
  40.     return self.hide if @item.nil?
  41.     co = ITEMNAMEBACKCOLOR
  42.     contents.fill_rect(0,0,self.width,32,Color.new(co[0],co[1],co[2],co[3]))
  43.     text = @item.detail.gsub("\\n"){"\n"}
  44.     draw_item_name(@item,0,2,true);draw_text_ex(0,36,text)
  45.   end
  46.  
  47.   def item=(titem)
  48.     @item = titem
  49.     self.refresh
  50.   end
  51. end
  52.  
  53. class Scene_ItemBase
  54.   attr_reader   :detail_window
  55.   alias startzcl2019114 start
  56.   def start
  57.     startzcl2019114;create_detail_window
  58.   end
  59.  
  60.   def create_detail_window
  61.     @detail_window = Window_Detail.new(0)
  62.  
  63.     @detail_window.hide
  64.   end
  65.    alias updatezcl2019114 update
  66.   def update
  67.     updatezcl2019114
  68.     update_detail
  69.   end
  70.  
  71.   def update_detail
  72.   return @detail_window.hide unless @item_window.active
  73.     if Input.trigger?(Input::A)
  74.       return if self.is_a?(Scene_Item) && ZCL_Detail_Set::DISABLE == 1
  75.       return if self.is_a?(Scene_Skill) && ZCL_Detail_Set::DISABLE == 2
  76.       return unless ZCL_Detail_Set::DISABLE.between?(0,2)
  77.       refresh_detail_window;end
  78.     @detail_window.hide if Input.trigger?(:UP) || Input.trigger?(:DOWN) ||
  79.        Input.trigger?(:LEFT) || Input.trigger?(:RIGHT)
  80.    end
  81.  
  82.    def refresh_detail_window
  83.     if @item_window.item.nil?
  84.       @detail_window.hide
  85.       return Sound.play_buzzer
  86.     end
  87.      @detail_window.y = @item_window.y
  88.      @detail_window.z = @item_window.z + 100
  89.      @detail_window.height =  [Graphics.height - @detail_window.y , ZCL_Detail_Set::WHEIGHT ].min
  90.      @detail_window.create_contents
  91.       wx = Graphics.width/2 + (@item_window.index % 2 == 0 ? 0 : -@detail_window.width)
  92.       @detail_window.item = @item_window.item
  93.       @detail_window.x = wx
  94.       Sound.play_ok
  95.       @detail_window.visible = !@detail_window.visible
  96.     end
  97.  
  98.     alias use_itemzcl2019114 use_item
  99.     def use_item
  100.       use_itemzcl2019114
  101.       refresh_detail_window
  102.     end
  103. end


这个物品详细说明可以很好的解决不够写说明的问题,但是突然发现在战斗中,这个说明窗口不起作用,应该如何进行更改?

Lv5.捕梦者

梦石
0
星屑
24252
在线时间
5036 小时
注册时间
2016-3-8
帖子
1618
2
发表于 2021-7-22 05:25:44 | 只看该作者
本帖最后由 alexncf125 于 2021-7-22 05:29 编辑

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

评分

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

查看全部评分

回复 支持 1 反对 0

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2024-4-20 05:37

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

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