查看: 2974|回复: 8

[已经解决] 求助大神,关于装备说明增强脚本窗口位置

[复制链接]
梦石
0
星屑
75
在线时间
231 小时
注册时间
2014-10-5
回帖
226
发表于 2014-10-24 20:31:44 | 显示全部楼层 |阅读模式

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

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

×
javascript:;
这个脚本很好用,不过在购买东西的时候,窗口显示在左边,挡住了购买列表,请问求改哪一句,可以让这个提示在右侧
跪求大神指导,正在学习脚本,不过还是不知道从哪里下手

下面是脚本

[pre lang="ruby" line="1"]#==============================================================================
# ■ 装备说明增强
#------------------------------------------------------------------------------
#  修改了说明窗口,增强了装备的说明 作者:wyongcan  发布于66RPG   转载请注明
#==============================================================================
module Help
  CODE ={
    11 => "属性抗性",
    12 => "弱化抗性",
    13 => "状态抗性",
    14 => "状态免疫",
    21 => "普通能力",
    22 => "添加能力",
    23 => "特殊能力",
    31 => "攻击附带属性",
    32 => "攻击附带状态",
    33 => "修正攻击速度",
    34 => "添加攻击次数",
    43 => "添加技能",
    53 => "固定装备",
    55 => "装备风格",
    61 => "添加行动次数",
    62 => "特殊标志",
    63 => "消失效果",
    64 => "队伍能力"}
  #特殊标志
  FLAG ={
                0 => "自动战斗",
                1 => "擅长防御",
                2 => "保护弱者",
                3 => "特技专注"}
  #普通能力
        PARAM ={
                0 => "最大HP +",
                1 => "最大MP +",
                2 => "物理攻击 +",
                3 => "物理防御 +",
                4 => "魔法攻击 +",
                5 => "魔法防御 +",
                6 => "敏 捷 值 +",
                7 => "幸 运 值 +"}
  #添加能力
        XPARAM ={
                0 => "物理命中几率:",
                1 => "物理闪避几率:",
                2 => "必杀几率:",
                3 => "必杀闪避几率:",
                4 => "魔法闪避几率:",
                5 => "魔法反射几率:",
                6 => "物理反击几率:",
                7 => "体力值再生速度:",
                8 => "魔力值再生速度:",
                9 => "特技值再生速度:"}
  #特殊能力
        SPARAM ={
                0 => "受到攻击的几率",
                1 => "防御效果比率",
                2 => "恢复效果比率",
                3 => "药理知识",
                4 => "MP消费率",
                5 => "TP消耗率",
                6 => "物理伤害加成",
                7 => "魔法伤害加成",
                8 => "地形伤害加成",
                9 => "经验获得加成"}
