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

Project1

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

[已经过期] ~~~~(>_<)~~~~ 脚本错误

[复制链接]

Lv1.梦旅人

梦石
0
星屑
50
在线时间
8 小时
注册时间
2012-11-13
帖子
22
跳转到指定楼层
1
发表于 2012-12-22 01:17:02 | 只看该作者 |只看大图 回帖奖励 |倒序浏览 |阅读模式

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

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

x
#encoding:utf-8
#==============================================================================
# ■ 装备说明增强 By wyongcan
#==============================================================================
module Equipplus
  CODE ={
    11 => "属性抗性",
    12 => "弱化抗性",
    13 => "状态抗性",
    14 => "状态免疫",
    21 => "普通能力",
    22 => "添加能力",
    23 => "特殊能力",
    31 => "攻击附带属性",
    32 => "攻击附带状态",
    33 => "修正攻击速度",
    34 => "添加攻击次数",
    41 => "添加技能类型",
    42 => "禁用技能类型",
    43 => "添加技能",
    44 => "禁用技能",
    51 => "可装备武器类型",
    52 => "可装备护甲类型",
    53 => "固定装备",
    54 => "禁用装备",
    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 => "经验获得加成"}
        @队伍能力 ={
                0 => "遇敌几率减半",
                1 => "随机遇敌无效",
                2 => "敌人偷袭无效",
                3 => "先制攻击几率上升",
                4 => "获得金钱数量双倍",
                5 => "物品掉落几率双倍"}
  def self.equiphelpready
    @状态 = {}
    @武器类型 = {}
    @防具类型 = {}
    @属性 = {}
    $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_int.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.to_s + "\n"}
    features.select{|x| x.code == 12}.each{|x| help += CODE[x.code] + ":" + PARAM[x.data_id] + "*" + x.value.to_s + "\n"}
    features.select{|x| x.code == 13}.each{|x| help += CODE[x.code] + ":" + @状态[x.data_id] + "*" + 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 == 31}.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.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 == 41}.each{|x| help += CODE[x.code] + ":" + (x.data_id == 1 ? "特技" : "魔法")  + "\n"}
    features.select{|x| x.code == 42}.each{|x| help += CODE[x.code] + ":" + (x.data_id == 1 ? "特技" : "魔法")  + "\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 == 51}.each{|x| help += CODE[x.code] + ":" + @武器类型[x.data_id]  + "\n"}
    features.select{|x| x.code == 52}.each{|x| help += CODE[x.code] + ":" + @防具类型[x.data_id]  + "\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| help += PARAM[x.data_id] + "*" + x.value.to_s + "\n"}
    featuresparam[1].each{|x| help += XPARAM[x.data_id] + x.value.to_s + "\n"}
    featuresparam[2].each{|x| help += SPARAM[x.data_id] + "*" + x.value.to_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_Help2 < Window_Base
  #--------------------------------------------------------------------------
  # ● 初始化对象
  #--------------------------------------------------------------------------
  def initialize(line_number = 0)
    super(0, 0, 210, 0)
    self.z = 150
    contents.font.size = 14
    hide
  end
  #--------------------------------------------------------------------------
  # ● 设置内容
  #--------------------------------------------------------------------------
  def set_text(text)
      @text = text
      refresh
  end
  #--------------------------------------------------------------------------
  # ● 清除
  #--------------------------------------------------------------------------
  def clear
    set_text("")
  end
  #--------------------------------------------------------------------------
  # ● 更新帮助位置
  #--------------------------------------------------------------------------
  def uppos(index,rect,window)
    self.height = fitting_height2(Equipplus.getline(@xtext,13))
    create_contents
    contents.font.size = 14
    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
    @xtext = ""
    @xtext = "名称:" + item.name + "\n"
    @xtext += "介绍:" + item.description + "\n"
    @xtext += "价格:" + item.price.to_s + "\n" if item.is_a?(RPG::EquipItem) || item.is_a?(RPG::Item)
    @xtext += Equipplus.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_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 * 2
  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
    Equipplus.equiphelpready
  end
end

class Scene_ItemBase < Scene_MenuBase
        alias old_on_actor_cancel on_actor_cancel
  def on_actor_cancel
    old_on_actor_cancel
        @help_window.refresh
  end
        alias old_on_actor_ok on_actor_ok
  def on_actor_ok
    old_on_actor_ok
        @help_window.refresh
  end
end

class Window_Base < Window
        alias old_process_new_line process_new_line
        def process_new_line(text, pos)
    old_process_new_line(text, pos)
                pos[:height] = contents.font.size if pos[:width] != nil
        end
end

class Scene_MenuBase < Scene_Base
  def create_help_window
    @help_window = Window_Help2.new
    @help_window.viewport = @viewport
  end
end
class Scene_Battle < Scene_Base
  def create_help_window
    @help_window = Window_Help2.new
    @help_window.visible = false
  end
end

QQ截图20121222011504.jpg (13.5 KB, 下载次数: 32)

QQ截图20121222011504.jpg

Lv1.梦旅人

梦石
0
星屑
50
在线时间
8 小时
注册时间
2012-11-13
帖子
22
2
 楼主| 发表于 2012-12-22 12:05:19 | 只看该作者
555555,没人解决吗?

评分

参与人数 1星屑 -35 收起 理由
Mic_洛洛 -35 内容重复+连帖+没用代码框,扣分.

查看全部评分

回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
100
在线时间
5250 小时
注册时间
2011-10-7
帖子
1885

开拓者贵宾

3
发表于 2012-12-24 13:36:07 | 只看该作者
253行参数少了一个,没有行号我也不知道哪个是253行……
回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
52
在线时间
704 小时
注册时间
2011-12-27
帖子
941
4
发表于 2012-12-24 17:41:18 | 只看该作者
第238行的腳本是這樣:
process_character(c, text, pos)

而第253行的腳本就是:
process_normal_character(c, pos)

你應該把253行的改為238行的一樣, 是缺少參數
回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
50
在线时间
8 小时
注册时间
2012-11-13
帖子
22
5
 楼主| 发表于 2012-12-26 16:28:14 | 只看该作者
呜呜,那个问题我解决了。可是又出现一个新问题啊,无奈。rpg制作大师ace的问题:
在战斗中一点击“特技”,“物品”,“魔法”等就脚本错误

点评

什么错误都没说,这怎么猜?  发表于 2012-12-26 17:57
回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
50
在线时间
8 小时
注册时间
2012-11-13
帖子
22
6
 楼主| 发表于 2012-12-26 16:35:46 | 只看该作者

脚本又错误,急求回答啊~

[/align][fly]#encoding:utf-8[/fly]

QQ截图20121226162509.jpg (15.72 KB, 下载次数: 29)

QQ截图20121226162509.jpg
回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
50
在线时间
8 小时
注册时间
2012-11-13
帖子
22
7
 楼主| 发表于 2012-12-26 16:36:21 | 只看该作者
  1. #encoding:utf-8
  2. #==============================================================================
  3. # ■ 装备说明增强 By wyongcan
  4. #==============================================================================
  5. module Equipplus
  6.   CODE ={
  7.     11 => "属性抗性",
  8.     12 => "弱化抗性",
  9.     13 => "状态抗性",
  10.     14 => "状态免疫",
  11.     21 => "普通能力",
  12.     22 => "添加能力",
  13.     23 => "特殊能力",
  14.     31 => "攻击附带属性",
  15.     32 => "攻击附带状态",
  16.     33 => "修正攻击速度",
  17.     34 => "添加攻击次数",
  18.     41 => "添加技能类型",
  19.     42 => "禁用技能类型",
  20.     43 => "添加技能",
  21.     44 => "禁用技能",
  22.     51 => "可装备武器类型",
  23.     52 => "可装备护甲类型",
  24.     53 => "固定装备",
  25.     54 => "禁用装备",
  26.     55 => "装备风格",
  27.     61 => "添加行动次数",
  28.     62 => "特殊标志",
  29.     63 => "消失效果",
  30.     64 => "队伍能力"}
  31.   #特殊标志
  32.   FLAG ={
  33.                 0 => "自动战斗",
  34.                 1 => "擅长防御",
  35.                 2 => "保护弱者",
  36.                 3 => "特技专注"}
  37.   #普通能力
  38.         PARAM ={
  39.                 0 => "最大HP",
  40.                 1 => "最大MP",
  41.                 2 => "物理攻击",
  42.                 3 => "物理防御",
  43.                 4 => "魔法攻击",
  44.                 5 => "魔法防御",
  45.                 6 => "敏 捷 值",
  46.                 7 => "幸 运 值"}
  47.   #添加能力
  48.         XPARAM ={
  49.                 0 => "物理命中几率:",
  50.                 1 => "物理闪避几率:",
  51.                 2 => "必杀几率:",
  52.                 3 => "必杀闪避几率:",
  53.                 4 => "魔法闪避几率:",
  54.                 5 => "魔法反射几率:",
  55.                 6 => "物理反击几率:",
  56.                 7 => "体力值再生速度:",
  57.                 8 => "魔力值再生速度:",
  58.                 9 => "特技值再生速度:"}
  59.   #特殊能力
  60.         SPARAM ={
  61.                 0 => "受到攻击的几率",
  62.                 1 => "防御效果比率",
  63.                 2 => "恢复效果比率",
  64.                 3 => "药理知识",
  65.                 4 => "MP消费率",
  66.                 5 => "TP消耗率",
  67.                 6 => "物理伤害加成",
  68.                 7 => "魔法伤害加成",
  69.                 8 => "地形伤害加成",
  70.                 9 => "经验获得加成"}
  71.         @队伍能力 ={
  72.                 0 => "遇敌几率减半",
  73.                 1 => "随机遇敌无效",
  74.                 2 => "敌人偷袭无效",
  75.                 3 => "先制攻击几率上升",
  76.                 4 => "获得金钱数量双倍",
  77.                 5 => "物品掉落几率双倍"}
  78.   def self.equiphelpready
  79.     @状态 = {}
  80.     @武器类型 = {}
  81.     @防具类型 = {}
  82.     @属性 = {}
  83.     $data_states.each{|x| @状态[x.id] = x.name if x != nil}
  84.     elements = $data_system.elements
  85.     weapon_types = $data_system.weapon_types
  86.     armor_types = $data_system.armor_types
  87.     elements.each_with_index{|x,y| @属性[y] = x if x != ""}
  88.     weapon_types.each_with_index{|x,y| @武器类型[y] = x if x != ""}
  89.     armor_types.each_with_index{|x,y| @防具类型[y] = x if x != ""}
  90.   end
  91.   def self.getequiphelp(equip)
  92.     help = ""
  93.     param = []
  94.     equip.params.each_with_index{|x,y| param.push([PARAM[y],x])}
  95.     param = param.select{|x| x[1] != 0}
  96.     param.each{|x| help += x[0] + ":" + x[1].to_int.to_s + "\n"}
  97.     features = equip.features
  98.     features.select{|x| x.code == 55}.each{|x| help += CODE[x.code] + ":双持武器" + "\n"}
  99.     features.select{|x| x.code == 11}.each{|x| help += CODE[x.code] + ":" + @属性[x.data_id] + "*" + x.value.to_s + "\n"}
  100.     features.select{|x| x.code == 12}.each{|x| help += CODE[x.code] + ":" + PARAM[x.data_id] + "*" + x.value.to_s + "\n"}
  101.     features.select{|x| x.code == 13}.each{|x| help += CODE[x.code] + ":" + @状态[x.data_id] + "*" + x.value.to_s + "\n"}
  102.     features.select{|x| x.code == 14}.each{|x| help += CODE[x.code] + ":" + @状态[x.data_id] + "\n"}
  103.     features.select{|x| x.code == 31}.each{|x| help += CODE[x.code] + ":" + @属性[x.data_id] + "\n"}
  104.     features.select{|x| x.code == 32}.each{|x| help += CODE[x.code] + ":" + @状态[x.data_id] + "+" + x.value.to_s + "\n"}
  105.     features.select{|x| x.code == 33}.each{|x| help += CODE[x.code] + ":" + x.value.to_s + "\n"}
  106.     features.select{|x| x.code == 34}.each{|x| help += CODE[x.code] + ":" + x.value.to_s + "\n"}
  107.     features.select{|x| x.code == 41}.each{|x| help += CODE[x.code] + ":" + (x.data_id == 1 ? "特技" : "魔法")  + "\n"}
  108.     features.select{|x| x.code == 42}.each{|x| help += CODE[x.code] + ":" + (x.data_id == 1 ? "特技" : "魔法")  + "\n"}
  109.     features.select{|x| x.code == 43}.each{|x| help += CODE[x.code] + ":" + $data_skills[x.data_id].name  + "\n"}
  110.     features.select{|x| x.code == 44}.each{|x| help += CODE[x.code] + ":" + $data_skills[x.data_id].name  + "\n"}
  111.     features.select{|x| x.code == 51}.each{|x| help += CODE[x.code] + ":" + @武器类型[x.data_id]  + "\n"}
  112.     features.select{|x| x.code == 52}.each{|x| help += CODE[x.code] + ":" + @防具类型[x.data_id]  + "\n"}
  113.     features.select{|x| x.code == 61}.each{|x| help += CODE[x.code] + ":" + x.value.to_s  + "\n"}
  114.     features.select{|x| x.code == 62}.each{|x| help += CODE[x.code] + ":" + FLAG[x.data_id]  + "\n"}
  115.     features.select{|x| x.code == 64}.each{|x| help += CODE[x.code] + ":" + @队伍能力[x.data_id]  + "\n"}
  116.     featuresparam = []
  117.     featuresparam.push features.select{|x| x.code == 21}
  118.     featuresparam.push features.select{|x| x.code == 22}
  119.     featuresparam.push features.select{|x| x.code == 23}
  120.     featuresparam[0].each{|x| help += PARAM[x.data_id] + "*" + x.value.to_s + "\n"}
  121.     featuresparam[1].each{|x| help += XPARAM[x.data_id] + x.value.to_s + "\n"}
  122.     featuresparam[2].each{|x| help += SPARAM[x.data_id] + "*" + x.value.to_s + "\n"}
  123.     help
  124.   end
  125.   def self.getline(text,maxtext)
  126.     xtext = []
  127.     line = 0
  128.     text.each_line{|x| xtext.push x.sub(/\n/){}}
  129.     xtext.each{|x| x.size % maxtext != 0 ? line += x.size / maxtext + 1 : line += x.size / maxtext}
  130.     line
  131.   end
  132. end
  133. #==============================================================================
  134. # ■ Window_Help
  135. #------------------------------------------------------------------------------
  136. #  显示特技和物品等的说明、以及角色状态的窗口
  137. #==============================================================================

  138. class Window_Help2 < Window_Base
  139.   #--------------------------------------------------------------------------
  140.   # ● 初始化对象
  141.   #--------------------------------------------------------------------------
  142.   def initialize(line_number = 0)
  143.     super(0, 0, 210, 0)
  144.     self.z = 150
  145.     contents.font.size = 14
  146.     hide
  147.   end
  148.   #--------------------------------------------------------------------------
  149.   # ● 设置内容
  150.   #--------------------------------------------------------------------------
  151.   def set_text(text)
  152.       @text = text
  153.       refresh
  154.   end
  155.   #--------------------------------------------------------------------------
  156.   # ● 清除
  157.   #--------------------------------------------------------------------------
  158.   def clear
  159.     set_text("")
  160.   end
  161.   #--------------------------------------------------------------------------
  162.   # ● 更新帮助位置
  163.   #--------------------------------------------------------------------------
  164.   def uppos(index,rect,window)
  165.     self.height = fitting_height2(Equipplus.getline(@xtext,13))
  166.     create_contents
  167.     contents.font.size = 14
  168.     rect.x -= window.ox
  169.     rect.y -= window.oy
  170.     ax = rect.x + rect.width + 10
  171.     ax = rect.x - self.width + 10 if ax + self.width > window.width + 10
  172.     ax += window.x
  173.     ax = 0 if ax < 0
  174.     ay = rect.y + rect.height
  175.     ay = rect.y - self.height if ay + self.height > window.height
  176.     ay += window.y
  177.     ay = 0 if ay < 0
  178.     self.x = ax
  179.     self.y = ay
  180.     set_text(@xtext)
  181.     show
  182.   end
  183.   #--------------------------------------------------------------------------
  184.   # ● 设置物品
  185.   #     item : 技能、物品等
  186.   #--------------------------------------------------------------------------
  187.   def set_item(item)
  188.     if item == nil
  189.       set_text("")
  190.       return
  191.     end
  192.     @xtext = ""
  193.     @xtext = "名称:" + item.name + "\n"
  194.     @xtext += "介绍:" + item.description + "\n"
  195.     @xtext += "价格:" + item.price.to_s + "\n" if item.is_a?(RPG::EquipItem) || item.is_a?(RPG::Item)
  196.     @xtext += Equipplus.getequiphelp(item) if item.is_a?(RPG::EquipItem)
  197.     @xtext = @xtext[0,@text.size - 2] if @xtext[@xtext.size - 2,2] == "\n"
  198.   end
  199.   #--------------------------------------------------------------------------
  200.   # ● 刷新
  201.   #--------------------------------------------------------------------------
  202.   def refresh
  203.     contents.clear
  204.     hide if @text == ""
  205.     draw_text_ex(4, 0, @text,width,40,false)
  206.   end
  207. end
  208. class Window_Base < Window
  209.   #--------------------------------------------------------------------------
  210.   # ● 计算窗口显示指定行数时的应用高度2*************************
  211.   #--------------------------------------------------------------------------
  212.   def fitting_height2(line_number)
  213.     line_number * contents.font.size + standard_padding * 2
  214.   end
  215. #~ draw_text_ex的增强,使其可以自动换行  原作者:叶子 修改:wyongcan
  216.   #--------------------------------------------------------------------------
  217.   # ● 绘制带有控制符的文本内容
  218.   #   如果传递了width参数的话,会自动换行
  219.   #--------------------------------------------------------------------------
  220.   def draw_text_ex(x, y, text, width = nil,textwidth = nil,normalfont = true)
  221.     reset_font_settings if normalfont == true
  222.     text = convert_escape_characters(text)
  223.     pos = {:x => x, :y => y, :new_x => x, :height => calc_line_height(text)}
  224.     if width != nil
  225.       pos[:height] = contents.font.size
  226.       pos[:width] = width
  227.       pos[:textwidth] = textwidth
  228.     end
  229.     process_character(text.slice!(0, 1), text, pos) until text.empty?
  230.   end
  231.   #--------------------------------------------------------------------------
  232.   # ● 文字的处理
  233.   #     c    : 文字
  234.   #     text : 绘制处理中的字符串缓存(字符串可能会被修改)
  235.   #     pos  : 绘制位置 {:x, :y, :new_x, :height}
  236.   #--------------------------------------------------------------------------
  237.   def process_character(c, text, pos)
  238.     case c
  239.     when "\r"   # 回车
  240.       return
  241.     when "\n"   # 换行
  242.       process_new_line(text, pos)
  243.     when "\f"   # 翻页
  244.       process_new_page(text, pos)
  245.     when "\e"   # 控制符
  246.       process_escape_character(obtain_escape_code(text), text, pos)
  247.     else        # 普通文字
  248.       pos[:textwidth] == nil ? text_width = text_size(c).width : text_width = pos[:textwidth]
  249.       if pos[:width] != nil && pos[:x] - pos[:new_x] + text_width > pos[:width]
  250.         process_new_line(text, pos)
  251.       end
  252.       process_normal_character(c, pos)
  253.     end
  254.   end
  255. end

  256. class Window_ItemList < Window_Selectable
  257.   #--------------------------------------------------------------------------
  258.   # ● 更新帮助内容
  259.   #--------------------------------------------------------------------------
  260.   def update_help
  261.     @help_window.set_item(item)
  262.     @help_window.uppos(index,item_rect(index),self) if index != -1 && item != nil
  263.   end
  264. end

  265. class Window_SkillList < Window_Selectable
  266.   #--------------------------------------------------------------------------
  267.   # ● 更新帮助内容
  268.   #--------------------------------------------------------------------------
  269.   def update_help
  270.     @help_window.set_item(item)
  271.     @help_window.uppos(index,item_rect(index),self) if index != -1 && item != nil
  272.   end
  273. end

  274. class Window_ShopBuy < Window_Selectable
  275.   #--------------------------------------------------------------------------
  276.   # ● 更新帮助内容
  277.   #--------------------------------------------------------------------------
  278.   def update_help
  279.     @help_window.set_item(item) if @help_window
  280.     @help_window.uppos(index,item_rect(index),self) if index != -1 && item != nil && @help_window
  281.     @status_window.item = item if @status_window
  282.   end
  283. end

  284. class Window_EquipSlot < Window_Selectable
  285.   #--------------------------------------------------------------------------
  286.   # ● 更新帮助内容
  287.   #--------------------------------------------------------------------------
  288.   def update_help
  289.     super
  290.     @help_window.set_item(item) if @help_window
  291.     @help_window.uppos(index,item_rect(index),self) if index != -1 && item != nil && @help_window
  292.     @status_window.set_temp_actor(nil) if @status_window
  293.   end
  294. end

  295. class Scene_Shop < Scene_MenuBase
  296.         alias on_sell_ok_old on_sell_ok
  297.         def on_sell_ok
  298.                 on_sell_ok_old
  299.                 @help_window.hide
  300.         end
  301.         alias on_buy_ok_old on_buy_ok
  302.         def on_buy_ok
  303.                 on_buy_ok_old
  304.                 @help_window.hide
  305.         end
  306.         alias on_number_ok_old on_number_ok
  307.         def on_number_ok
  308.                 on_number_ok_old
  309.     @help_window.refresh
  310.                 @help_window.show
  311.         end
  312.         alias on_number_cancel_old on_number_cancel
  313.         def on_number_cancel
  314.                 on_number_cancel_old
  315.     @help_window.refresh
  316.                 @help_window.show
  317.         end
  318. end

  319. class Scene_Title < Scene_Base
  320.   alias start_old start
  321.   def start
  322.     start_old
  323.     Equipplus.equiphelpready
  324.   end
  325. end

  326. class Scene_ItemBase < Scene_MenuBase
  327.         alias old_on_actor_cancel on_actor_cancel
  328.   def on_actor_cancel
  329.     old_on_actor_cancel
  330.         @help_window.refresh
  331.   end
  332.         alias old_on_actor_ok on_actor_ok
  333.   def on_actor_ok
  334.     old_on_actor_ok
  335.         @help_window.refresh
  336.   end
  337. end

  338. class Window_Base < Window
  339.         alias old_process_new_line process_new_line
  340.         def process_new_line(text, pos)
  341.     old_process_new_line(text, pos)
  342.                 pos[:height] = contents.font.size if pos[:width] != nil
  343.         end
  344. end

  345. class Scene_MenuBase < Scene_Base
  346.   def create_help_window
  347.     @help_window = Window_Help2.new
  348.     @help_window.viewport = @viewport
  349.   end
  350. end
  351. class Scene_Battle < Scene_Base
  352.   def create_help_window
  353.     @help_window = Window_Help2.new
  354.     @help_window.visible = false
  355.   end
  356. end
复制代码
回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
50
在线时间
8 小时
注册时间
2012-11-13
帖子
22
8
 楼主| 发表于 2012-12-26 16:39:12 | 只看该作者
谢谢各位大大啦!!!!!
回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
85
在线时间
424 小时
注册时间
2009-8-3
帖子
984
9
发表于 2012-12-26 17:22:36 | 只看该作者
脚本本身应该是没错的,估计是和别的什么脚本冲突了
回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
144
在线时间
628 小时
注册时间
2012-6-9
帖子
1321
10
发表于 2012-12-26 17:49:09 | 只看该作者
本帖最后由 c248611 于 2012-12-26 18:02 编辑

@Mic_洛洛 @迷糊的安安 连贴+重发,

lz有没有放其他脚本一起呢?还是就只有这个脚本?

评分

参与人数 1星屑 +20 收起 理由
Mic_洛洛 + 20 已处理~

查看全部评分

回复 支持 反对

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2024-5-15 01:59

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

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