查看: 2841|回复: 1

[原创发布] 手动式装备评分限制更换

[复制链接]
梦石
0
星屑
29901
在线时间
5734 小时
注册时间
2016-3-8
回帖
1653
发表于 2021-2-19 11:54:01 | 显示全部楼层 |阅读模式

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

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

×
本帖最后由 alexncf125 于 2021-2-19 19:41 编辑

使用方法...往装备的备注栏写上<score:分数>
比如说, 武器A写了<score:10>, 武器B写了<score:200>
写好后...角色装备上武器B时, 会变得不能換装成武器A

注意...这个脚本与最强装备的机制产生了一个小bug...最强装备会是分数最高的装备...但当遇上"最高分数相同的两件装备"的情況时...不会根据两件装备的属性来決定最强装备...所以一是不要写相同的分数, 一是依此折叠内容删除「最强装备」功能[pre lang="ruby"]class Window_EquipCommand < Window_HorzCommand
  def col_max
    return 2
  end

  def make_command_list
    add_command(Vocab::equip2,   :equip)
    add_command(Vocab::clear,    :clear)
  end
end[/pre]


[pre lang="ruby"]class Game_BattlerBase
  alias score_equippable? equippable?
  def equippable?(item)
    if item
      item.note =~ /<score:(\d+)>/i
      new_score = $1.to_i
      if @equips[item.etype_id].object
        @equips[item.etype_id].object.note =~ /<score:(\d+)>/i
        old_score = $1.to_i
      end
    end
    new_score ||= 0; old_score ||= 0
    return false if new_score < old_score
    return score_equippable?(item)
  end
end

class Game_Actor < Game_Battler
  alias score_change_equip change_equip
  def change_equip(slot_id, item)
    if item
      item.note =~ /<score:(\d+)>/i
      new_score = $1.to_i
    end
    if @equips[slot_id].object
      @equips[slot_id].object.note =~ /<score:(\d+)>/i
      old_score = $1.to_i
    end
    new_score ||= 0; old_score ||= 0
    return if new_score < old_score
    return score_change_equip(slot_id, item)
  end
end

class Window_EquipItem < Window_ItemList

  def include?(item)
    return true if item == nil
    return false unless item.is_a?(RPG::EquipItem)
    return false if @slot_id < 0
    return false if item.etype_id != @actor.equip_slots[@slot_id]
    return true#~     return @actor.equippable?(item)
  end
  
  def enable?(item)
    return true if item.nil?
    return @actor.equippable?(item)#~     return true
  end

end[/pre]
梦石
0
星屑
1107
在线时间
126 小时
注册时间
2020-11-27
回帖
48
发表于 2021-2-23 12:14:06 | 显示全部楼层
支持大佬!
回复

使用道具 举报

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

本版积分规则

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

在本版发帖返回顶部