#~   #效果范围
#~         SCOPE ={
#~                 0 => "特殊",
#~                 1 => "单个敌人",
#~                 2 => "全体敌人" ,
#~                 3 => "一个随机敌人",
#~                 4 => "两个随机敌人",
#~                 5 => "三个随机敌人",
#~                 6 => "四个随机敌人",
#~                 7 => "单个队友",
#~                 8 => "全体队友",
#~                 9 => "单个队友(无法战斗)",
#~                 10 => "全体队友(无法战斗)",
#~                 11 => "使用者"}
        @队伍能力 ={
                0 => "遇敌几率减半",
                1 => "随机遇敌无效",
                2 => "敌人偷袭无效",
                3 => "先制攻击几率上升",
                4 => "获得金钱数量双倍",
                5 => "物品掉落几率双倍"}
  def self.ready
    @状态 = {}
    @武器类型 = {}
    @防具类型 = {}
    @属性 = {}
    $data_states.each{|x| @状态[x.id] = x.name if x != nil}
    elements = $data_system.elements
    weapon_types = $data_system.weapon_types
    armor_types = $data_system.armor_types
    elements.each_with_index{|x,y| @属性[y] = x if x != ""}
    weapon_types.each_with_index{|x,y| @武器类型[y] = x if x != ""}
    armor_types.each_with_index{|x,y| @防具类型[y] = x if x != ""}
  end
  def self.getequiphelp(equip)
    help = ""
    param = []
    equip.params.each_with_index{|x,y| param.push([PARAM[y],x])}
    param = param.select{|x| x[1] != 0}
    param.each{|x| help += x[0] + " " + x[1].to_s + "\n"}
    features = equip.features
    features.select{|x| x.code == 55}.each{|x| help += CODE[x.code] + ":双持武器" + "\n"}
    features.select{|x| x.code == 11}.each{|x| help += CODE[x.code] + ":" + @属性[x.data_id] + "*" + (x.value.is_a?(Numeric) ? ((x.value).to_s + "%") : x.value.to_s) + "\n"}
    features.select{|x| x.code == 12}.each{|x| help += CODE[x.code] + ":" + PARAM[x.data_id] + "*" + (x.value.is_a?(Numeric) ? ((x.value).to_s + "%") : x.value.to_s) + "\n"}
    features.select{|x| x.code == 13}.each{|x| help += CODE[x.code] + ":" + @状态[x.data_id] + "*" + (x.value.is_a?(Numeric) ? ((x.value).to_s + "%") : x.value.to_s) + "\n"}
    features.select{|x| x.code == 14}.each{|x| help += CODE[x.code] + ":" + @状态[x.data_id] + "\n"}
    features.select{|x| x.code == 32}.each{|x| help += CODE[x.code] + ":" + @状态[x.data_id] + "+" + (x.value.is_a?(Numeric) ? ((x.value).to_s + "%") : x.value.to_s) + "\n"}
    features.select{|x| x.code == 33}.each{|x| help += CODE[x.code] + ":" + x.value.to_s + "\n"}
    features.select{|x| x.code == 34}.each{|x| help += CODE[x.code] + ":" + x.value.to_s + "\n"}
    features.select{|x| x.code == 43}.each{|x| help += CODE[x.code] + ":" + $data_skills[x.data_id].name  + "\n"}
    features.select{|x| x.code == 44}.each{|x| help += CODE[x.code] + ":" + $data_skills[x.data_id].name  + "\n"}
    features.select{|x| x.code == 61}.each{|x| help += CODE[x.code] + ":" + x.value.to_s  + "\n"}
    features.select{|x| x.code == 62}.each{|x| help += CODE[x.code] + ":" + FLAG[x.data_id]  + "\n"}
    features.select{|x| x.code == 64}.each{|x| help += CODE[x.code] + ":" + @队伍能力[x.data_id]  + "\n"}
    featuresparam = []
    featuresparam.push features.select{|x| x.code == 21}
    featuresparam.push features.select{|x| x.code == 22}
    featuresparam.push features.select{|x| x.code == 23}
    featuresparam[0].each{|x| s = (x.value.is_a?(Numeric) ? ((x.value*100).to_s + "%") : x.value.to_s) ; help += PARAM[x.data_id] + "*" + s + "\n"}
    featuresparam[1].each{|x| s = (x.value.is_a?(Numeric) ? ((x.value*100).to_s + "%") : x.value.to_s) ; help += XPARAM[x.data_id] + s + "\n"}
    featuresparam[2].each{|x| s = (x.value.is_a?(Numeric) ? ((x.value).to_s + "%") : x.value.to_s) ; help += SPARAM[x.data_id] + "*" + s + "\n"}
    help
  end
  def self.getline(text,maxtext)
    xtext = []
    line = 0
    text.each_line{|x| xtext.push x.sub(/\n/){}}
    xtext.each{|x| x.size % maxtext != 0 ? line += x.size / maxtext + 1 : line += x.size / maxtext}
    line
  end
