Project1

标题: 用了物品得失脚本打开物品栏报错 [打印本页]

作者: 莫言别离    时间: 2015-7-6 08:48
标题: 用了物品得失脚本打开物品栏报错
没有获得物品之前打开物品栏没有问题,
获得物品之后在打开物品栏就出现了问题。



这是脚本,工程不太方便放


RUBY 代码复制
  1. #==============================================================================
  2. # 本腳本來自[url]www.66RPG.com[/url],使用和轉載請保留此信息
  3. #==============================================================================
  4.  
  5. # 注意!!!在對話後得到物品,請在對話後先用事件等待3幀,否則對話框來不及消失。
  6.  
  7. # 開關定義:
  8.  
  9. $noshowgold = 10                        # 不显示金钱得失
  10.  
  11. $noshowitem = 11                        # 不显示物品得失
  12.  
  13. $noshowweapon = 12                      # 不显示武器得失
  14.  
  15. $noshowarmor = 13                       # 不显示防具得失
  16. # 以上開關,當打開的時候,獲得物品將不會提示,比如默認打開41號開關,獲得金錢不再提示
  17.  
  18. # 不想提示等级升降时,就在事件命令直接选择是否显示就行了。
  19.  
  20. #——聲效,可以自己改
  21. folder = "Audio/SE/"
  22. $gain_gold_se   = folder +"Shop"      # 获得金钱声效
  23. $loss_gold_se   = folder +"Blow2"     # 失去金钱声效
  24.  
  25. $gain_item_se   = folder +"Item1"     # 获得物品声效
  26. $loss_item_se   = folder +"Blow2"     # 失去物品声效
  27.  
  28. $gain_weapon_se = folder +"Item1"     # 获得武器声效
  29. $loss_weapon_se = folder +"Blow2"     # 失去武器声效
  30.  
  31. $gain_armor_se  = folder +"Item1"     # 获得防具声效
  32. $loss_armor_se  = folder +"Blow2"     # 失去防具声效
  33.  
  34. $gain_lv_se     = folder +"Item1"     # 提升等级声效
  35. $loss_lv_se     = folder +"Blow2"     # 降低等级声效
  36.  
  37. # ————————————————————————————————————
  38.  
  39. class Game_Interpreter
  40.   #--------------------------------------------------------------------------
  41.   # ● 增減金錢
  42.   #--------------------------------------------------------------------------
  43.   def command_125
  44.     value = operate_value(@params[0], @params[1], @params[2])
  45.     $game_party.gain_gold(value)
  46.     if $game_switches[$noshowgold]==false
  47.       show_gain_window(0, value)
  48.     end
  49.     return true
  50.   end
  51.   #--------------------------------------------------------------------------
  52.   # ● 增減物品
  53.   #--------------------------------------------------------------------------
  54.   def command_126
  55.     value = operate_value(@params[1], @params[2], @params[3])
  56.     $game_party.gain_item($data_items[@params[0]], value)
  57.     if $game_switches[$noshowitem]==false
  58.       show_gain_window(1, value)
  59.     end
  60.     $game_map.need_refresh = true
  61.     return true
  62.   end
  63.   #--------------------------------------------------------------------------
  64.   # ● 增減武器
  65.   #--------------------------------------------------------------------------
  66.   def command_127
  67.     value = operate_value(@params[1], @params[2], @params[3])
  68.     $game_party.gain_item($data_weapons[@params[0]], value, @params[4])
  69.     if $game_switches[$noshowweapon]==false
  70.       show_gain_window(2, value)
  71.     end
  72.     return true
  73.   end
  74.   #--------------------------------------------------------------------------
  75.   # ● 增減防具
  76.   #--------------------------------------------------------------------------
  77.   def command_128
  78.     value = operate_value(@params[1], @params[2], @params[3])
  79.     $game_party.gain_item($data_armors[@params[0]], value, @params[4])
  80.     if $game_switches[$noshowarmor]==false
  81.       show_gain_window(3, value)
  82.     end
  83.     return true
  84.   end
  85.   #--------------------------------------------------------------------------
  86.   # ● 等级増減
  87.   #--------------------------------------------------------------------------
  88.   def command_316
  89.     value = operate_value(@params[2], @params[3], @params[4])
  90.     iterate_actor_var(@params[0], @params[1]) do |actor|
  91.       actor.change_level(actor.level + value, @params[5])
  92.       if @params[4]
  93.         show_gain_level_window(actor,value)
  94.       end
  95.     end
  96.     return true
  97.   end
  98.  
  99.   def show_gain_window(type, value)
  100.     snstar2006_66rpg_item = $data_armors[@params[0]]
  101.     snstar2006_66rpg = Window_Base.new((640-200)/2,128,200,100)
  102.     snstar2006_66rpg.contents = Bitmap.new(snstar2006_66rpg.width - 32, snstar2006_66rpg.height - 32)
  103.     if value >= 0
  104.       gain_text = "获得"   
  105.     else
  106.       gain_text = "失去"
  107.     end
  108.  
  109.     case type
  110.     when 0
  111.       gain_type = "金钱"
  112.       if value >=0
  113.         Audio.se_play($gain_gold_se,80,100)
  114.       else
  115.         Audio.se_play("Audio/SE/"+"Item1",80,100)
  116.       end
  117.     when 1
  118.       gain_type = "物品"
  119.       string = $data_items[@params[0]]
  120.       if value >=0
  121.         Audio.se_play($gain_item_se,80,100)
  122.       else
  123.         Audio.se_play($loss_item_se,80,100)
  124.       end
  125.     when 2
  126.       gain_type = "武器"
  127.       string = $data_weapons[@params[0]]
  128.       if value >=0
  129.         Audio.se_play($gain_weapon_se,80,100)
  130.       else
  131.         Audio.se_play($loss_weapon_se,80,100)
  132.       end
  133.     when 3
  134.       gain_type = "防具"
  135.       string = $data_armors[@params[0]]
  136.       if value >=0
  137.         Audio.se_play($gain_armor_se,80,100)
  138.       else
  139.         Audio.se_play($loss_armor_se,80,100)
  140.       end
  141.     end
  142.  
  143.     snstar2006_66rpg.contents.draw_text(0,0,160,30,gain_text+gain_type+":")
  144.  
  145.     unless type == 0
  146.       snstar2006_66rpg.draw_item_name(string, 0, 30, true)
  147.       snstar2006_66rpg.contents.draw_text(0, 30, 160, 30, "×"+value.abs.to_s, 2)
  148.     else
  149.       snstar2006_66rpg.contents.draw_text(0,30,165,30,value.abs.to_s + "  "+ Vocab.currency_unit, 2)
  150.     end
  151.  
  152.     snstar2006_66rpg.opacity = 160
  153.  
  154.     for i in 0..50
  155.       Graphics.update
  156.     end
  157.  
  158.     for i in 0..10
  159.       snstar2006_66rpg.opacity -= 10
  160.       snstar2006_66rpg.contents_opacity -= 10
  161.       Graphics.update
  162.     end
  163.  
  164.     snstar2006_66rpg.dispose
  165.  
  166.   end
  167.  
  168.   def show_gain_level_window(actor,value)
  169.     lvstring = Vocab::level
  170.  
  171.     snstar2006_66rpg = Window_Base.new((640-200)/2,128,200,100)
  172.     snstar2006_66rpg.contents = Bitmap.new(snstar2006_66rpg.width - 30, snstar2006_66rpg.height - 30)
  173.  
  174.     if value >= 0
  175.       gain_text = "提升"
  176.       Audio.se_play($gain_lv_se,80,100)
  177.     else
  178.       gain_text = "降低"
  179.       Audio.se_play($loss_lv_se,80,100)
  180.     end
  181.  
  182.     snstar2006_66rpg.contents.draw_text(0, 0, 110, 30, actor.name)
  183.     string = lvstring+gain_text+value.abs.to_s+"级"
  184.     snstar2006_66rpg.contents.draw_text(0,30,160,30,string, 2)
  185.  
  186.     snstar2006_66rpg.opacity = 160
  187.  
  188.     for i in 0..50
  189.       Graphics.update
  190.     end
  191.  
  192.     for i in 0..10
  193.       snstar2006_66rpg.opacity -= 10
  194.       snstar2006_66rpg.contents_opacity -= 10
  195.       Graphics.update
  196.     end
  197.  
  198.     snstar2006_66rpg.dispose
  199.  
  200.   end
  201. end
  202.  
  203.  
  204. #==============================================================================
  205. # 本腳本來自[url]www.66RPG.com[/url],使用和轉載請保留此信息
  206. #==============================================================================

