查看: 2696|回复: 2

[已经解决] RMVX魔法技能商店 Ver 2.0 可以用,但是數量超少

[复制链接]
梦石
0
星屑
50
在线时间
94 小时
注册时间
2013-1-24
回帖
129
发表于 2013-3-1 22:04:05 | 显示全部楼层 |阅读模式

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

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

×
RMVX魔法技能商店 Ver 2.0 (汉化更新具体使用方法)
http://rpg.blue/forum.php?mod=viewthread&tid=80588
↑
這個角本可以用,但是我每次只要賣超過9個,就跳錯誤

npc寫法

  1. $skill_shop = [25,26,19,20,15,23,63,59,69]
  2. $scene = Scene_Skill_Shop.new
复制代码


我只要第一行寫到跳行,它就當機了Q_Q
像是這樣
  1. $skill_shop =
  2. [15,16,19,20,21,22,23,24,25,26,27,28,29,30,3
  3. 1,32,33,34,35,36,37,38,39,40,41,42,43,44,45,
  4. 46,47,48,49,50,51,52,53,59,60,61,62,63,64,65
  5. ,66,68,69,70,71,72,73,74,75,76,77,78,79]
  6. $scene = Scene_Skill_Shop.new
复制代码


請問如何修正

附上我設定好的腳本
  1. #==============================================================================
  2. # RMVX魔法技能商店 Ver 2.0
  3. #==============================================================================
  4. # 作者: Nechigawara Sanzenin  翻译:一塌糊涂
  5. # 警告!! : 仅限RMVX使用!! 不支持RMXP!!
  6. #==============================================================================
  7. # RMVX版 魔法技能商店
  8. #==============================================================================
  9. #Version Log
  10. #==============================================================================
  11. #2.0 Add Level requirement - Change Hero Select Window
  12. #==============================================================================
  13. =begin

  14. 使用方法:

  15. 使用脚本  "$skill_shop =[Id of Skill]"  
  16. 用于设定可出售的技能.
  17. 使用脚本  "$scene = Scene_Skill_Shop.new"  
  18. 呼出魔法商店.

  19. 举例:
  20. $skill_shop = [1,2,3,6,7]
  21. $scene = Scene_Skill_Shop.new
  22. 即,12367号技能出售,并且呼出该魔法商店

  23. 可以在 "# Learn Text" 下面修改适合您游戏的文字.
  24. 可以在 "# Price Data" 下面修改技能价格.
  25. (Add Price Here处添加价格,未设定技能的默认出售价格为100)
  26. 可以在 "# Hero Data"  下面设定角色可习得的技能及学习必要等级.

  27. 例如可以这样设定Hero Date
  28. [技能编号, 学习必要等级]
  29. =end
  30. #  "# Learn Text" 下面修改适合您游戏的文字 ,具体内容可以根据需要自己改,
  31. #  很简单。 "# Price Data" 下面修改技能价格,方法是 技能编号 => 价格
  32. #  如: 1 => 150, 2 => 550, 3 => 450 表示,1号技能出售价格是150,2号是550,
  33. #  3号是450 0 => 100, 表示没有指定价格的技能默认出售100,这个默认值也可以直
  34. #  接修改 # Hero Data 下面的内容稍微复杂点,但是可以实现具体人物具体技能的需
  35. #  要。 方法是 人物编号 => [ [技能编号,学习必须等级], ],
  36. #  如: 1 => [ [1,4],[2,3],[3,1], ], 即是1号角色,一共可以学习3个技能
  37. #  (1,2,3号技能),而对应必须的等级是4.3.1 没有设定的角色,一律默认为不能
  38. #  学习任何技能。 p.s 目前只能用金钱购买
  39. #==============================================================================
  40. #module SKILL_SHOP
  41. #==============================================================================
  42. module SKILL_SHOP
  43.   # Learn Text
  44.   How_Learn = "隊伍訊息"
  45.   Can_Learn = "可 學"
  46.   Can_Learn_Lv = "必要等級"
  47.   Cant_Learn = "不可學"
  48.   Learnt = "已習得"
  49.   Teach = "技能購買"
  50.   Cancel = "離  開"
  51.   # Price Data
  52.   PRICE = {
  53.   # for No Set Price
  54.   0 => 1000,
  55.   # Add Price Here
  56. # Add Price Here
  57.   15 => 800,
  58.   16 => 2500,
  59.   19 => 500,
  60.   20 => 1000,
  61.   21 => 3000,
  62.   22 => 5000,
  63.   23 => 1000,
  64.   24 => 3000,
  65.   25 => 300,
  66.   26 => 1000,
  67.   27 => 1500,
  68.   28 => 5000,
  69.   29 => 8000,
  70.   30 => 1500,
  71.   31 => 5000,
  72.   32 => 8000,
  73.   33 => 1500,
  74.   34 => 5000,
  75.   35 => 8000,
  76.   36 => 3500,
  77.   37 => 8000,
  78.   38 => 3500,
  79.   39 => 8000,
  80.   40 => 3500,
  81.   41 => 8000,
  82.   42 => 3500,
  83.   43 => 8000,
  84.   44 => 3500,
  85.   45 => 8000,
  86.   46 => 1500,
  87.   47 => 1500,
  88.   48 => 1500,
  89.   49 => 1500,
  90.   50 => 1500,
  91.   51 => 1500,
  92.   52 => 1500,
  93.   53 => 1500,
  94.   59 => 500,
  95.   60 => 2000,
  96.   61 => 8000,
  97.   62 => 15000,
  98.   63 => 500,
  99.   64 => 3000,
  100.   65 => 5000,
  101.   66 => 8000,
  102.   68 => 8000,
  103.   69 => 1500,
  104.   70 => 3000,
  105.   71 => 6000,
  106.   72 => 15000,
  107.   73 => 7000,
  108.   74 => 7000,
  109.   75 => 7000,
  110.   76 => 15000,
  111.   77 => 15000,
  112.   78 => 15000,
  113.   79 => 7000,
  114.   # End
  115.   }
  116.   # Hero Data
  117.   SKILL_BUY = {
  118.   # Add what skill can hero buy Here
  119.   # [ID of skill,Level]
  120.   
  121.   1 => [
  122.   
  123.   [15,1],[16,1],[19,1],[20,1],[21,1],[22,1],[23,1],[24,1],[25,1],[26,1],[27,1],[28,1],[29,1],[30,1],[31,1],[32,1],[33,1],[34,1],[35,1],[36,1],[37,1],[38,1],[39,1],[40,1],[41,1],[42,1],[43,1],[44,1],[45,1],[46,1],[47,1],[48,1],[49,1],[50,1],[51,1],[52,1],[53,1],[59,1],[60,1],[61,1],[62,1],[63,1],[64,1],[65,1],[66,1],[68,1],[69,1],[70,1],[71,1],[72,1],[73,1],[74,1],[75,1],[76,1],[77,1],[78,1],[79,1],

  124.   ],
  125.   
  126.   2 => [
  127.   
  128.   [15,1],[16,1],[19,1],[20,1],[21,1],[22,1],[23,1],[24,1],[25,1],[26,1],[27,1],[28,1],[30,1],[31,1],[33,1],[34,1],[36,1],[38,1],[39,1],[40,1],[41,1],[42,1],[43,1],[44,1],[45,1],[46,1],[47,1],[48,1],[49,1],[50,1],[51,1],[52,1],[53,1],[59,1],[60,1],[61,1],[62,1],[63,1],[68,1],[69,1],[70,1],[71,1],[72,1],[73,1],[74,1],[75,1],[76,1],[77,1],[78,1],[79,1],
  129.   
  130.   ],

  131.   3 => [
  132.   
  133.   [15,1],[16,1],[19,1],[20,1],[21,1],[22,1],[23,1],[24,1],[25,1],[26,1],[27,1],[28,1],[29,1],[30,1],[31,1],[32,1],[33,1],[34,1],[35,1],[36,1],[37,1],[38,1],[39,1],[40,1],[41,1],[42,1],[43,1],[44,1],[45,1],[46,1],[47,1],[48,1],[49,1],[50,1],[51,1],[52,1],[53,1],[59,1],[60,1],[61,1],[68,1],[69,1],[70,1],[71,1],[73,1],[74,1],[75,1],[79,1],

  134.   ],
  135.   
  136.   4 => [
  137.   
  138.   [15,1],[16,1],[19,1],[20,1],[21,1],[22,1],[23,1],[24,1],[25,1],[26,1],[27,1],[28,1],[29,1],[30,1],[31,1],[32,1],[33,1],[34,1],[35,1],[36,1],[37,1],[38,1],[39,1],[40,1],[41,1],[42,1],[43,1],[44,1],[45,1],[46,1],[47,1],[48,1],[49,1],[50,1],[51,1],[52,1],[53,1],[59,1],[60,1],[61,1],[68,1],[69,1],[70,1],[71,1],[73,1],[74,1],[75,1],[79,1],

  139.   ],

  140.   5 => [
  141.   
  142.   [15,1],[16,1],[19,1],[20,1],[21,1],[22,1],[23,1],[24,1],[25,1],[26,1],[27,1],[28,1],[29,1],[30,1],[31,1],[32,1],[33,1],[34,1],[35,1],[36,1],[37,1],[38,1],[39,1],[40,1],[41,1],[42,1],[43,1],[44,1],[45,1],[46,1],[47,1],[48,1],[49,1],[50,1],[51,1],[52,1],[53,1],[59,1],[60,1],[61,1],[68,1],[69,1],[70,1],[71,1],[73,1],[74,1],[75,1],[79,1],

  143.   ],
  144.   
  145.   # End
  146.   }
  147.   # Add Price
  148.   def self.skill_price(id)
  149.     if PRICE.include?(id)
  150.       return PRICE[id]
  151.     else
  152.       return PRICE[0]
  153.     end
  154.   end
  155.   # Add Hero id
  156.   def self.skill_buy(id)
  157.     if SKILL_BUY.include?(id)
  158.       return SKILL_BUY[id]
  159.     else
  160.       return []
  161.     end
  162.   end
  163. end
  164. #==============================================================================
  165. #class Game_Actor
  166. #==============================================================================
  167. class Game_Actor < Game_Battler
  168.   def learn?(skill)
  169.     learn = skill_learn?(skill)
  170.     if learn == true
  171.       return false
  172.     else
  173.       return true
  174.     end
  175.   end
  176. end
  177. #==============================================================================
  178. #class Window_Skill_ShopBuy
  179. #==============================================================================
  180. class Window_Skill_ShopBuy < Window_Selectable
  181.   #--------------------------------------------------------------------------
  182.   def initialize(x, y)
  183.     super(x, y, 304, 304)
  184.     @skill_shop_goods = $skill_shop
  185.     refresh
  186.     self.index = 0
  187.   end
  188.   #--------------------------------------------------------------------------
  189.   def skill
  190.     return @data[self.index]
  191.   end
  192.   #--------------------------------------------------------------------------
  193.   def refresh
  194.     @data = []
  195.     for i in [email]0...@skill_shop_goods.size[/email]
  196.       skill = $data_skills[@skill_shop_goods[i]]
  197.       if skill != nil
  198.         @data.push(skill)
  199.       end
  200.     end
  201.     @item_max = @data.size
  202.     create_contents
  203.     for i in 0...@item_max
  204.       draw_item(i)
  205.     end
  206.   end
  207.   #--------------------------------------------------------------------------
  208.   def draw_item(index)
  209.     skill = @data[index]
  210.     price = SKILL_SHOP.skill_price(skill.id)
  211.     enabled = (price <= $game_party.gold)
  212.     rect = item_rect(index)
  213.     self.contents.clear_rect(rect)
  214.     draw_item_name(skill, rect.x, rect.y, enabled)
  215.     rect.width -= 4
  216.     self.contents.draw_text(rect, price, 2)
  217.   end
  218.   #--------------------------------------------------------------------------
  219.   def update_help
  220.     @help_window.set_text(skill == nil ? "" : skill.description)
  221.   end
  222. end
  223. #==============================================================================
  224. #class Window_Skill_ShopStatus
  225. #==============================================================================
  226. class Window_Skill_ShopStatus < Window_Selectable
  227.   #--------------------------------------------------------------------------
  228.   def initialize(x, y)
  229.     super(x, y, 240, 304)
  230.     @item = nil
  231.     refresh
  232.     self.active = false
  233.     self.index = -1
  234.   end
  235.   #--------------------------------------------------------------------------
  236.   def refresh
  237.     self.contents.clear
  238.     @item_max = $game_party.members.size
  239.     if @item != nil
  240.       self.contents.font.color = system_color
  241.       self.contents.draw_text(4, 0, 200, WLH, SKILL_SHOP::How_Learn)
  242.       for actor in $game_party.members
  243.         x = 4
  244.         y = WLH * (2 + actor.index * 2)
  245.         draw_actor_can_learn(actor, x, y)
  246.       end
  247.     end
  248.   end
  249.   #--------------------------------------------------------------------------
  250.   def draw_actor_can_learn(actor, x, y)
  251.     can = false
  252.     lv = false
  253.     ac_lv = 0
  254.     can_learn = SKILL_SHOP.skill_buy(actor.id)
  255.     id = @item.id
  256.     for i in 0...can_learn.size
  257.       if can_learn[i][0] == id
  258.         can = true
  259.         if can_learn[i][1] <= actor.level
  260.           lv = true
  261.         else
  262.           lv = false
  263.           ac_lv = can_learn[i][1]
  264.         end
  265.         break
  266.       else
  267.         can = false
  268.       end
  269.     end
  270.     enabled = (can and lv and actor.learn?(@item))
  271.     self.contents.font.color = normal_color
  272.     self.contents.font.color.alpha = enabled ? 255 : 128
  273.     name = actor.character_name
  274.     index = actor.character_index
  275.     size = contents.text_size(actor.name).width
  276.     draw_character(name, index, x + 20 + size , y + 30)
  277.     self.contents.draw_text(x, y, 200, WLH, actor.name)
  278.     if can == false
  279.       text = SKILL_SHOP::Cant_Learn
  280.     elsif can == true and lv == false
  281.       ac = ac_lv.to_s
  282.       text = SKILL_SHOP::Can_Learn_Lv + " " + ac + "+"
  283.     elsif actor.learn?(@item) == false
  284.       text = SKILL_SHOP::Learnt
  285.     else
  286.       text = SKILL_SHOP::Can_Learn
  287.     end
  288.     self.contents.draw_text(x, y, 200, WLH, text, 2)
  289.   end
  290.   #--------------------------------------------------------------------------
  291.   def item=(item)
  292.     if @item != item
  293.       @item = item
  294.       refresh
  295.     end
  296.   end
  297.   #--------------------------------------------------------------------------
  298.   def update_cursor
  299.     if @index < 0
  300.       self.cursor_rect.empty
  301.     elsif @index < @item_max
  302.       y = WLH * (2 + @index * 2)
  303.       self.cursor_rect.set(0, y - 4, contents.width,34)
  304.     end
  305.   end
  306. end
  307. #==============================================================================
  308. #class Scene_Skill_Shop
  309. #==============================================================================
  310. class Scene_Skill_Shop < Scene_Base
  311.   #--------------------------------------------------------------------------
  312.   def start
  313.     super
  314.     create_menu_background
  315.     create_command_window
  316.     @viewport = Viewport.new(0, 0, 544, 416)
  317.     @help_window = Window_Help.new
  318.     @gold_window = Window_Gold.new(384, 56)
  319.     @dummy_window = Window_Base.new(0, 112, 544, 304)
  320.     @buy_window = Window_Skill_ShopBuy.new(0, 112)
  321.     @buy_window.active = false
  322.     @buy_window.visible = false
  323.     @buy_window.help_window = @help_window
  324.     @status_window = Window_Skill_ShopStatus.new(304, 112)
  325.     @status_window.visible = false
  326.     @status_window.active = false
  327.   end
  328.   #--------------------------------------------------------------------------
  329.   def terminate
  330.     super
  331.     dispose_menu_background
  332.     dispose_command_window
  333.     @help_window.dispose
  334.     @gold_window.dispose
  335.     @dummy_window.dispose
  336.     @buy_window.dispose
  337.     @status_window.dispose
  338.   end  
  339.   #--------------------------------------------------------------------------
  340.   def update
  341.     super
  342.     update_menu_background
  343.     @help_window.update
  344.     @command_window.update
  345.     @gold_window.update
  346.     @dummy_window.update
  347.     @buy_window.update
  348.     @status_window.update
  349.     if @command_window.active
  350.       update_command_selection
  351.     elsif @buy_window.active
  352.       update_buy_selection
  353.     elsif @status_window.active
  354.       update_target_selection
  355.     end
  356.   end
  357.   #--------------------------------------------------------------------------
  358.   def create_command_window
  359.     s1 = SKILL_SHOP::Teach
  360.     s2 = SKILL_SHOP::Cancel
  361.     @command_window = Window_Command.new(384, [s1, s2], 2)
  362.     @command_window.y = 56
  363.   end
  364.   #--------------------------------------------------------------------------
  365.   def dispose_command_window
  366.     @command_window.dispose
  367.   end
  368.   #--------------------------------------------------------------------------
  369.   def update_command_selection
  370.     @help_window.set_text("")
  371.     if Input.trigger?(Input::B)
  372.       Sound.play_cancel
  373.       $scene = Scene_Map.new
  374.     elsif Input.trigger?(Input::C)
  375.       case @command_window.index
  376.       when 0
  377.         Sound.play_decision
  378.         @command_window.active = false
  379.         @dummy_window.visible = false
  380.         @buy_window.active = true
  381.         @buy_window.visible = true
  382.         @buy_window.refresh
  383.         @status_window.visible = true
  384.       when 1
  385.         Sound.play_decision
  386.         $scene = Scene_Map.new
  387.       end
  388.     end
  389.   end
  390.   #--------------------------------------------------------------------------
  391.   def update_buy_selection
  392.     @status_window.item = @buy_window.skill
  393.     if Input.trigger?(Input::B)
  394.       Sound.play_cancel
  395.       @command_window.active = true
  396.       @dummy_window.visible = true
  397.       @buy_window.active = false
  398.       @buy_window.visible = false
  399.       @status_window.visible = false
  400.       @status_window.item = nil
  401.       return
  402.     end
  403.     if Input.trigger?(Input::C)
  404.       @item = @buy_window.skill
  405.       @price = SKILL_SHOP.skill_price(@item.id)
  406.       enabled = (@price <= $game_party.gold)
  407.       if not enabled
  408.         Sound.play_buzzer
  409.       else
  410.         Sound.play_decision
  411.         show_target_window
  412.       end
  413.     end
  414.   end
  415.   #--------------------------------------------------------------------------
  416.   def update_target_selection
  417.     if Input.trigger?(Input::B)
  418.       Sound.play_cancel
  419.       hide_target_window
  420.     elsif Input.trigger?(Input::C)
  421.       [url=home.php?mod=space&uid=95897]@actor[/url] = $game_party.members[@status_window.index]
  422.       can = false
  423.       lv = false
  424.       can_learn = SKILL_SHOP.skill_buy(@actor.id)
  425.       id = @item.id
  426.       for i in 0...can_learn.size
  427.         if can_learn[i][0] == id
  428.           can = true
  429.           if can_learn[i][1] <= @actor.level
  430.             lv = true
  431.           else
  432.             lv = false
  433.           end
  434.           break
  435.         else
  436.           can = false
  437.         end
  438.       end
  439.       enabled = (can and lv and @actor.learn?(@item))
  440.       if not enabled
  441.         Sound.play_buzzer
  442.       else
  443.         learn_target(@item.id)
  444.       end
  445.     end
  446.   end
  447.   #--------------------------------------------------------------------------
  448.   def learn_target(skill_id)
  449.     Sound.play_shop
  450.     @actor.learn_skill(skill_id)
  451.     $game_party.lose_gold(@price)
  452.     @buy_window.refresh
  453.     @gold_window.refresh
  454.     @status_window.refresh
  455.     hide_target_window
  456.   end
  457.   #--------------------------------------------------------------------------
  458.   def show_target_window
  459.     @buy_window.active = false
  460.     @status_window.active = true
  461.     @status_window.index = 0
  462.   end
  463.   #--------------------------------------------------------------------------
  464.   def hide_target_window
  465.     @buy_window.active = true
  466.     @status_window.active = false
  467.     @status_window.index =- 1
  468.   end
  469. end
