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

Project1

 找回密码
 注册会员
搜索

请问怎样去掉该脚本后的@字样

查看数: 2422 | 评论数: 10 | 收藏 0
关灯 | 提示:支持键盘翻页<-左 右->
    组图打开中,请稍候......
发布时间: 2015-3-14 19:08

正文摘要:

本帖最后由 qkqwe 于 2015-3-14 19:09 编辑 在站里找了一个能够普通攻击两次和群攻的脚本,但是在装备栏和物品栏中总是显示红线内的”@“字样,请问该怎么去掉呢?下面附上脚本,麻烦诸位大神了! 附上问题图: ...

回复

qkqwe 发表于 2015-3-18 20:17:40
芯☆淡茹水 发表于 2015-3-17 21:37
已改

感谢大神!完美解决!
芯☆淡茹水 发表于 2015-3-17 21:37:05
已改
  1. #==============================================================================
  2. # 本脚本来自[url]www.66RPG.com[/url],使用和转载请保留此信息
  3. #==============================================================================
  4. #==============================================================================
  5. # ■ Harts_Window_ItemTitle
  6. #------------------------------------------------------------------------------
  7. #  アイテム画面で、タイトルを表示するウィンドウ。
  8. #==============================================================================
  9. class Harts_Window_ItemTitle < Window_Base
  10.   #--------------------------------------------------------------------------
  11.   # ● オブジェクト初期化
  12.   #--------------------------------------------------------------------------
  13.   def initialize
  14.     super(0, 0, 160, 64)
  15.     self.contents = Bitmap.new(width - 32, height - 32)
  16.     self.contents.clear
  17.     self.contents.font.color = normal_color
  18.     self.contents.draw_text(4, 0, 120, 32, $data_system.words.item, 1)
  19.   end
  20. end
  21. #==============================================================================
  22. # ■ Harts_Window_ItemCommand
  23. #------------------------------------------------------------------------------
  24. #  アイテムの種別選択を行うウィンドウです。
  25. #==============================================================================
  26. class Harts_Window_ItemCommand < Window_Selectable
  27.   #--------------------------------------------------------------------------
  28.   # ● オブジェクト初期化
  29.   #--------------------------------------------------------------------------
  30.   def initialize
  31.     super(0, 64, 160, 288)
  32.     self.contents = Bitmap.new(width - 32, height - 32)
  33.     @item_max = 8
  34.     @commands = ["一般用", "战斗用", $data_system.words.weapon, $data_system.words.armor1, $data_system.words.armor2, $data_system.words.armor3, $data_system.words.armor4, "特殊道具"]
  35.     refresh
  36.     self.index = 0
  37.   end
  38.   #--------------------------------------------------------------------------
  39.   # ● リフレッシュ
  40.   #--------------------------------------------------------------------------
  41.   def refresh
  42.     self.contents.clear
  43.     for i in 0...@item_max
  44.     draw_item(i, normal_color)
  45.     end
  46.   end
  47.   #--------------------------------------------------------------------------
  48.   # ● 項目の描画
  49.   # index : 項目番号
  50.   # color : 文字色
  51.   #--------------------------------------------------------------------------
  52.   def draw_item(index, color)
  53.     self.contents.font.color = color
  54.     y = index * 32
  55.     self.contents.draw_text(4, y, 128, 32, @commands[index])
  56.   end
  57.   #--------------------------------------------------------------------------
  58.   # ● ヘルプテキスト更新
  59.   #--------------------------------------------------------------------------
  60.   def update_help
  61.     case self.index
  62.     when 0
  63.       @text = @commands[0]
  64.     when 1
  65.       @text = @commands[1]
  66.     when 2
  67.       @text = @commands[2]
  68.     when 3
  69.       @text = @commands[3]
  70.     when 4
  71.       @text = @commands[4]
  72.     when 5
  73.       @text = @commands[5]
  74.     when 6
  75.       @text = @commands[6]
  76.     when 7
  77.       @text = @commands[7]
  78.     end
  79.     @help_window.set_text(@text)
  80.   end
  81. end
  82. #==============================================================================
  83. # ■ Window_Item
  84. #------------------------------------------------------------------------------
  85. #  アイテム画面で、所持アイテムの一覧を表示するウィンドウです。
  86. #==============================================================================
  87. class Harts_Window_ItemList < Window_Selectable
  88.   #--------------------------------------------------------------------------
  89.   # ● オブジェクト初期化
  90.   #--------------------------------------------------------------------------
  91.   def initialize
  92.     super(160, 0, 480, 416)
  93.     refresh
  94.     self.index = 0
  95.   end
  96.   #--------------------------------------------------------------------------
  97.   # ● アイテムの取得
  98.   #--------------------------------------------------------------------------
  99.   def item
  100.     return @data[self.index]
  101.   end
  102.   #--------------------------------------------------------------------------
  103.   # ● リフレッシュ
  104.   #--------------------------------------------------------------------------
  105.   def refresh
  106.     if self.contents != nil
  107.       self.contents.dispose
  108.       self.contents = nil
  109.     end
  110.     @data = []
  111.   end
  112.   #--------------------------------------------------------------------------
  113.   # ● アイテム一覧設定
  114.   # command : 選択中のコマンド
  115.   #--------------------------------------------------------------------------
  116.   def set_item(command)
  117.     refresh
  118.     case command
  119.     when 0
  120.       for i in 1...$data_items.size
  121.         if ($data_items[i].occasion == 0 or $data_items[i].occasion == 2) and $game_party.item_number(i) > 0
  122.           @data.push($data_items[i])
  123.         end
  124.       end
  125.     when 1
  126.       for i in 1...$data_items.size
  127.         if ($data_items[i].occasion == 1 and $game_party.item_number(i) > 0)
  128.           @data.push($data_items[i])
  129.         end
  130.       end
  131.     when 2
  132.       for i in 1...$data_weapons.size
  133.         if $game_party.weapon_number(i) > 0
  134.           @data.push($data_weapons[i])
  135.         end
  136.       end
  137.     when 3
  138.       for i in 1...$data_armors.size
  139.         if $data_armors[i].kind == 0 and $game_party.armor_number(i) > 0
  140.           @data.push($data_armors[i])
  141.         end
  142.       end
  143.     when 4
  144.       for i in 1...$data_armors.size
  145.         if $data_armors[i].kind == 1 and $game_party.armor_number(i) > 0
  146.           @data.push($data_armors[i])
  147.         end
  148.       end
  149.     when 5
  150.       for i in 1...$data_armors.size
  151.         if $data_armors[i].kind == 2 and $game_party.armor_number(i) > 0
  152.           @data.push($data_armors[i])
  153.         end
  154.       end
  155.     when 6
  156.       for i in 1...$data_armors.size
  157.         if $data_armors[i].kind == 3 and $game_party.armor_number(i) > 0
  158.           @data.push($data_armors[i])
  159.         end
  160.       end
  161.     when 7
  162.       for i in 1...$data_items.size
  163.         if $data_items[i].occasion == 3 and $game_party.item_number(i) > 0
  164.           @data.push($data_items[i])
  165.         end
  166.       end
  167.     end
  168.     # 項目数が 0 でなければビットマップを作成し、全項目を描画
  169.     @item_max = @data.size
  170.     if @item_max > 0
  171.       self.contents = Bitmap.new(width - 32, row_max * 32)
  172.       self.contents.clear
  173.       for i in 0...@item_max
  174.         draw_item(i)
  175.       end
  176.     end
  177.   end
  178.   #--------------------------------------------------------------------------
  179.   # ● 種類別アイテム数の取得
  180.   #--------------------------------------------------------------------------
  181.   def item_number
  182.     return @item_max
  183.   end
  184.   #--------------------------------------------------------------------------
  185.   # ● 項目の描画
  186.   # index : 項目番号
  187.   #--------------------------------------------------------------------------
  188.   def draw_item(index)
  189.     item = @data[index]
  190.     case item
  191.     when RPG::Item
  192.       number = $game_party.item_number(item.id)
  193.     when RPG::Weapon
  194.       number = $game_party.weapon_number(item.id)
  195.     when RPG::Armor
  196.       number = $game_party.armor_number(item.id)
  197.     end
  198.     if item.is_a?(RPG::Item) and
  199.       $game_party.item_can_use?(item.id)
  200.       self.contents.font.color = normal_color
  201.     else
  202.       self.contents.font.color = disabled_color
  203.     end
  204.     x = 4
  205.     y = index * 32
  206.     bitmap = RPG::Cache.icon(item.icon_name)
  207.     opacity = self.contents.font.color == normal_color ? 255 : 128
  208.     self.contents.blt(x, y + 4, bitmap, Rect.new(0, 0, 24, 24), opacity)
  209.     self.contents.draw_text(x + 28, y, 212, 32, item.name.split("@")[0], 0)
  210.     self.contents.draw_text(x + 400, y, 16, 32, ":", 1)
  211.     self.contents.draw_text(x + 416, y, 24, 32, number.to_s, 2)
  212.   end
  213.   #--------------------------------------------------------------------------
  214.   # ● ヘルプテキスト更新
  215.   #--------------------------------------------------------------------------
  216.   def update_help
  217.     @help_window.set_text(self.item == nil ? "" : self.item.description)
  218.   end
  219. end
  220. #==============================================================================
  221. # ■ Harts_Scene_Item
  222. #------------------------------------------------------------------------------
  223. #  アイテム画面の処理を行うクラスです。再定義
  224. #==============================================================================
  225. class Scene_Item
  226.   #--------------------------------------------------------------------------
  227.   # ● メイン処理
  228.   #--------------------------------------------------------------------------
  229.   def main
  230.     # タイトルウィンドウを作成
  231.     @itemtitle_window = Harts_Window_ItemTitle.new
  232.     #コマンドウィンドウを作成
  233.     @itemcommand_window = Harts_Window_ItemCommand.new
  234.     @command_index = @itemcommand_window.index
  235.     #アイテムウィンドウを作成
  236.     @itemlist_window = Harts_Window_ItemList.new
  237.     @itemlist_window.active = false
  238.     #ヘルプウィンドウを作成
  239.     @help_window = Window_Help.new
  240.     @help_window.x = 0
  241.     @help_window.y = 416
  242.     # ヘルプウィンドウを関連付け
  243.     @itemcommand_window.help_window = @help_window
  244.     @itemlist_window.help_window = @help_window
  245.     # ターゲットウィンドウを作成 (不可視?非アクティブに設定)
  246.     @target_window = Window_Target.new
  247.     @target_window.visible = false
  248.     @target_window.active = false
  249.     # アイテムウィンドウ内容表示
  250.     @itemlist_window.set_item(@command_index)
  251.     # トランジション実行
  252.     Graphics.transition
  253.     # メインループ
  254.     loop do
  255.       # ゲーム画面を更新
  256.       Graphics.update
  257.       # 入力情報を更新
  258.       Input.update
  259.       # フレーム更新
  260.       update
  261.       # 画面が切り替わったらループを中断
  262.       if $scene != self
  263.         break
  264.       end
  265.     end
  266.     # トランジション準備
  267.     Graphics.freeze
  268.     # ウィンドウを解放
  269.     @itemtitle_window.dispose
  270.     @itemcommand_window.dispose
  271.     @itemlist_window.dispose
  272.     @help_window.dispose
  273.     @target_window.dispose
  274.   end
  275.   #--------------------------------------------------------------------------
  276.   # ● フレーム更新
  277.   #--------------------------------------------------------------------------
  278.   def update
  279.     # ウィンドウを更新
  280.     @itemtitle_window.update
  281.     @itemcommand_window.update
  282.     @itemlist_window.update
  283.     @help_window.update
  284.     @target_window.update
  285.     if @command_index != @itemcommand_window.index
  286.       @command_index = @itemcommand_window.index
  287.       @itemlist_window.set_item(@command_index)
  288.     end
  289.     # コマンドウィンドウがアクティブの場合: update_itemcommand を呼ぶ
  290.     if @itemcommand_window.active
  291.       update_itemcommand
  292.       return
  293.     end
  294.     # アイテムウィンドウがアクティブの場合: update_itemlist を呼ぶ
  295.     if @itemlist_window.active
  296.       update_itemlist
  297.       return
  298.     end
  299.     # ターゲットウィンドウがアクティブの場合: update_target を呼ぶ
  300.     if @target_window.active
  301.       update_target
  302.       return
  303.     end
  304.   end
  305.   #--------------------------------------------------------------------------
  306.   # ● フレーム更新 (コマンドウィンドウがアクティブの場合)
  307.   #--------------------------------------------------------------------------
  308.   def update_itemcommand
  309.   # B ボタンが押された場合
  310.   if Input.trigger?(Input::B)
  311.   # キャンセル SE を演奏
  312.   $game_system.se_play($data_system.cancel_se)
  313.   # メニュー画面に切り替え
  314.   $scene = Scene_Menu.new(0)
  315.   return
  316.   end
  317.   # C ボタンが押された場合
  318.   if Input.trigger?(Input::C)
  319.   # 選択中のコマンドのアイテムがない場合
  320.   if @itemlist_window.item_number == 0
  321.   # ブザー SE を演奏
  322.   $game_system.se_play($data_system.buzzer_se)
  323.   return
  324.   end
  325.   # 決定 SE を演奏
  326.   $game_system.se_play($data_system.decision_se)
  327.   # アイテムウィンドウをアクティブにする
  328.   @itemcommand_window.active = false
  329.   @itemlist_window.active = true
  330.   @itemlist_window.index = 0
  331.   return
  332.   end
  333.   end
  334.   #--------------------------------------------------------------------------
  335.   # ● フレーム更新 (アイテムウィンドウがアクティブの場合)
  336.   #--------------------------------------------------------------------------
  337.   def update_itemlist
  338.     # B ボタンが押された場合
  339.     if Input.trigger?(Input::B)
  340.       # キャンセル SE を演奏
  341.       $game_system.se_play($data_system.cancel_se)
  342.       # アイテムウィンドウをアクティブにする
  343.       @itemcommand_window.active = true
  344.       @itemlist_window.active = false
  345.       @itemlist_window.index = 0
  346.       @itemcommand_window.index = @command_index
  347.       return
  348.     end
  349.     # C ボタンが押された場合
  350.     if Input.trigger?(Input::C)
  351.       # アイテムウィンドウで現在選択されているデータを取得
  352.       @item = @itemlist_window.item
  353.       # 使用アイテムではない場合
  354.       unless @item.is_a?(RPG::Item)
  355.         # ブザー SE を演奏
  356.         $game_system.se_play($data_system.buzzer_se)
  357.         return
  358.       end
  359.       # 使用できない場合
  360.       unless $game_party.item_can_use?(@item.id)
  361.         # ブザー SE を演奏
  362.         $game_system.se_play($data_system.buzzer_se)
  363.         return
  364.       end
  365.       # 決定 SE を演奏
  366.       $game_system.se_play($data_system.decision_se)
  367.       # 効果範囲が味方の場合
  368.       if @item.scope >= 3
  369.         # ターゲットウィンドウをアクティブ化
  370.         @itemlist_window.active = false
  371.         @target_window.x = 304
  372.         @target_window.visible = true
  373.         @target_window.active = true
  374.         # 効果範囲 (単体/全体) に応じてカーソル位置を設定
  375.         if @item.scope == 4 || @item.scope == 6
  376.           @target_window.index = -1
  377.         else
  378.           @target_window.index = 0
  379.         end
  380.         # 効果範囲が味方以外の場合
  381.       else
  382.         # コモンイベント ID が有効の場合
  383.         if @item.common_event_id > 0
  384.           # コモンイベント呼び出し予約
  385.           $game_temp.common_event_id = @item.common_event_id
  386.           # アイテムの使用時 SE を演奏
  387.           $game_system.se_play(@item.menu_se)
  388.           # 消耗品の場合
  389.             if @item.consumable
  390.               # 使用したアイテムを 1 減らす
  391.               $game_party.lose_item(@item.id, 1)
  392.               # アイテムウィンドウの項目を再描画
  393.               @itemlist_window.draw_item(@itemlist_window.index)
  394.             end
  395.           # マップ画面に切り替え
  396.           $scene = Scene_Map.new
  397.           return
  398.         end
  399.       end
  400.       return
  401.     end
  402.   end
  403.   #--------------------------------------------------------------------------
  404.   # ● フレーム更新 (ターゲットウィンドウがアクティブの場合)
  405.   #--------------------------------------------------------------------------
  406.   def update_target
  407.     # B ボタンが押された場合
  408.     if Input.trigger?(Input::B)
  409.       # キャンセル SE を演奏
  410.       $game_system.se_play($data_system.cancel_se)
  411.       # アイテム切れなどで使用できなくなった場合
  412.       unless $game_party.item_can_use?(@item.id)
  413.         # アイテムウィンドウの内容を再作成
  414.         @itemlist_window.refresh
  415.       end
  416.       # ターゲットウィンドウを消去
  417.       @itemlist_window.active = true
  418.       @target_window.visible = false
  419.       @target_window.active = false
  420.       @itemlist_window.set_item(@command_index)
  421.       return
  422.     end
  423.     # C ボタンが押された場合
  424.     if Input.trigger?(Input::C)
  425.       # アイテムを使い切った場合
  426.       if $game_party.item_number(@item.id) == 0
  427.         # ブザー SE を演奏
  428.         $game_system.se_play($data_system.buzzer_se)
  429.         return
  430.       end
  431.       # ターゲットが全体の場合
  432.       if @target_window.index == -1
  433.         # パーティ全体にアイテムの使用効果を適用
  434.         used = false
  435.         for i in $game_party.actors
  436.           used |= i.item_effect(@item)
  437.         end
  438.       end
  439.       # ターゲットが単体の場合
  440.       if @target_window.index >= 0
  441.         # ターゲットのアクターにアイテムの使用効果を適用
  442.         target = $game_party.actors[@target_window.index]
  443.         used = target.item_effect(@item)
  444.       end
  445.       # アイテムを使った場合
  446.       if used
  447.         # アイテムの使用時 SE を演奏
  448.         $game_system.se_play(@item.menu_se)
  449.         # 消耗品の場合
  450.         if @item.consumable
  451.           # 使用したアイテムを 1 減らす
  452.           $game_party.lose_item(@item.id, 1)
  453.           # アイテムウィンドウの項目を再描画
  454.           @itemlist_window.draw_item(@itemlist_window.index)
  455.           @itemlist_window.set_item(@command_index)
  456.         end
  457.         # ターゲットウィンドウの内容を再作成
  458.         @target_window.refresh
  459.         # 全滅の場合
  460.         if $game_party.all_dead?
  461.           # ゲームオーバー画面に切り替え
  462.           $scene = Scene_Gameover.new
  463.           return
  464.         end
  465.         # コモンイベント ID が有効の場合
  466.         if @item.common_event_id > 0
  467.           # コモンイベント呼び出し予約
  468.           $game_temp.common_event_id = @item.common_event_id
  469.           # マップ画面に切り替え
  470.           $scene = Scene_Map.new
  471.           return
  472.         end
  473.       end
  474.       # アイテムを使わなかった場合
  475.       unless used
  476.         # ブザー SE を演奏
  477.         $game_system.se_play($data_system.buzzer_se)
  478.       end
  479.     return
  480.     end
  481.   end
  482. end
  483. #==============================================================================
  484. # 本脚本来自[url]www.66RPG.com[/url],使用和转载请保留此信息
  485. #==============================================================================