作者: VIPArcher    时间: 2015-7-6 10:31
试试用这个?http://taroxd.github.io/rgss/%E5 ... 8F%90%E7%A4%BA.html
如果用这个请注意这里的使用规约及说明http://taroxd.github.io/rgss/rules/
作者: 龙和许也    时间: 2015-7-6 16:39
本帖最后由 龙和许也 于 2015-7-6 16:41 编辑

你哪里找来的?跟我的不一样啊~
  1. #==============================================================================
  2. # 本腳本來自www.66RPG.com,使用和轉載請保留此信息
  3. #==============================================================================

  4. # 注意!!!在對話後得到物品,請在對話後先用事件等待3幀,否則對話框來不及消失。

  5. # 開關定義:

  6. $noshowgold = 41                        # 不显示金钱得失

  7. $noshowitem = 42                        # 不显示物品得失

  8. $noshowweapon = 43                      # 不显示武器得失

  9. $noshowarmor = 44                       # 不显示防具得失
  10. # 以上開關,當打開的時候,獲得物品將不會提示,比如默認打開41號開關,獲得金錢不再提示

  11. # 不想提示等级升降时,就在事件命令直接选择是否显示就行了。

  12. #——聲效,可以自己改
  13. folder = "Audio/SE/"
  14. $gain_gold_se   = folder +"Shop"      # 获得金钱声效
  15. $loss_gold_se   = folder +"Blow2"     # 失去金钱声效

  16. $gain_item_se   = folder +"Item1"     # 获得物品声效
  17. $loss_item_se   = folder +"Blow2"     # 失去物品声效

  18. $gain_weapon_se = folder +"Item1"     # 获得武器声效
  19. $loss_weapon_se = folder +"Blow2"     # 失去武器声效

  20. $gain_armor_se  = folder +"Item1"     # 获得防具声效
  21. $loss_armor_se  = folder +"Blow2"     # 失去防具声效

  22. $gain_lv_se     = folder +"Item1"     # 提升等级声效
  23. $loss_lv_se     = folder +"Blow2"     # 降低等级声效

  24. # ————————————————————————————————————

  25. class Game_Interpreter
  26.   #--------------------------------------------------------------------------
  27.   # ● 增減金錢
  28.   #--------------------------------------------------------------------------
  29.   def command_125
  30.     value = operate_value(@params[0], @params[1], @params[2])
  31.     $game_party.gain_gold(value)
  32.     if $game_switches[$noshowgold]==false
  33.       show_gain_window(0, value)
  34.     end
  35.     return true
  36.   end
  37.   #--------------------------------------------------------------------------
  38.   # ● 增減物品
  39.   #--------------------------------------------------------------------------
  40.   def command_126
  41.     value = operate_value(@params[1], @params[2], @params[3])
  42.     $game_party.gain_item($data_items[@params[0]], value)
  43.     if $game_switches[$noshowitem]==false
  44.       show_gain_window(1, value)
  45.     end
  46.     $game_map.need_refresh = true
  47.     return true
  48.   end
  49.   #--------------------------------------------------------------------------
  50.   # ● 增減武器
  51.   #--------------------------------------------------------------------------
  52.   def command_127
  53.     value = operate_value(@params[1], @params[2], @params[3])
  54.     $game_party.gain_item($data_weapons[@params[0]], value, @params[4])
  55.     if $game_switches[$noshowweapon]==false
  56.       show_gain_window(2, value)
  57.     end
  58.     return true
  59.   end
  60.   #--------------------------------------------------------------------------
  61.   # ● 增減防具
  62.   #--------------------------------------------------------------------------
  63.   def command_128
  64.     value = operate_value(@params[1], @params[2], @params[3])
  65.     $game_party.gain_item($data_armors[@params[0]], value, @params[4])
  66.     if $game_switches[$noshowarmor]==false
  67.       show_gain_window(3, value)
  68.     end
  69.     return true
  70.   end
  71.   #--------------------------------------------------------------------------
  72.   # ● 等级増減
  73.   #--------------------------------------------------------------------------
  74.   def command_316
  75.     value = operate_value(@params[2], @params[3], @params[4])
  76.     iterate_actor_var(@params[0], @params[1]) do |actor|
  77.       actor.change_level(actor.level + value, @params[5])
  78.       if @params[4]
  79.         show_gain_level_window(actor,value)
  80.       end
  81.     end
  82.     return true
  83.   end
  84.   
  85.   def show_gain_window(type, value)
  86.     snstar2006_66rpg_item = $data_armors[@params[0]]
  87.     snstar2006_66rpg = Window_Base.new((640-300)/2,128,200,100)
  88.     snstar2006_66rpg.contents = Bitmap.new(snstar2006_66rpg.width - 32, snstar2006_66rpg.height - 32)
  89.     if value >= 0
  90.       gain_text = "获得"   
  91.     else
  92.       gain_text = "失去"
  93.     end
  94.    
  95.     case type
  96.     when 0
  97.       gain_type = "金钱"
  98.       if value >=0
  99.         Audio.se_play($gain_gold_se,80,100)
  100.       else
  101.         Audio.se_play("Audio/SE/"+"Item1",80,100)
  102.       end
  103.     when 1
  104.       gain_type = "物品"
  105.       string = $data_items[@params[0]]
  106.       if value >=0
  107.         Audio.se_play($gain_item_se,80,100)
  108.       else
  109.         Audio.se_play($loss_item_se,80,100)
  110.       end
  111.     when 2
  112.       gain_type = "武器"
  113.       string = $data_weapons[@params[0]]
  114.       if value >=0
  115.         Audio.se_play($gain_weapon_se,80,100)
  116.       else
  117.         Audio.se_play($loss_weapon_se,80,100)
  118.       end
  119.     when 3
  120.       gain_type = "防具"
  121.       string = $data_armors[@params[0]]
  122.       if value >=0
  123.         Audio.se_play($gain_armor_se,80,100)
  124.       else
  125.         Audio.se_play($loss_armor_se,80,100)
  126.       end
  127.     end
  128.    
  129.     snstar2006_66rpg.contents.draw_text(0,0,160,30,gain_text+gain_type+":")
  130.    
  131.     unless type == 0
  132.       snstar2006_66rpg.draw_item_name(string, 0, 30, true)
  133.       snstar2006_66rpg.contents.draw_text(0, 30, 160, 30, "×"+value.abs.to_s, 2)
  134.     else
  135.       snstar2006_66rpg.contents.draw_text(0,30,165,30,value.abs.to_s + "  "+ Vocab.currency_unit, 2)
  136.     end
  137.    
  138.     snstar2006_66rpg.opacity = 160
  139.    
  140.     for i in 0..50
  141.       Graphics.update
  142.     end
  143.    
  144.     for i in 0..10
  145.       snstar2006_66rpg.opacity -= 10
  146.       snstar2006_66rpg.contents_opacity -= 10
  147.       Graphics.update
  148.     end
  149.    
  150.     snstar2006_66rpg.dispose
  151.    
  152.   end

  153.   def show_gain_level_window(actor,value)
  154.     lvstring = Vocab::level
  155.         
  156.     snstar2006_66rpg = Window_Base.new((640-300)/2,128,200,100)
  157.     snstar2006_66rpg.contents = Bitmap.new(snstar2006_66rpg.width - 30, snstar2006_66rpg.height - 30)
  158.    
  159.     if value >= 0
  160.       gain_text = "提升"
  161.       Audio.se_play($gain_lv_se,80,100)
  162.     else
  163.       gain_text = "降低"
  164.       Audio.se_play($loss_lv_se,80,100)
  165.     end
  166.    
  167.     snstar2006_66rpg.contents.draw_text(0, 0, 110, 30, actor.name)
  168.     string = lvstring+gain_text+value.abs.to_s+"级"
  169.     snstar2006_66rpg.contents.draw_text(0,30,160,30,string, 2)

  170.     snstar2006_66rpg.opacity = 160
  171.    
  172.     for i in 0..50
  173.       Graphics.update
  174.     end
  175.    
  176.     for i in 0..10
  177.       snstar2006_66rpg.opacity -= 10
  178.       snstar2006_66rpg.contents_opacity -= 10
  179.       Graphics.update
  180.     end
  181.    
  182.     snstar2006_66rpg.dispose

  183.   end
  184. end


  185. #==============================================================================
  186. # 本腳本來自www.66RPG.com,使用和轉載請保留此信息
  187. #==============================================================================
复制代码

作者: 莫言别离    时间: 2015-7-6 16:39
VIPArcher 发表于 2015-7-6 10:31
试试用这个?http://taroxd.github.io/rgss/%E5%BE%97%E5%A4%B1%E7%89%A9%E5%93%81%E6%8F%90%E7%A4%BA.html ...

用这个会提示





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