Project1

标题: 再问个问题厄~怎么样设置装备需求 [打印本页]

作者: holwar天下    时间: 2008-2-6 00:31
提示: 作者被禁止或删除 内容自动屏蔽
作者: superufo    时间: 2008-2-6 00:34
提示: 作者被禁止或删除 内容自动屏蔽
作者: 越前リョーマ    时间: 2008-2-6 00:39
这个XP里也有人写过,

找LS的S大叔专门写一个好了……{/hx}
作者: holwar天下    时间: 2008-2-6 00:41
提示: 作者被禁止或删除 内容自动屏蔽
作者: superufo    时间: 2008-2-6 00:45
提示: 作者被禁止或删除 内容自动屏蔽
作者: 越前リョーマ    时间: 2008-2-6 00:46
以下引用superufo于2008-2-5 16:45:36的发言:

一般来说200积分吧

很便宜呀……{/hx}
作者: superufo    时间: 2008-2-6 00:48
提示: 作者被禁止或删除 内容自动屏蔽
作者: holwar天下    时间: 2008-2-6 01:46
提示: 作者被禁止或删除 内容自动屏蔽
作者: 亿万星辰    时间: 2008-2-6 02:05
这个简单,几分钟就OK了...{/hx}

写的比较仓促,在默认系统下的装备界面中应该无误。

  1. #==============================================================================
  2. # BY 亿万星辰@1012 脚本屋
  3. # 使用方法:武器、防具名称后用@分隔等级,如:长剑@2,就代表长剑需要2级才可装备。
  4. #==============================================================================
  5. module RPG
  6.   class Weapon
  7.     def name
  8.       return @name.split("@")[0]
  9.     end
  10.     def level
  11.       return @name.split("@")[1].to_i
  12.     end
  13.   end
  14.   class Armor
  15.     def name
  16.       return @name.split("@")[0]
  17.     end
  18.     def level
  19.       return @name.split("@")[1].to_i
  20.     end
  21.   end
  22. end

  23. #==============================================================================
  24. # ■ Window_EquipItem
  25. #------------------------------------------------------------------------------
  26. #  装備画面で、装備変更の候補となるアイテムの一覧を表示するウィンドウです。
  27. #==============================================================================

  28. class Window_EquipItem < Window_Item
  29.   #--------------------------------------------------------------------------
  30.   # ● 項目の描画
  31.   #     index : 項目番号
  32.   #--------------------------------------------------------------------------
  33.   def draw_item(index)
  34.     rect = item_rect(index)
  35.     self.contents.clear_rect(rect)
  36.     item = @data[index]
  37.     if item != nil
  38.       number = $game_party.item_number(item)
  39.       enabled = enable?(item)
  40.       rect.width -= 4
  41.       draw_item_name(item, rect.x, rect.y, enabled)
  42.       self.contents.draw_text(rect, sprintf(":%2d", number), 2)
  43.     end
  44.   end
  45.   #--------------------------------------------------------------------------
  46.   # ● アイテムを許可状態で表示するかどうか
  47.   #     item : アイテム
  48.   #--------------------------------------------------------------------------
  49.   def enable?(item)
  50.     return @actor.level >= item.level
  51.   end
  52.   #--------------------------------------------------------------------------
  53.   # ● 当前是否可装备
  54.   #--------------------------------------------------------------------------
  55.   def enabled?
  56.     return true if self.item.nil?
  57.     return @actor.level >= @data[self.index].level
  58.   end
  59. end

  60. #==============================================================================
  61. # ■ Scene_Equip
  62. #------------------------------------------------------------------------------
  63. #  装備画面の処理を行うクラスです。
  64. #==============================================================================

  65. class Scene_Equip < Scene_Base
  66.   #--------------------------------------------------------------------------
  67.   # ● アイテム選択の更新
  68.   #--------------------------------------------------------------------------
  69.   def update_item_selection
  70.     if Input.trigger?(Input::B)
  71.       Sound.play_cancel
  72.       @equip_window.active = true
  73.       @item_window.active = false
  74.       @item_window.index = -1
  75.     elsif Input.trigger?(Input::C)
  76.       if @item_window.enabled?
  77.         Sound.play_equip
  78.         @actor.change_equip(@equip_window.index, @item_window.item)
  79.         @equip_window.active = true
  80.         @item_window.active = false
  81.         @item_window.index = -1
  82.         @equip_window.refresh
  83.         for item_window in @item_windows
  84.           item_window.refresh
  85.         end
  86.       else
  87.         Sound.play_buzzer
  88.       end
  89.     end
  90.   end
  91. end
复制代码
[LINE]1,#dddddd[/LINE]系统信息:本贴由楼主认可为正确答案,66RPG感谢您的热情解答~
作者: holwar天下    时间: 2008-2-6 02:16
提示: 作者被禁止或删除 内容自动屏蔽




欢迎光临 Project1 (https://rpg.blue/) Powered by Discuz! X3.1