end
#==============================================================================
# ■ Window_Help
#------------------------------------------------------------------------------
#  显示特技和物品等的说明、以及角色状态的窗口
#==============================================================================

class Window_Help < Window_Base
  #--------------------------------------------------------------------------
  # ● 初始化对象
  #--------------------------------------------------------------------------
  def initialize(line_number = 0)
    super(0, 0, 210, fitting_height(line_number))
    self.z = 150
    contents.font.size = 20
    hide
  end
  #--------------------------------------------------------------------------
  # ● 设置内容
  #--------------------------------------------------------------------------
  def set_text(text)
    #if text != @text
      @text = text
      refresh
    #end
  end
  #--------------------------------------------------------------------------
  # ● 清除
  #--------------------------------------------------------------------------
  def clear
    set_text("")
  end
  #--------------------------------------------------------------------------
  # ● 更新帮助位置
  #--------------------------------------------------------------------------
  def uppos(index,rect,window)
    self.height = fitting_height2(Help.getline(@xtext,30))
    create_contents
    contents.font.size = 16
    rect.x -= window.ox
    rect.y -= window.oy
    ax = rect.x + rect.width + 10
    ax = rect.x - self.width + 10 if ax + self.width > window.width + 10
    ax += window.x
    ax = 0 if ax < 0
    ay = rect.y + rect.height
    ay = rect.y - self.height if ay + self.height > window.height
    ay += window.y
    ay = 0 if ay < 0
    self.x = ax
    self.y = ay
    set_text(@xtext)
    show
  end
  #--------------------------------------------------------------------------
  # ● 设置物品
  #     item : 技能、物品等
  #--------------------------------------------------------------------------
  def set_item(item)
    if item == nil
      set_text("")
      return
    end
    @item = item
    @xtext = ""
    @xtext = " \n"
    @xtext += " \n"
    @xtext += "介绍:" + item.description + "\n"
    @xtext += "价格:" + item.price.to_s + "\n" if item.is_a?(RPG::EquipItem) || item.is_a?(RPG::Item)
    @xtext += Help.getequiphelp(item) if item.is_a?(RPG::EquipItem)
    @xtext = @xtext[0,@text.size - 2] if @xtext[@xtext.size - 2,2] == "\n"
  end
  #--------------------------------------------------------------------------
  # ● 刷新
  #--------------------------------------------------------------------------
  def refresh
    contents.clear
    hide if @text == ""
    draw_item_name(@item, 5, 5) if @item
    draw_text_ex(4, 0, @text,width,40,false)
  end
end

class Window_Base < Window
  #--------------------------------------------------------------------------
  # ● 计算窗口显示指定行数时的应用高度2*************************
  #--------------------------------------------------------------------------
  def fitting_height2(line_number)
    line_number * contents.font.size + standard_padding * 10
  end
#~ draw_text_ex的增强,使其可以自动换行  原作者:叶子 修改:wyongcan
  #--------------------------------------------------------------------------
  # ● 绘制带有控制符的文本内容
  #   如果传递了width参数的话,会自动换行
  #--------------------------------------------------------------------------
  def draw_text_ex(x, y, text, width = nil,textwidth = nil,normalfont = true)
    reset_font_settings if normalfont == true
    text = convert_escape_characters(text)
    pos = {:x => x, :y => y, :new_x => x, :height => calc_line_height(text)}
    if width != nil
      pos[:height] = contents.font.size
      pos[:width] = width
      pos[:textwidth] = textwidth
    end
    process_character(text.slice!(0, 1), text, pos) until text.empty?
  end
  #--------------------------------------------------------------------------
  # ● 文字的处理
  #     c    : 文字
  #     text : 绘制处理中的字符串缓存(字符串可能会被修改)
  #     pos  : 绘制位置 {:x, :y, :new_x, :height}
  #--------------------------------------------------------------------------
  def process_character(c, text, pos)
    case c
    when "\r"   # 回车
      return
    when "\n"   # 换行
      process_new_line(text, pos)
    when "\f"   # 翻页
      process_new_page(text, pos)
    when "\e"   # 控制符
      process_escape_character(obtain_escape_code(text), text, pos)
    else        # 普通文字
      pos[:textwidth] == nil ? text_width = text_size(c).width : text_width = pos[:textwidth]
      if pos[:width] != nil && pos[:x] - pos[:new_x] + text_width > pos[:width]
        process_new_line(text, pos)
      end
      process_normal_character(c, pos)
    end
  end