复制代码
  1. #==============================================================================
  2. # 本脚本来自[url]www.66RPG.com[/url],使用和转载请保留此信息
  3. #==============================================================================  
  4. #==============================================================================
  5. # ■ Window_Base
  6. #------------------------------------------------------------------------------
  7. #  游戏中全部窗口的超级类。
  8. #==============================================================================
  9. class Window_Base < Window
  10.   def up_color
  11.     return Color.new(255, 0, 0)
  12.   end
  13.   def down_color
  14.     return Color.new(0, 255, 0)
  15.   end
  16.   #--------------------------------------------------------------------------
  17.   # ● 描绘能力值
  18.   #     actor : 角色
  19.   #     x     : 描画目标 X 坐标
  20.   #     y     : 描画目标 Y 坐标
  21.   #     type  : 能力值种类 (0~6)
  22.   #--------------------------------------------------------------------------
  23.   def draw_actor_parameter(actor, x, y, type)
  24.     case type
  25.     when 0
  26.       parameter_name = $data_system.words.atk
  27.       parameter_value = actor.atk
  28.     when 1
  29.       parameter_name = $data_system.words.pdef
  30.       parameter_value = actor.pdef
  31.     when 2
  32.       parameter_name = $data_system.words.mdef
  33.       parameter_value = actor.mdef
  34.     when 3
  35.       parameter_name = $data_system.words.str
  36.       parameter_value = actor.str
  37.     when 4
  38.       parameter_name = $data_system.words.dex
  39.       parameter_value = actor.dex
  40.     when 5
  41.       parameter_name = $data_system.words.agi
  42.       parameter_value = actor.agi
  43.     when 6
  44.       parameter_name = $data_system.words.int
  45.       parameter_value = actor.int
  46.     ###############################################################
  47.     when 7
  48.       parameter_name = "回避"
  49.       parameter_value = actor.eva
  50.     end
  51.     self.contents.font.color = system_color
  52.     self.contents.draw_text(x, y, 120, 32, parameter_name)
  53.     self.contents.font.color = normal_color
  54.     self.contents.draw_text(x + 120, y, 36, 32, parameter_value.to_s, 2)
  55.   end
  56. end
  57. #==============================================================================
  58. # ■ Window_EquipLeft
  59. #------------------------------------------------------------------------------
  60. #  装备画面的、显示角色能力值变化的窗口。
  61. #==============================================================================
  62. class Window_EquipLeft < Window_Base
  63.   UP_ICON = "048-Skill05"
  64.   DOWN_ICON = "047-Skill04"
  65.   #--------------------------------------------------------------------------
  66.   # ● 初始化对像
  67.   #     actor : 角色
  68.   #--------------------------------------------------------------------------
  69.   def initialize(actor)
  70.     super(0, 64, 272, 416)
  71.     self.contents = Bitmap.new(width - 32, height - 32)
  72.     @actor = actor
  73.     refresh
  74.   end
  75.   #--------------------------------------------------------------------------
  76.   # ● 刷新
  77.   #--------------------------------------------------------------------------
  78.   def refresh
  79.     self.contents.clear
  80.     draw_actor_name(@actor, 4, 0)
  81.     draw_actor_level(@actor, 4, 32)
  82.     ###############################################################
  83.     draw_actor_parameter(@actor, 4, 64, 0)
  84.     draw_actor_parameter(@actor, 4, 96, 1)
  85.     draw_actor_parameter(@actor, 4, 128, 2)
  86.     draw_actor_parameter(@actor, 4, 160, 7)
  87.     draw_actor_parameter(@actor, 4, 192, 3)
  88.     draw_actor_parameter(@actor, 4, 224, 4)
  89.     draw_actor_parameter(@actor, 4, 256, 5)
  90.     draw_actor_parameter(@actor, 4, 288, 6)
  91.     if @new_atk != nil
  92.       if @new_atk > @actor.atk
  93.         self.contents.blt(164, 64, RPG::Cache.icon(UP_ICON), Rect.new(0, 0, 24, 24))
  94.       elsif @new_atk < @actor.atk
  95.         self.contents.blt(164, 64, RPG::Cache.icon(DOWN_ICON), Rect.new(0, 0, 24, 24))
  96.       end
  97.       self.contents.font.color = @new_atk>@actor.atk ? up_color : down_color
  98.       self.contents.font.color = normal_color if @new_atk == @actor.atk
  99.       self.contents.draw_text(200, 64, 36, 32, @new_atk.to_s, 2)
  100.     end
  101.     if @new_pdef != nil
  102.       if @new_pdef > @actor.pdef
  103.         self.contents.blt(164, 96, RPG::Cache.icon(UP_ICON), Rect.new(0, 0, 24, 24))
  104.       elsif @new_pdef < @actor.pdef
  105.         self.contents.blt(164, 96, RPG::Cache.icon(DOWN_ICON), Rect.new(0, 0, 24, 24))
  106.       end
  107.       self.contents.font.color = @new_pdef>@actor.pdef ? up_color : down_color
  108.       self.contents.font.color = normal_color if @new_pdef == @actor.pdef
  109.       self.contents.draw_text(200, 96, 36, 32, @new_pdef.to_s, 2)
  110.     end
  111.     if @new_mdef != nil
  112.       if @new_mdef > @actor.mdef
  113.         self.contents.blt(164, 128, RPG::Cache.icon(UP_ICON), Rect.new(0, 0, 24, 24))
  114.       elsif @new_mdef < @actor.mdef
  115.         self.contents.blt(164, 128, RPG::Cache.icon(DOWN_ICON), Rect.new(0, 0, 24, 24))
  116.       end
  117.       self.contents.font.color = @new_mdef>@actor.mdef ? up_color : down_color
  118.       self.contents.font.color = normal_color if @new_mdef == @actor.mdef
  119.       self.contents.draw_text(200, 128, 36, 32, @new_mdef.to_s, 2)
  120.     end
  121.     if @new_eva != nil
  122.       if @new_eva > @actor.eva
  123.         self.contents.blt(164, 160, RPG::Cache.icon(UP_ICON), Rect.new(0, 0, 24, 24))
  124.       elsif @new_eva < @actor.eva
  125.         self.contents.blt(164, 160, RPG::Cache.icon(DOWN_ICON), Rect.new(0, 0, 24, 24))
  126.       end
  127.       self.contents.font.color = @new_eva>@actor.eva ? up_color : down_color
  128.       self.contents.font.color = normal_color if @new_eva == @actor.eva
  129.       self.contents.draw_text(200, 160, 36, 32, @new_eva.to_s, 2)
  130.     end
  131.     if @new_str != nil
  132.       if @new_str > @actor.str
  133.         self.contents.blt(164, 192, RPG::Cache.icon(UP_ICON), Rect.new(0, 0, 24, 24))
  134.       elsif @new_str < @actor.str
  135.         self.contents.blt(164, 192, RPG::Cache.icon(DOWN_ICON), Rect.new(0, 0, 24, 24))
  136.       end
  137.       self.contents.font.color = @new_str>@actor.str ? up_color : down_color
  138.       self.contents.font.color = normal_color if @new_str == @actor.str
  139.       self.contents.draw_text(200, 192, 36, 32, @new_str.to_s, 2)
  140.     end
  141.     if @new_dex != nil
  142.       if @new_dex > @actor.dex
  143.         self.contents.blt(164, 224, RPG::Cache.icon(UP_ICON), Rect.new(0, 0, 24, 24))
  144.       elsif @new_dex < @actor.dex
  145.         self.contents.blt(164, 224, RPG::Cache.icon(DOWN_ICON), Rect.new(0, 0, 24, 24))
  146.       end
  147.       self.contents.font.color = @new_dex>@actor.dex ? up_color : down_color
  148.       self.contents.font.color = normal_color if @new_dex == @actor.dex
  149.       self.contents.draw_text(200, 224, 36, 32, @new_dex.to_s, 2)
  150.     end
  151.     if @new_agi != nil
  152.       if @new_agi > @actor.agi
  153.         self.contents.blt(164, 256, RPG::Cache.icon(UP_ICON), Rect.new(0, 0, 24, 24))
  154.       elsif @new_agi < @actor.agi
  155.         self.contents.blt(164, 256, RPG::Cache.icon(DOWN_ICON), Rect.new(0, 0, 24, 24))
  156.       end
  157.       self.contents.font.color = @new_agi>@actor.agi ? up_color : down_color
  158.       self.contents.font.color = normal_color if @new_agi == @actor.agi
  159.       self.contents.draw_text(200, 256, 36, 32, @new_agi.to_s, 2)
  160.     end
  161.     if @new_int != nil
  162.       if @new_int > @actor.int
  163.         self.contents.blt(164, 288, RPG::Cache.icon(UP_ICON), Rect.new(0, 0, 24, 24))
  164.       elsif @new_int < @actor.int
  165.         self.contents.blt(164, 288, RPG::Cache.icon(DOWN_ICON), Rect.new(0, 0, 24, 24))
  166.       end
  167.       self.contents.font.color = @new_int>@actor.int ? up_color : down_color
  168.       self.contents.font.color = normal_color if @new_int == @actor.int
  169.       self.contents.draw_text(200, 288, 36, 32, @new_int.to_s, 2)
  170.     end
  171.   end
  172.   #--------------------------------------------------------------------------
  173.   # ● 变更装备后的能力值设置
  174.   #     new_atk  : 变更装备后的攻击力
  175.   #     new_pdef : 变更装备后的物理防御
  176.   #     new_mdef : 变更装备后的魔法防御
  177.   #--------------------------------------------------------------------------
  178.     ###############################################################
  179.   def set_new_parameters(new_atk, new_pdef, new_mdef, new_eva, new_str, new_dex, new_agi, new_int)
  180.     if @new_atk != new_atk or @new_pdef !=new_pdef or @new_mdef != new_mdef or @new_eva != new_eva or @new_str != new_str or @new_dex !=new_dex or @new_agi != new_agi or @new_int != new_int
  181.       @new_atk = new_atk
  182.       @new_pdef = new_pdef
  183.       @new_mdef = new_mdef
  184.       @new_eva = new_eva
  185.       @new_str = new_str
  186.       @new_dex = new_dex
  187.       @new_agi = new_agi
  188.       @new_int = new_int
  189.       refresh
  190.     end
  191.   end
  192. end
  193. #==============================================================================
  194. # ■ Window_EquipItem
  195. #------------------------------------------------------------------------------
  196. #  装备画面、显示浏览变更装备的候补物品的窗口。
  197. #==============================================================================
  198. class Window_EquipItem < Window_Selectable
  199.   #--------------------------------------------------------------------------
  200.   # ● 初始化对像
  201.   #     actor      : 角色
  202.   #     equip_type : 装备部位 (0~3)
  203.   #--------------------------------------------------------------------------
  204.   def initialize(actor, equip_type)
  205.     ################改了改坐标和高度#################################
  206.     super(272, 256, 368, 224)
  207.     @actor = actor
  208.     @equip_type = equip_type
  209.     @column_max = 1
  210.     refresh
  211.     self.active = false
  212.     self.index = -1
  213.   end
  214.   #--------------------------------------------------------------------------
  215.   # ● 项目的描绘
  216.   #     index : 项目符号
  217.   #--------------------------------------------------------------------------
  218.   def draw_item(index)
  219.     item = @data[index]
  220.     ################改了改坐标#################################
  221.     x = 4
  222.     y = index * 32
  223.     case item
  224.     when RPG::Weapon
  225.       number = $game_party.weapon_number(item.id)
  226.     when RPG::Armor
  227.       number = $game_party.armor_number(item.id)
  228.     end
  229.     bitmap = RPG::Cache.icon(item.icon_name)
  230.     self.contents.blt(x, y + 4, bitmap, Rect.new(0, 0, 24, 24))
  231.     self.contents.font.color = normal_color
  232.     self.contents.draw_text(x + 28, y, 212, 32, item.name.split("@")[0], 0)
  233.     self.contents.draw_text(x + 240, y, 16, 32, ":", 1)
  234.     self.contents.draw_text(x + 256, y, 24, 32, number.to_s, 2)
  235.   end
  236. end
  237. #==============================================================================
  238. # ■ Scene_Equip
  239. #------------------------------------------------------------------------------
  240. #  处理装备画面的类。
  241. #==============================================================================
  242. class Scene_Equip
  243.   #--------------------------------------------------------------------------
  244.   # ● 刷新
  245.   #--------------------------------------------------------------------------
  246.   def refresh
  247.     # 设置物品窗口的可视状态
  248.     @item_window1.visible = (@right_window.index == 0)
  249.     @item_window2.visible = (@right_window.index == 1)
  250.     @item_window3.visible = (@right_window.index == 2)
  251.     @item_window4.visible = (@right_window.index == 3)
  252.     @item_window5.visible = (@right_window.index == 4)
  253.     # 获取当前装备中的物品
  254.     item1 = @right_window.item
  255.     # 设置当前的物品窗口到 @item_window
  256.     case @right_window.index
  257.     when 0
  258.       @item_window = @item_window1
  259.     when 1
  260.       @item_window = @item_window2
  261.     when 2
  262.       @item_window = @item_window3
  263.     when 3
  264.       @item_window = @item_window4
  265.     when 4
  266.       @item_window = @item_window5
  267.     end
  268.     # 右窗口被激活的情况下
  269.     if @right_window.active
  270.       # 删除变更装备后的能力
  271.     ###############################################################
  272.       @left_window.set_new_parameters(nil, nil, nil, nil, nil, nil, nil, nil)
  273.     end
  274.     # 物品窗口被激活的情况下
  275.     if @item_window.active
  276.       # 获取现在选中的物品
  277.       item2 = @item_window.item
  278.       # 变更装备
  279.       last_hp = @actor.hp
  280.       last_sp = @actor.sp
  281.       @actor.equip(@right_window.index, item2 == nil ? 0 : item2.id)
  282.       # 获取变更装备后的能力值
  283.     ###############################################################
  284.       new_atk = @actor.atk
  285.       new_pdef = @actor.pdef
  286.       new_mdef = @actor.mdef
  287.       new_eva = @actor.eva
  288.       new_str = @actor.str
  289.       new_dex = @actor.dex
  290.       new_agi = @actor.agi
  291.       new_int = @actor.int
  292.       # 返回到装备
  293.       @actor.equip(@right_window.index, item1 == nil ? 0 : item1.id)
  294.       @actor.hp = last_hp
  295.       @actor.sp = last_sp
  296.       # 描画左窗口
  297.     ###############################################################
  298.       @left_window.set_new_parameters(new_atk, new_pdef, new_mdef, new_eva, new_str, new_dex, new_agi, new_int)
  299.     end
  300.   end
  301. end
  302. #==============================================================================
  303. # 本脚本来自[url]www.66RPG.com[/url],使用和转载请保留此信息
  304. #==============================================================================