复制代码

梦石
0
星屑
75
在线时间
435 小时
注册时间
2012-7-31
回帖
744
发表于 2013-3-1 22:18:01 | 显示全部楼层
$skill_shop =
[15,16,19,20,21,22,23,24,25,26,27,28,29,30,3,
1,32,33,34,35,36,37,38,39,40,41,42,43,44,45,
46,47,48,49,50,51,52,53,59,60,61,62,63,64,65,
,66,68,69,70,71,72,73,74,75,76,77,78,79]
$scene = Scene_Skill_Shop.new
注意逗号。
爪机不好弄这东西……每一个数字(除了最后一个)都要加上逗号。

评分

参与人数 1星屑 +60 收起 理由
怪蜀黍 + 60 认可答案,难得有机会用公款抓一次.

查看全部评分

回复

使用道具 举报

梦石
0
星屑
50
在线时间
94 小时
注册时间
2013-1-24
回帖
129
 楼主| 发表于 2013-3-1 22:47:35 | 显示全部楼层
原野清平 发表于 2013-3-1 22:18
$skill_shop =
[15,16,19,20,21,22,23,24,25,26,27,28,29,30,3,
1,32,33,34,35,36,37,38,39,40,41,42,43,4 ...

改這樣還是死,錯誤訊息SyntaxError occurred while running script.(PS你家的那邊原本是31>>跳行才變成3   1)

  1. $skill_shop =
  2. [15,16,19,20,21,22,23,24,25,26,27,28,29,30,3
  3. ,1,2]
  4. $scene = Scene_Skill_Shop.new
复制代码


當機

  1. $skill_shop =
  2. [15,16,19,20,21,22,23,24,25,26,27,28,29,30,
  3. 31,32,33,34,35,36,37,38,39,40,41,42,43,44,
  4. 45,46,47,48,49,50,51,52,53,59,60,61,62,63,
  5. 64,65,66,68,69,70,71,72,73,74,75,76,77,78,
  6. 79]
  7. $scene = Scene_Skill_Shop.new
复制代码


可以!!


結論!!句尾一定要是","不然會當機,自動跳行也算Q_Q

不火,好在問題解決了!!感謝前輩幫忙!!

点评

LBQ
ruby不是有“-”这种东西吗。。应该照样能用吧。。。。  发表于 2013-3-7 05:31
实际上我也就是那个意思啊~前辈不敢当  发表于 2013-3-2 07:57
回复

使用道具 举报

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

本版积分规则

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

在本版发帖返回顶部