end

class Window_ItemList < Window_Selectable
  #--------------------------------------------------------------------------
  # ● 更新帮助内容
  #--------------------------------------------------------------------------
  def update_help
    @help_window.set_item(item)
    @help_window.uppos(index,item_rect(index),self) if index != -1 && item != nil
  end
end

class Window_SkillList < Window_Selectable
  #--------------------------------------------------------------------------
  # ● 更新帮助内容
  #--------------------------------------------------------------------------
  def update_help
    @help_window.set_item(item)
    @help_window.uppos(index,item_rect(index),self) if index != -1 && item != nil
  end
end

class Window_ShopBuy < Window_Selectable
  #--------------------------------------------------------------------------
  # ● 更新帮助内容
  #--------------------------------------------------------------------------
  def update_help
    @help_window.set_item(item) if @help_window
    @help_window.uppos(index,item_rect(index),self) if index != -1 && item != nil && @help_window
    @status_window.item = item if @status_window
  end
end

class Window_EquipSlot < Window_Selectable
  #--------------------------------------------------------------------------
  # ● 更新帮助内容
  #--------------------------------------------------------------------------
  def update_help
    super
    @help_window.set_item(item) if @help_window
    @help_window.uppos(index,item_rect(index),self) if index != -1 && item != nil && @help_window
    @status_window.set_temp_actor(nil) if @status_window
  end
end

class Scene_Shop < Scene_MenuBase
        alias on_sell_ok_old on_sell_ok
        def on_sell_ok
                on_sell_ok_old
                @help_window.hide
        end
        alias on_buy_ok_old on_buy_ok
        def on_buy_ok
                on_buy_ok_old
                @help_window.hide
        end
        alias on_number_ok_old on_number_ok
        def on_number_ok
                on_number_ok_old
    @help_window.refresh
                @help_window.show
        end
        alias on_number_cancel_old on_number_cancel
        def on_number_cancel
                on_number_cancel_old
    @help_window.refresh
                @help_window.show
        end
end

class Scene_Title < Scene_Base
  alias start_old start
  def start
    start_old
    Help.ready
  end
end[/pre]
QQ截图20141024202859.png

无限の剣制

梦石
0
星屑
10445
在线时间
5019 小时
注册时间
2013-2-28
回帖
4942

开拓者贵宾

发表于 2014-10-24 21:21:12 | 显示全部楼层
https://rpg.blue/thread-372464-1-1.html
虽然没有直接满足你的要求,但是我觉得这个应该可以解决你的强迫症问题
回复

使用道具 举报

梦石
1
星屑
23236
在线时间
9564 小时
注册时间
2012-6-19
回帖
7018

开拓者短篇九导演组冠军

发表于 2014-10-24 21:23:09 | 显示全部楼层
扔到这个装备增强脚本的后面,使提示窗口往下移动一段距离:
  1. class Window_ShopBuy
  2.   alias m5_20141024_update_help update_help
  3.   def update_help
  4.     m5_20141024_update_help
  5.     @help_window.y += 20 if @help_window.y > item_rect(index).y
  6.   end
  7. end
复制代码
顺便:这脚本写的真烂

点评

这脚本已经被泥萌这些触给吐槽爆了……_(:з」∠)_  发表于 2014-10-24 21:40

评分

参与人数 1星屑 +132 收起 理由
VIPArcher + 132 +1