复制代码

评分

参与人数 1星屑 +100 梦石 +1 收起 理由
RyanBern + 100 + 1 认可答案

查看全部评分

qkqwe 发表于 2015-3-17 12:01:26
qkqwe 发表于 2015-3-15 18:19
谢谢大神,用了脚本后的确装备区内@后的字样不见了,不过还是出现了俩个问题,如下面俩图1)下方红框装备 ...

抱歉,大神,附上物品分类和装备界面脚本
物品分类:
RUBY 代码复制
  1. #==============================================================================
  2. # 本脚本来自[url]www.66RPG.com[/url],使用和转载请保留此信息
  3. #==============================================================================
  4. #==============================================================================
  5. # ■ Harts_Window_ItemTitle
  6. #------------------------------------------------------------------------------
  7. #  アイテム画面で、タイトルを表示するウィンドウ。
  8. #==============================================================================
  9. class Harts_Window_ItemTitle < Window_Base
  10.   #--------------------------------------------------------------------------
  11.   # ● オブジェクト初期化
  12.   #--------------------------------------------------------------------------
  13.   def initialize
  14.     super(0, 0, 160, 64)
  15.     self.contents = Bitmap.new(width - 32, height - 32)
  16.     self.contents.clear
  17.     self.contents.font.color = normal_color
  18.     self.contents.draw_text(4, 0, 120, 32, $data_system.words.item, 1)
  19.   end
  20. end
  21. #==============================================================================
  22. # ■ Harts_Window_ItemCommand
  23. #------------------------------------------------------------------------------
  24. #  アイテムの種別選択を行うウィンドウです。
  25. #==============================================================================
  26. class Harts_Window_ItemCommand < Window_Selectable
  27.   #--------------------------------------------------------------------------
  28.   # ● オブジェクト初期化
  29.   #--------------------------------------------------------------------------
  30.   def initialize
  31.     super(0, 64, 160, 288)
  32.     self.contents = Bitmap.new(width - 32, height - 32)
  33.     @item_max = 8
  34.     @commands = ["一般用", "战斗用", $data_system.words.weapon, $data_system.words.armor1, $data_system.words.armor2, $data_system.words.armor3, $data_system.words.armor4, "特殊道具"]
  35.     refresh
  36.     self.index = 0
  37.   end
  38.   #--------------------------------------------------------------------------
  39.   # ● リフレッシュ
  40.   #--------------------------------------------------------------------------
  41.   def refresh
  42.     self.contents.clear
  43.     for i in 0...@item_max
  44.     draw_item(i, normal_color)
  45.     end
  46.   end
  47.   #--------------------------------------------------------------------------
  48.   # ● 項目の描画
  49.   # index : 項目番号
  50.   # color : 文字色
  51.   #--------------------------------------------------------------------------
  52.   def draw_item(index, color)
  53.     self.contents.font.color = color
  54.     y = index * 32
  55.     self.contents.draw_text(4, y, 128, 32, @commands[index])
  56.   end
  57.   #--------------------------------------------------------------------------
  58.   # ● ヘルプテキスト更新
  59.   #--------------------------------------------------------------------------
  60.   def update_help
  61.     case self.index
  62.     when 0
  63.       @text = @commands[0]
  64.     when 1
  65.       @text = @commands[1]
  66.     when 2
  67.       @text = @commands[2]
  68.     when 3
  69.       @text = @commands[3]
  70.     when 4
  71.       @text = @commands[4]
  72.     when 5
  73.       @text = @commands[5]
  74.     when 6
  75.       @text = @commands[6]
  76.     when 7
  77.       @text = @commands[7]
  78.     end
  79.     @help_window.set_text(@text)
  80.   end
  81. end
  82. #==============================================================================
  83. # ■ Window_Item
  84. #------------------------------------------------------------------------------
  85. #  アイテム画面で、所持アイテムの一覧を表示するウィンドウです。
  86. #==============================================================================
  87. class Harts_Window_ItemList < Window_Selectable
  88.   #--------------------------------------------------------------------------
  89.   # ● オブジェクト初期化
  90.   #--------------------------------------------------------------------------
  91.   def initialize
  92.     super(160, 0, 480, 416)
  93.     refresh
  94.     self.index = 0
  95.   end
  96.   #--------------------------------------------------------------------------
  97.   # ● アイテムの取得
  98.   #--------------------------------------------------------------------------
  99.   def item
  100.     return @data[self.index]
  101.   end
  102.   #--------------------------------------------------------------------------
  103.   # ● リフレッシュ
  104.   #--------------------------------------------------------------------------
  105.   def refresh
  106.     if self.contents != nil
  107.       self.contents.dispose
  108.       self.contents = nil
  109.     end
  110.     @data = []
  111.   end
  112.   #--------------------------------------------------------------------------
  113.   # ● アイテム一覧設定
  114.   # command : 選択中のコマンド
  115.   #--------------------------------------------------------------------------
  116.   def set_item(command)
  117.     refresh
  118.     case command
  119.     when 0
  120.       for i in 1...$data_items.size
  121.         if ($data_items[i].occasion == 0 or $data_items[i].occasion == 2) and $game_party.item_number(i) > 0
  122.           @data.push($data_items[i])
  123.         end
  124.       end
  125.     when 1
  126.       for i in 1...$data_items.size
  127.         if ($data_items[i].occasion == 1 and $game_party.item_number(i) > 0)
  128.           @data.push($data_items[i])
  129.         end
  130.       end
  131.     when 2
  132.       for i in 1...$data_weapons.size
  133.         if $game_party.weapon_number(i) > 0
  134.           @data.push($data_weapons[i])
  135.         end
  136.       end
  137.     when 3
  138.       for i in 1...$data_armors.size
  139.         if $data_armors[i].kind == 0 and $game_party.armor_number(i) > 0
  140.           @data.push($data_armors[i])
  141.         end
  142.       end
  143.     when 4
  144.       for i in 1...$data_armors.size
  145.         if $data_armors[i].kind == 1 and $game_party.armor_number(i) > 0
  146.           @data.push($data_armors[i])
  147.         end
  148.       end
  149.     when 5
  150.       for i in 1...$data_armors.size
  151.         if $data_armors[i].kind == 2 and $game_party.armor_number(i) > 0
  152.           @data.push($data_armors[i])
  153.         end
  154.       end
  155.     when 6
  156.       for i in 1...$data_armors.size
  157.         if $data_armors[i].kind == 3 and $game_party.armor_number(i) > 0
  158.           @data.push($data_armors[i])
  159.         end
  160.       end
  161.     when 7
  162.       for i in 1...$data_items.size
  163.         if $data_items[i].occasion == 3 and $game_party.item_number(i) > 0
  164.           @data.push($data_items[i])
  165.         end
  166.       end
  167.     end
  168.     # 項目数が 0 でなければビットマップを作成し、全項目を描画
  169.     @item_max = @data.size
  170.     if @item_max > 0
  171.       self.contents = Bitmap.new(width - 32, row_max * 32)
  172.       self.contents.clear
  173.       for i in 0...@item_max
  174.         draw_item(i)
  175.       end
  176.     end
  177.   end
  178.   #--------------------------------------------------------------------------
  179.   # ● 種類別アイテム数の取得
  180.   #--------------------------------------------------------------------------
  181.   def item_number
  182.     return @item_max
  183.   end
  184.   #--------------------------------------------------------------------------
  185.   # ● 項目の描画
  186.   # index : 項目番号
  187.   #--------------------------------------------------------------------------
  188.   def draw_item(index)
  189.     item = @data[index]
  190.     case item
  191.     when RPG::Item
  192.       number = $game_party.item_number(item.id)
  193.     when RPG::Weapon
  194.       number = $game_party.weapon_number(item.id)
  195.     when RPG::Armor
  196.       number = $game_party.armor_number(item.id)
  197.     end
  198.     if item.is_a?(RPG::Item) and
  199.       $game_party.item_can_use?(item.id)
  200.       self.contents.font.color = normal_color
  201.     else
  202.       self.contents.font.color = disabled_color
  203.     end
  204.     x = 4
  205.     y = index * 32
  206.     bitmap = RPG::Cache.icon(item.icon_name)
  207.     opacity = self.contents.font.color == normal_color ? 255 : 128
  208.     self.contents.blt(x, y + 4, bitmap, Rect.new(0, 0, 24, 24), opacity)
  209.     self.contents.draw_text(x + 28, y, 212, 32, item.name, 0)
  210.     self.contents.draw_text(x + 400, y, 16, 32, ":", 1)
  211.     self.contents.draw_text(x + 416, y, 24, 32, number.to_s, 2)
  212.   end
  213.   #--------------------------------------------------------------------------
  214.   # ● ヘルプテキスト更新
  215.   #--------------------------------------------------------------------------
  216.   def update_help
  217.     @help_window.set_text(self.item == nil ? "" : self.item.description)
  218.   end
  219. end
  220. #==============================================================================
  221. # ■ Harts_Scene_Item
  222. #------------------------------------------------------------------------------
  223. #  アイテム画面の処理を行うクラスです。再定義
  224. #==============================================================================
  225. class Scene_Item
  226.   #--------------------------------------------------------------------------
  227.   # ● メイン処理
  228.   #--------------------------------------------------------------------------
  229.   def main
  230.     # タイトルウィンドウを作成
  231.     @itemtitle_window = Harts_Window_ItemTitle.new
  232.     #コマンドウィンドウを作成
  233.     @itemcommand_window = Harts_Window_ItemCommand.new
  234.     @command_index = @itemcommand_window.index
  235.     #アイテムウィンドウを作成
  236.     @itemlist_window = Harts_Window_ItemList.new
  237.     @itemlist_window.active = false
  238.     #ヘルプウィンドウを作成
  239.     @help_window = Window_Help.new
  240.     @help_window.x = 0
  241.     @help_window.y = 416
  242.     # ヘルプウィンドウを関連付け
  243.     @itemcommand_window.help_window = @help_window
  244.     @itemlist_window.help_window = @help_window
  245.     # ターゲットウィンドウを作成 (不可視?非アクティブに設定)
  246.     @target_window = Window_Target.new
  247.     @target_window.visible = false
  248.     @target_window.active = false
  249.     # アイテムウィンドウ内容表示
  250.     @itemlist_window.set_item(@command_index)
  251.     # トランジション実行
  252.     Graphics.transition
  253.     # メインループ
  254.     loop do
  255.       # ゲーム画面を更新
  256.       Graphics.update
  257.       # 入力情報を更新
  258.       Input.update
  259.       # フレーム更新
  260.       update
  261.       # 画面が切り替わったらループを中断
  262.       if $scene != self
  263.         break
  264.       end
  265.     end
  266.     # トランジション準備
  267.     Graphics.freeze
  268.     # ウィンドウを解放
  269.     @itemtitle_window.dispose
  270.     @itemcommand_window.dispose
  271.     @itemlist_window.dispose
  272.     @help_window.dispose
  273.     @target_window.dispose
  274.   end
  275.   #--------------------------------------------------------------------------
  276.   # ● フレーム更新
  277.   #--------------------------------------------------------------------------
  278.   def update
  279.     # ウィンドウを更新
  280.     @itemtitle_window.update
  281.     @itemcommand_window.update
  282.     @itemlist_window.update
  283.     @help_window.update
  284.     @target_window.update
  285.     if @command_index != @itemcommand_window.index
  286.       @command_index = @itemcommand_window.index
  287.       @itemlist_window.set_item(@command_index)
  288.     end
  289.     # コマンドウィンドウがアクティブの場合: update_itemcommand を呼ぶ
  290.     if @itemcommand_window.active
  291.       update_itemcommand
  292.       return
  293.     end
  294.     # アイテムウィンドウがアクティブの場合: update_itemlist を呼ぶ
  295.     if @itemlist_window.active
  296.       update_itemlist
  297.       return
  298.     end
  299.     # ターゲットウィンドウがアクティブの場合: update_target を呼ぶ
  300.     if @target_window.active
  301.       update_target
  302.       return
  303.     end
  304.   end
  305.   #--------------------------------------------------------------------------
  306.   # ● フレーム更新 (コマンドウィンドウがアクティブの場合)
  307.   #--------------------------------------------------------------------------
  308.   def update_itemcommand
  309.   # B ボタンが押された場合
  310.   if Input.trigger?(Input::B)
  311.   # キャンセル SE を演奏
  312.   $game_system.se_play($data_system.cancel_se)
  313.   # メニュー画面に切り替え
  314.   $scene = Scene_Menu.new(0)
  315.   return
  316.   end
  317.   # C ボタンが押された場合
  318.   if Input.trigger?(Input::C)
  319.   # 選択中のコマンドのアイテムがない場合
  320.   if @itemlist_window.item_number == 0
  321.   # ブザー SE を演奏
  322.   $game_system.se_play($data_system.buzzer_se)
  323.   return
  324.   end
  325.   # 決定 SE を演奏
  326.   $game_system.se_play($data_system.decision_se)
  327.   # アイテムウィンドウをアクティブにする
  328.   @itemcommand_window.active = false
  329.   @itemlist_window.active = true
  330.   @itemlist_window.index = 0
  331.   return
  332.   end
  333.   end
  334.   #--------------------------------------------------------------------------
  335.   # ● フレーム更新 (アイテムウィンドウがアクティブの場合)
  336.   #--------------------------------------------------------------------------
  337.   def update_itemlist
  338.     # B ボタンが押された場合
  339.     if Input.trigger?(Input::B)
  340.       # キャンセル SE を演奏
  341.       $game_system.se_play($data_system.cancel_se)
  342.       # アイテムウィンドウをアクティブにする
  343.       @itemcommand_window.active = true
  344.       @itemlist_window.active = false
  345.       @itemlist_window.index = 0
  346.       @itemcommand_window.index = @command_index
  347.       return
  348.     end
  349.     # C ボタンが押された場合
  350.     if Input.trigger?(Input::C)
  351.       # アイテムウィンドウで現在選択されているデータを取得
  352.       @item = @itemlist_window.item
  353.       # 使用アイテムではない場合
  354.       unless @item.is_a?(RPG::Item)
  355.         # ブザー SE を演奏
  356.         $game_system.se_play($data_system.buzzer_se)
  357.         return
  358.       end
  359.       # 使用できない場合
  360.       unless $game_party.item_can_use?(@item.id)
  361.         # ブザー SE を演奏
  362.         $game_system.se_play($data_system.buzzer_se)
  363.         return
  364.       end
  365.       # 決定 SE を演奏
  366.       $game_system.se_play($data_system.decision_se)
  367.       # 効果範囲が味方の場合
  368.       if @item.scope >= 3
  369.         # ターゲットウィンドウをアクティブ化
  370.         @itemlist_window.active = false
  371.         @target_window.x = 304
  372.         @target_window.visible = true
  373.         @target_window.active = true
  374.         # 効果範囲 (単体/全体) に応じてカーソル位置を設定
  375.         if @item.scope == 4 || @item.scope == 6
  376.           @target_window.index = -1
  377.         else
  378.           @target_window.index = 0
  379.         end
  380.         # 効果範囲が味方以外の場合
  381.       else
  382.         # コモンイベント ID が有効の場合
  383.         if @item.common_event_id > 0
  384.           # コモンイベント呼び出し予約
  385.           $game_temp.common_event_id = @item.common_event_id
  386.           # アイテムの使用時 SE を演奏
  387.           $game_system.se_play(@item.menu_se)
  388.           # 消耗品の場合
  389.             if @item.consumable
  390.               # 使用したアイテムを 1 減らす
  391.               $game_party.lose_item(@item.id, 1)
  392.               # アイテムウィンドウの項目を再描画
  393.               @itemlist_window.draw_item(@itemlist_window.index)
  394.             end
  395.           # マップ画面に切り替え
  396.           $scene = Scene_Map.new
  397.           return
  398.         end
  399.       end
  400.       return
  401.     end
  402.   end
  403.   #--------------------------------------------------------------------------
  404.   # ● フレーム更新 (ターゲットウィンドウがアクティブの場合)
  405.   #--------------------------------------------------------------------------
  406.   def update_target
  407.     # B ボタンが押された場合
  408.     if Input.trigger?(Input::B)
  409.       # キャンセル SE を演奏
  410.       $game_system.se_play($data_system.cancel_se)
  411.       # アイテム切れなどで使用できなくなった場合
  412.       unless $game_party.item_can_use?(@item.id)
  413.         # アイテムウィンドウの内容を再作成
  414.         @itemlist_window.refresh
  415.       end
  416.       # ターゲットウィンドウを消去
  417.       @itemlist_window.active = true
  418.       @target_window.visible = false
  419.       @target_window.active = false
  420.       @itemlist_window.set_item(@command_index)
  421.       return
  422.     end
  423.     # C ボタンが押された場合
  424.     if Input.trigger?(Input::C)
  425.       # アイテムを使い切った場合
  426.       if $game_party.item_number(@item.id) == 0
  427.         # ブザー SE を演奏
  428.         $game_system.se_play($data_system.buzzer_se)
  429.         return
  430.       end
  431.       # ターゲットが全体の場合
  432.       if @target_window.index == -1
  433.         # パーティ全体にアイテムの使用効果を適用
  434.         used = false
  435.         for i in $game_party.actors
  436.           used |= i.item_effect(@item)
  437.         end
  438.       end
  439.       # ターゲットが単体の場合
  440.       if @target_window.index >= 0
  441.         # ターゲットのアクターにアイテムの使用効果を適用
  442.         target = $game_party.actors[@target_window.index]
  443.         used = target.item_effect(@item)
  444.       end
  445.       # アイテムを使った場合
  446.       if used
  447.         # アイテムの使用時 SE を演奏
  448.         $game_system.se_play(@item.menu_se)
  449.         # 消耗品の場合
  450.         if @item.consumable
  451.           # 使用したアイテムを 1 減らす
  452.           $game_party.lose_item(@item.id, 1)
  453.           # アイテムウィンドウの項目を再描画
  454.           @itemlist_window.draw_item(@itemlist_window.index)
  455.           @itemlist_window.set_item(@command_index)
  456.         end
  457.         # ターゲットウィンドウの内容を再作成
  458.         @target_window.refresh
  459.         # 全滅の場合
  460.         if $game_party.all_dead?
  461.           # ゲームオーバー画面に切り替え
  462.           $scene = Scene_Gameover.new
  463.           return
  464.         end
  465.         # コモンイベント ID が有効の場合
  466.         if @item.common_event_id > 0
  467.           # コモンイベント呼び出し予約
  468.           $game_temp.common_event_id = @item.common_event_id
  469.           # マップ画面に切り替え
  470.           $scene = Scene_Map.new
  471.           return
  472.         end
  473.       end
  474.       # アイテムを使わなかった場合
  475.       unless used
  476.         # ブザー SE を演奏
  477.         $game_system.se_play($data_system.buzzer_se)
  478.       end
  479.     return
  480.     end
  481.   end
  482. end
  483. #==============================================================================
  484. # 本脚本来自[url]www.66RPG.com[/url],使用和转载请保留此信息
  485. #==============================================================================


