Project1

标题: 求问如何让怪物死后掉落的物品… [打印本页]

作者: 君の傍にいる    时间: 2012-5-28 18:56
标题: 求问如何让怪物死后掉落的物品…
求问如何让怪物死后掉落的同样的道具只显示一次 比如 本来是 获得3个 大便  然后就提示三次 可以让他直接提示大便X3吗? dsu_plus_rewardpost_czw
作者: 灵魂の补给    时间: 2012-5-28 19:57
情把提示物品得失脚本附上偶才好修改啊!
不过好像就是只显示1次饿?
作者: hys111111    时间: 2012-5-28 22:03
试验成功!把脚本发上来……
效果图:

脚本:(在Main前面插入)
  1. #==============================================================================
  2. # ■ Window_BattleResult
  3. #------------------------------------------------------------------------------
  4. #  战斗结束时、显示获得的 EXP 及金钱的窗口。
  5. #==============================================================================

  6. class Window_BattleResult < Window_Base
  7.   #--------------------------------------------------------------------------
  8.   # ● 初始化对像
  9.   #     exp       : EXP
  10.   #     gold      : 金钱
  11.   #     treasures : 宝物
  12.   #--------------------------------------------------------------------------
  13.   def initialize(exp, gold, treasures,number)
  14.     @exp = exp
  15.     @gold = gold
  16.     @treasures = treasures
  17.     @number = number
  18.     super(160, 0, 320, @treasures.size * 32 + 64)
  19.     self.contents = Bitmap.new(width - 32, height - 32)
  20.     self.y = 160 - height / 2
  21.     self.back_opacity = 160
  22.     self.visible = false
  23.     refresh
  24.   end
  25.   #--------------------------------------------------------------------------
  26.   # ● 刷新
  27.   #--------------------------------------------------------------------------
  28.   def refresh
  29.     self.contents.clear
  30.     x = 4
  31.     self.contents.font.color = normal_color
  32.     cx = contents.text_size(@exp.to_s).width
  33.     self.contents.draw_text(x, 0, cx, 32, @exp.to_s)
  34.     x += cx + 4
  35.     self.contents.font.color = system_color
  36.     cx = contents.text_size("EXP").width
  37.     self.contents.draw_text(x, 0, 64, 32, "EXP")
  38.     x += cx + 16
  39.     self.contents.font.color = normal_color
  40.     cx = contents.text_size(@gold.to_s).width
  41.     self.contents.draw_text(x, 0, cx, 32, @gold.to_s)
  42.     x += cx + 4
  43.     self.contents.font.color = system_color
  44.     self.contents.draw_text(x, 0, 128, 32, $data_system.words.gold)
  45.     y = 32
  46.     for item in [email protected]
  47.       draw_item_name(@treasures[item], 4, y)
  48.       self.contents.draw_text(100, y, 64, 32, "×"+@number[item].to_s)
  49.       y += 32
  50.     end
  51.   end
  52. end
复制代码
另一段:
  1. #==============================================================================
  2. # ■ Scene_Battle (追加定义)
  3. #------------------------------------------------------------------------------
  4. #  处理战斗画面的类。
  5. #==============================================================================

  6. class Scene_Battle
  7.   #--------------------------------------------------------------------------
  8.   # ● 开始结束战斗回合
  9.   #--------------------------------------------------------------------------
  10.   def start_phase5
  11.     # 转移到回合 5
  12.     @phase = 5
  13.     # 演奏战斗结束 ME
  14.     $game_system.me_play($game_system.battle_end_me)
  15.     # 还原为战斗开始前的 BGM
  16.     $game_system.bgm_play($game_temp.map_bgm)
  17.     # 初始化 EXP、金钱、宝物
  18.     exp = 0
  19.     gold = 0
  20.     treasures = []
  21.     # 循环
  22.     for enemy in $game_troop.enemies
  23.       # 敌人不是隐藏状态的情况下
  24.       unless enemy.hidden
  25.         # 获得 EXP、增加金钱
  26.         exp += enemy.exp
  27.         gold += enemy.gold
  28.         # 出现宝物判定
  29.         if rand(100) < enemy.treasure_prob
  30.           if enemy.item_id > 0
  31.             treasures.push($data_items[enemy.item_id])
  32.           end
  33.           if enemy.weapon_id > 0
  34.             treasures.push($data_weapons[enemy.weapon_id])
  35.           end
  36.           if enemy.armor_id > 0
  37.             treasures.push($data_armors[enemy.armor_id])
  38.           end
  39.         end
  40.       end
  41.     end
  42.     # 限制宝物数为 6 个
  43.    # treasures = treasures[0..5]
  44.     # 获得 EXP
  45.     for i in 0...$game_party.actors.size
  46.       actor = $game_party.actors[i]
  47.       if actor.cant_get_exp? == false
  48.         last_level = actor.level
  49.         actor.exp += exp
  50.         if actor.level > last_level
  51.           @status_window.level_up(i)
  52.         end
  53.       end
  54.     end
  55.     # 获得金钱
  56.     $game_party.gain_gold(gold)
  57.     # 获得宝物
  58.     for item in treasures
  59.       case item
  60.       when RPG::Item
  61.         $game_party.gain_item(item.id, 1)
  62.       when RPG::Weapon
  63.         $game_party.gain_weapon(item.id, 1)
  64.       when RPG::Armor
  65.         $game_party.gain_armor(item.id, 1)
  66.       end
  67.     end
  68.     #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  69.     real_trea = []
  70.     number = []
  71.     for real in treasures
  72.       if real_trea.include?(real)
  73.         number[real_trea.index(real)] += 1
  74.       else
  75.         real_trea.push(real)
  76.         number.push(1)
  77.       end
  78.     end
  79.     #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  80.     # 生成战斗结果窗口
  81.     @result_window = Window_BattleResult.new(exp, gold, real_trea,number)
  82.     # 设置等待计数
  83.     @phase5_wait_count = 100
  84.   end
  85. end
复制代码





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