查看全部评分

回复

使用道具 举报

梦石
0
星屑
75
在线时间
231 小时
注册时间
2014-10-5
回帖
226
 楼主| 发表于 2014-10-24 21:32:07 | 显示全部楼层
喵呜喵5 发表于 2014-10-24 21:23
扔到这个装备增强脚本的后面,使提示窗口往下移动一段距离:顺便:这脚本写的真烂 ...

亲,效果有点一般。。。不能往右移动大概200的距离吗?
回复

使用道具 举报

梦石
1
星屑
23236
在线时间
9564 小时
注册时间
2012-6-19
回帖
7018

开拓者短篇九导演组冠军

发表于 2014-10-24 21:33:36 | 显示全部楼层
RM无节操小分队 发表于 2014-10-24 21:32
亲,效果有点一般。。。不能往右移动大概200的距离吗?
  1. class Window_ShopBuy
  2.   alias m5_20141024_update_help update_help
  3.   def update_help
  4.     m5_20141024_update_help
  5.     @help_window.x += 200
  6.   end
  7. end
复制代码

点评

不要和上面那个脚本共同使用  发表于 2014-10-24 21:33

评分

参与人数 1梦石 +1 收起 理由
taroxd + 1 认可答案

查看全部评分

回复

使用道具 举报

无限の剣制

梦石
0
星屑
10445
在线时间
5019 小时
注册时间
2013-2-28
回帖
4942

开拓者贵宾

发表于 2014-10-24 21:41:50 | 显示全部楼层
喵呜喵5 发表于 2014-10-24 21:33

干嘛不直接赋值到200,嘛反正结果都一样。(这不是要糖的姿势
  1. class Window_ShopBuy
  2.   alias m5_20141024_update_help update_help
  3.   def update_help
  4.     m5_20141024_update_help
  5.     @help_window.x = 200 if @help_window.x != 200
  6.   end
  7. end
复制代码

评分

参与人数 1梦石 +1 收起 理由
taroxd + 1 认可答案

查看全部评分

回复

使用道具 举报

梦石
0
星屑
75
在线时间
231 小时
注册时间
2014-10-5
回帖
226
 楼主| 发表于 2014-10-24 21:48:03 | 显示全部楼层
太谢谢各位大人了, 已经成功了,我直接+300,效果非常好,之前那位大大给我的那个脚本有点冲突,这个虽然一般,但是还是不错的,谢谢啦

点评

我给的链接有冲突吗?能否在那边原帖详细说说发个错误截图啥的,谢谢。  发表于 2014-10-24 21:58
回复

使用道具 举报

梦石
0
星屑
75
在线时间
231 小时
注册时间
2014-10-5
回帖
226
 楼主| 发表于 2014-10-24 22:04:10 | 显示全部楼层
RM无节操小分队 发表于 2014-10-24 21:48
太谢谢各位大人了, 已经成功了,我直接+300,效果非常好,之前那位大大给我的那个脚本有点冲突,这个虽然 ...

我也不清楚是什么冲突,大概就是我不需要几种属性,比如提示添加装备类型什么的,在删除以后就错误了,也许是我不会脚本删句子的时候的问题吧,呵呵

点评

知道了,谢谢大大  发表于 2014-10-24 22:28
你不要的那些东西直接注释features.........那里就可以了, 嘛。如果现在这个不冲突的话,那就这样吧、  发表于 2014-10-24 22:15
哦,  发表于 2014-10-24 22:05
回复

使用道具 举报

梦石
0
星屑
50
在线时间
641 小时
注册时间
2015-7-29
回帖
188
发表于 2015-8-2 21:45:45 | 显示全部楼层
为什么一战斗就出错呢     Window_help  14行

点评

参考2楼链接的脚本  发表于 2015-8-3 09:28
回复

使用道具 举报

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

本版积分规则

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

在本版发帖返回顶部