装备界面:
RUBY 代码复制
  1. #==============================================================================
  2. # 本脚本来自[url]www.66RPG.com[/url],使用和转载请保留此信息
  3. #==============================================================================  
  4. #==============================================================================
  5. # ■ Window_Base
  6. #------------------------------------------------------------------------------
  7. #  游戏中全部窗口的超级类。
  8. #==============================================================================
  9. class Window_Base < Window
  10.   def up_color
  11.     return Color.new(255, 0, 0)
  12.   end
  13.   def down_color
  14.     return Color.new(0, 255, 0)
  15.   end
  16.   #--------------------------------------------------------------------------
  17.   # ● 描绘能力值
  18.   #     actor : 角色
  19.   #     x     : 描画目标 X 坐标
  20.   #     y     : 描画目标 Y 坐标
  21.   #     type  : 能力值种类 (0~6)
  22.   #--------------------------------------------------------------------------
  23.   def draw_actor_parameter(actor, x, y, type)
  24.     case type
  25.     when 0
  26.       parameter_name = $data_system.words.atk
  27.       parameter_value = actor.atk
  28.     when 1
  29.       parameter_name = $data_system.words.pdef
  30.       parameter_value = actor.pdef
  31.     when 2
  32.       parameter_name = $data_system.words.mdef
  33.       parameter_value = actor.mdef
  34.     when 3
  35.       parameter_name = $data_system.words.str
  36.       parameter_value = actor.str
  37.     when 4
  38.       parameter_name = $data_system.words.dex
  39.       parameter_value = actor.dex
  40.     when 5
  41.       parameter_name = $data_system.words.agi
  42.       parameter_value = actor.agi
  43.     when 6
  44.       parameter_name = $data_system.words.int
  45.       parameter_value = actor.int
  46.     ###############################################################
  47.     when 7
  48.       parameter_name = "回避"
  49.       parameter_value = actor.eva
  50.     end
  51.     self.contents.font.color = system_color
  52.     self.contents.draw_text(x, y, 120, 32, parameter_name)
  53.     self.contents.font.color = normal_color
  54.     self.contents.draw_text(x + 120, y, 36, 32, parameter_value.to_s, 2)
  55.   end
  56. end
  57. #==============================================================================
  58. # ■ Window_EquipLeft
  59. #------------------------------------------------------------------------------
  60. #  装备画面的、显示角色能力值变化的窗口。
  61. #==============================================================================
  62. class Window_EquipLeft < Window_Base
  63.   UP_ICON = "048-Skill05"
  64.   DOWN_ICON = "047-Skill04"
  65.   #--------------------------------------------------------------------------
  66.   # ● 初始化对像
  67.   #     actor : 角色
  68.   #--------------------------------------------------------------------------
  69.   def initialize(actor)
  70.     super(0, 64, 272, 416)
  71.     self.contents = Bitmap.new(width - 32, height - 32)
  72.     @actor = actor
  73.     refresh
  74.   end
  75.   #--------------------------------------------------------------------------
  76.   # ● 刷新
  77.   #--------------------------------------------------------------------------
  78.   def refresh
  79.     self.contents.clear
  80.     draw_actor_name(@actor, 4, 0)
  81.     draw_actor_level(@actor, 4, 32)
  82.     ###############################################################
  83.     draw_actor_parameter(@actor, 4, 64, 0)
  84.     draw_actor_parameter(@actor, 4, 96, 1)
  85.     draw_actor_parameter(@actor, 4, 128, 2)
  86.     draw_actor_parameter(@actor, 4, 160, 7)
  87.     draw_actor_parameter(@actor, 4, 192, 3)
  88.     draw_actor_parameter(@actor, 4, 224, 4)
  89.     draw_actor_parameter(@actor, 4, 256, 5)
  90.     draw_actor_parameter(@actor, 4, 288, 6)
  91.     if @new_atk != nil
  92.       if @new_atk > @actor.atk
  93.         self.contents.blt(164, 64, RPG::Cache.icon(UP_ICON), Rect.new(0, 0, 24, 24))
  94.       elsif @new_atk < @actor.atk
  95.         self.contents.blt(164, 64, RPG::Cache.icon(DOWN_ICON), Rect.new(0, 0, 24, 24))
  96.       end
  97.       self.contents.font.color = @new_atk>@actor.atk ? up_color : down_color
  98.       self.contents.font.color = normal_color if @new_atk == @actor.atk
  99.       self.contents.draw_text(200, 64, 36, 32, @new_atk.to_s, 2)
  100.     end
  101.     if @new_pdef != nil
  102.       if @new_pdef > @actor.pdef
  103.         self.contents.blt(164, 96, RPG::Cache.icon(UP_ICON), Rect.new(0, 0, 24, 24))
  104.       elsif @new_pdef < @actor.pdef
  105.         self.contents.blt(164, 96, RPG::Cache.icon(DOWN_ICON), Rect.new(0, 0, 24, 24))
  106.       end
  107.       self.contents.font.color = @new_pdef>@actor.pdef ? up_color : down_color
  108.       self.contents.font.color = normal_color if @new_pdef == @actor.pdef
  109.       self.contents.draw_text(200, 96, 36, 32, @new_pdef.to_s, 2)
  110.     end
  111.     if @new_mdef != nil
  112.       if @new_mdef > @actor.mdef
  113.         self.contents.blt(164, 128, RPG::Cache.icon(UP_ICON), Rect.new(0, 0, 24, 24))
  114.       elsif @new_mdef < @actor.mdef
  115.         self.contents.blt(164, 128, RPG::Cache.icon(DOWN_ICON), Rect.new(0, 0, 24, 24))
  116.       end
  117.       self.contents.font.color = @new_mdef>@actor.mdef ? up_color : down_color
  118.       self.contents.font.color = normal_color if @new_mdef == @actor.mdef
  119.       self.contents.draw_text(200, 128, 36, 32, @new_mdef.to_s, 2)
  120.     end
  121.     if @new_eva != nil
  122.       if @new_eva > @actor.eva
  123.         self.contents.blt(164, 160, RPG::Cache.icon(UP_ICON), Rect.new(0, 0, 24, 24))
  124.       elsif @new_eva < @actor.eva
  125.         self.contents.blt(164, 160, RPG::Cache.icon(DOWN_ICON), Rect.new(0, 0, 24, 24))
  126.       end
  127.       self.contents.font.color = @new_eva>@actor.eva ? up_color : down_color
  128.       self.contents.font.color = normal_color if @new_eva == @actor.eva
  129.       self.contents.draw_text(200, 160, 36, 32, @new_eva.to_s, 2)
  130.     end
  131.     if @new_str != nil
  132.       if @new_str > @actor.str
  133.         self.contents.blt(164, 192, RPG::Cache.icon(UP_ICON), Rect.new(0, 0, 24, 24))
  134.       elsif @new_str < @actor.str
  135.         self.contents.blt(164, 192, RPG::Cache.icon(DOWN_ICON), Rect.new(0, 0, 24, 24))
  136.       end
  137.       self.contents.font.color = @new_str>@actor.str ? up_color : down_color
  138.       self.contents.font.color = normal_color if @new_str == @actor.str
  139.       self.contents.draw_text(200, 192, 36, 32, @new_str.to_s, 2)
  140.     end
  141.     if @new_dex != nil
  142.       if @new_dex > @actor.dex
  143.         self.contents.blt(164, 224, RPG::Cache.icon(UP_ICON), Rect.new(0, 0, 24, 24))
  144.       elsif @new_dex < @actor.dex
  145.         self.contents.blt(164, 224, RPG::Cache.icon(DOWN_ICON), Rect.new(0, 0, 24, 24))
  146.       end
  147.       self.contents.font.color = @new_dex>@actor.dex ? up_color : down_color
  148.       self.contents.font.color = normal_color if @new_dex == @actor.dex
  149.       self.contents.draw_text(200, 224, 36, 32, @new_dex.to_s, 2)
  150.     end
  151.     if @new_agi != nil
  152.       if @new_agi > @actor.agi
  153.         self.contents.blt(164, 256, RPG::Cache.icon(UP_ICON), Rect.new(0, 0, 24, 24))
  154.       elsif @new_agi < @actor.agi
  155.         self.contents.blt(164, 256, RPG::Cache.icon(DOWN_ICON), Rect.new(0, 0, 24, 24))
  156.       end
  157.       self.contents.font.color = @new_agi>@actor.agi ? up_color : down_color
  158.       self.contents.font.color = normal_color if @new_agi == @actor.agi
  159.       self.contents.draw_text(200, 256, 36, 32, @new_agi.to_s, 2)
  160.     end
  161.     if @new_int != nil
  162.       if @new_int > @actor.int
  163.         self.contents.blt(164, 288, RPG::Cache.icon(UP_ICON), Rect.new(0, 0, 24, 24))
  164.       elsif @new_int < @actor.int
  165.         self.contents.blt(164, 288, RPG::Cache.icon(DOWN_ICON), Rect.new(0, 0, 24, 24))
  166.       end
  167.       self.contents.font.color = @new_int>@actor.int ? up_color : down_color
  168.       self.contents.font.color = normal_color if @new_int == @actor.int
  169.       self.contents.draw_text(200, 288, 36, 32, @new_int.to_s, 2)
  170.     end
  171.   end
  172.   #--------------------------------------------------------------------------
  173.   # ● 变更装备后的能力值设置
  174.   #     new_atk  : 变更装备后的攻击力
  175.   #     new_pdef : 变更装备后的物理防御
  176.   #     new_mdef : 变更装备后的魔法防御
  177.   #--------------------------------------------------------------------------
  178.     ###############################################################
  179.   def set_new_parameters(new_atk, new_pdef, new_mdef, new_eva, new_str, new_dex, new_agi, new_int)
  180.     if @new_atk != new_atk or @new_pdef !=new_pdef or @new_mdef != new_mdef or @new_eva != new_eva or @new_str != new_str or @new_dex !=new_dex or @new_agi != new_agi or @new_int != new_int
  181.       @new_atk = new_atk
  182.       @new_pdef = new_pdef
  183.       @new_mdef = new_mdef
  184.       @new_eva = new_eva
  185.       @new_str = new_str
  186.       @new_dex = new_dex
  187.       @new_agi = new_agi
  188.       @new_int = new_int
  189.       refresh
  190.     end
  191.   end
  192. end
  193. #==============================================================================
  194. # ■ Window_EquipItem
  195. #------------------------------------------------------------------------------
  196. #  装备画面、显示浏览变更装备的候补物品的窗口。
  197. #==============================================================================
  198. class Window_EquipItem < Window_Selectable
  199.   #--------------------------------------------------------------------------
  200.   # ● 初始化对像
  201.   #     actor      : 角色
  202.   #     equip_type : 装备部位 (0~3)
  203.   #--------------------------------------------------------------------------
  204.   def initialize(actor, equip_type)
  205.     ################改了改坐标和高度#################################
  206.     super(272, 256, 368, 224)
  207.     @actor = actor
  208.     @equip_type = equip_type
  209.     @column_max = 1
  210.     refresh
  211.     self.active = false
  212.     self.index = -1
  213.   end
  214.   #--------------------------------------------------------------------------
  215.   # ● 项目的描绘
  216.   #     index : 项目符号
  217.   #--------------------------------------------------------------------------
  218.   def draw_item(index)
  219.     item = @data[index]
  220.     ################改了改坐标#################################
  221.     x = 4
  222.     y = index * 32
  223.     case item
  224.     when RPG::Weapon
  225.       number = $game_party.weapon_number(item.id)
  226.     when RPG::Armor
  227.       number = $game_party.armor_number(item.id)
  228.     end
  229.     bitmap = RPG::Cache.icon(item.icon_name)
  230.     self.contents.blt(x, y + 4, bitmap, Rect.new(0, 0, 24, 24))
  231.     self.contents.font.color = normal_color
  232.     self.contents.draw_text(x + 28, y, 212, 32, item.name, 0)
  233.     self.contents.draw_text(x + 240, y, 16, 32, ":", 1)
  234.     self.contents.draw_text(x + 256, y, 24, 32, number.to_s, 2)
  235.   end
  236. end
  237. #==============================================================================
  238. # ■ Scene_Equip
  239. #------------------------------------------------------------------------------
  240. #  处理装备画面的类。
  241. #==============================================================================
  242. class Scene_Equip
  243.   #--------------------------------------------------------------------------
  244.   # ● 刷新
  245.   #--------------------------------------------------------------------------
  246.   def refresh
  247.     # 设置物品窗口的可视状态
  248.     @item_window1.visible = (@right_window.index == 0)
  249.     @item_window2.visible = (@right_window.index == 1)
  250.     @item_window3.visible = (@right_window.index == 2)
  251.     @item_window4.visible = (@right_window.index == 3)
  252.     @item_window5.visible = (@right_window.index == 4)
  253.     # 获取当前装备中的物品
  254.     item1 = @right_window.item
  255.     # 设置当前的物品窗口到 @item_window
  256.     case @right_window.index
  257.     when 0
  258.       @item_window = @item_window1
  259.     when 1
  260.       @item_window = @item_window2
  261.     when 2
  262.       @item_window = @item_window3
  263.     when 3
  264.       @item_window = @item_window4
  265.     when 4
  266.       @item_window = @item_window5
  267.     end
  268.     # 右窗口被激活的情况下
  269.     if @right_window.active
  270.       # 删除变更装备后的能力
  271.     ###############################################################
  272.       @left_window.set_new_parameters(nil, nil, nil, nil, nil, nil, nil, nil)
  273.     end
  274.     # 物品窗口被激活的情况下
  275.     if @item_window.active
  276.       # 获取现在选中的物品
  277.       item2 = @item_window.item
  278.       # 变更装备
  279.       last_hp = @actor.hp
  280.       last_sp = @actor.sp
  281.       @actor.equip(@right_window.index, item2 == nil ? 0 : item2.id)
  282.       # 获取变更装备后的能力值
  283.     ###############################################################
  284.       new_atk = @actor.atk
  285.       new_pdef = @actor.pdef
  286.       new_mdef = @actor.mdef
  287.       new_eva = @actor.eva
  288.       new_str = @actor.str
  289.       new_dex = @actor.dex
  290.       new_agi = @actor.agi
  291.       new_int = @actor.int
  292.       # 返回到装备
  293.       @actor.equip(@right_window.index, item1 == nil ? 0 : item1.id)
  294.       @actor.hp = last_hp
  295.       @actor.sp = last_sp
  296.       # 描画左窗口
  297.     ###############################################################
  298.       @left_window.set_new_parameters(new_atk, new_pdef, new_mdef, new_eva, new_str, new_dex, new_agi, new_int)
  299.     end
  300.   end
  301. end
  302. #==============================================================================
  303. # 本脚本来自[url]www.66RPG.com[/url],使用和转载请保留此信息
  304. #==============================================================================
芯☆淡茹水 发表于 2015-3-15 10:21:02
  1. #==============================================================================
  2. class Window_EquipItem < Window_Selectable
  3.   #--------------------------------------------------------------------------
  4.   def draw_item(index)
  5.     item = @data[index]
  6.     x = 4 + index % 2 * (288 + 32)
  7.     y = index / 2 * 32
  8.     case item
  9.     when RPG::Weapon
  10.       number = $game_party.weapon_number(item.id)
  11.     when RPG::Armor
  12.       number = $game_party.armor_number(item.id)
  13.     end
  14.     bitmap = RPG::Cache.icon(item.icon_name)
  15.     self.contents.blt(x, y + 4, bitmap, Rect.new(0, 0, 24, 24))
  16.     self.contents.font.color = normal_color
  17.     self.contents.draw_text(x + 28, y, 212, 32, item.name.split("@")[0], 0)
  18.     self.contents.draw_text(x + 240, y, 16, 32, ":", 1)
  19.     self.contents.draw_text(x + 256, y, 24, 32, number.to_s, 2)
  20.   end
  21. end
  22. class Window_Item < Window_Selectable
  23.   #--------------------------------------------------------------------------
  24.   def draw_item(index)
  25.     item = @data[index]
  26.     case item
  27.     when RPG::Item
  28.       number = $game_party.item_number(item.id)
  29.     when RPG::Weapon
  30.       number = $game_party.weapon_number(item.id)
  31.     when RPG::Armor
  32.       number = $game_party.armor_number(item.id)
  33.     end
  34.     if item.is_a?(RPG::Item) and
  35.        $game_party.item_can_use?(item.id)
  36.       self.contents.font.color = normal_color
  37.     else
  38.       self.contents.font.color = disabled_color
  39.     end
  40.     x = 4 + index % 2 * (288 + 32)
  41.     y = index / 2 * 32
  42.     rect = Rect.new(x, y, self.width / @column_max - 32, 32)
  43.     self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
  44.     bitmap = RPG::Cache.icon(item.icon_name)
  45.     opacity = self.contents.font.color == normal_color ? 255 : 128
  46.     self.contents.blt(x, y + 4, bitmap, Rect.new(0, 0, 24, 24), opacity)
  47.     self.contents.draw_text(x + 28, y, 212, 32, item.name.split("@")[0], 0)
  48.     self.contents.draw_text(x + 240, y, 16, 32, ":", 1)
  49.     self.contents.draw_text(x + 256, y, 24, 32, number.to_s, 2)
  50.   end
  51. end
  52. #==============================================================================
复制代码
qkqwe 发表于 2015-3-15 10:15:38
芯☆淡茹水 发表于 2015-3-14 19:42
没功效?,那就换下面这个:

貌似还是有问题,在物品栏里还是会显示@后的字样
龙和许也 发表于 2015-3-14 20:02:46
芯☆淡茹水 发表于 2015-3-14 19:42
没功效?,那就换下面这个:

装备后会出现@,你试试看。
芯☆淡茹水 发表于 2015-3-14 19:42:59
没功效?,那就换下面这个:
  1. #==============================================================================
  2. class Window_EquipItem < Window_Selectable
  3.   #--------------------------------------------------------------------------
  4.   def draw_item(index)
  5.     item = @data[index]
  6.     x = 4 + index % 2 * (288 + 32)
  7.     y = index / 2 * 32
  8.     case item
  9.     when RPG::Weapon
  10.       number = $game_party.weapon_number(item.id)
  11.     when RPG::Armor
  12.       number = $game_party.armor_number(item.id)
  13.     end
  14.     bitmap = RPG::Cache.icon(item.icon_name)
  15.     self.contents.blt(x, y + 4, bitmap, Rect.new(0, 0, 24, 24))
  16.     self.contents.font.color = normal_color
  17.     name = item.name.split("@")[0]
  18.     self.contents.draw_text(x + 28, y, 212, 32, name, 0)
  19.     self.contents.draw_text(x + 240, y, 16, 32, ":", 1)
  20.     self.contents.draw_text(x + 256, y, 24, 32, number.to_s, 2)
  21.   end
  22. end
  23. #==============================================================================
复制代码
龙和许也 发表于 2015-3-14 19:31:37
本帖最后由 龙和许也 于 2015-3-14 22:28 编辑
芯☆淡茹水 发表于 2015-3-14 19:26
插入这个:


啊……被你抢了,本来我是用这个笨方法的……

点开

请点开,你大致上看得懂我在改哪里吧?

点评

这也的确是个好办法!佩服。  发表于 2015-3-15 10:14
http://www.ifreesite.com/typing/keyboard-symbols.htm 附符号网站。  发表于 2015-3-14 20:03

评分

参与人数 1星屑 +100 收起 理由
RyanBern + 100 塞糖

查看全部评分

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

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

GMT+8, 2024-9-22 21:32

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

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