Project1

标题: RMVX魔法技能商店 Ver 2.0 可以用,但是數量超少 [打印本页]

作者: sakazaki    时间: 2013-3-1 22:04
标题: RMVX魔法技能商店 Ver 2.0 可以用,但是數量超少
RMVX魔法技能商店 Ver 2.0 (汉化更新具体使用方法)
http://rpg.blue/forum.php?mod=viewthread&tid=80588

這個角本可以用,但是我每次只要賣超過9個,就跳錯誤

npc寫法

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


我只要第一行寫到跳行,它就當機了Q_Q
像是這樣
RUBY 代码复制
  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


請問如何修正

附上我設定好的腳本
RUBY 代码复制
  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. 使用方法:
  16.  
  17. 使用脚本  "$skill_shop =[Id of Skill]"  
  18. 用于设定可出售的技能.
  19. 使用脚本  "$scene = Scene_Skill_Shop.new"  
  20. 呼出魔法商店.
  21.  
  22. 举例:
  23. $skill_shop = [1,2,3,6,7]
  24. $scene = Scene_Skill_Shop.new
  25. 即,12367号技能出售,并且呼出该魔法商店
  26.  
  27. 可以在 "# Learn Text" 下面修改适合您游戏的文字.
  28. 可以在 "# Price Data" 下面修改技能价格.
  29. (Add Price Here处添加价格,未设定技能的默认出售价格为100)
  30. 可以在 "# Hero Data"  下面设定角色可习得的技能及学习必要等级.
  31.  
  32. 例如可以这样设定Hero Date
  33. [技能编号, 学习必要等级]
  34. =end
  35. #  "# Learn Text" 下面修改适合您游戏的文字 ,具体内容可以根据需要自己改,
  36. #  很简单。 "# Price Data" 下面修改技能价格,方法是 技能编号 => 价格
  37. #  如: 1 => 150, 2 => 550, 3 => 450 表示,1号技能出售价格是150,2号是550,
  38. #  3号是450 0 => 100, 表示没有指定价格的技能默认出售100,这个默认值也可以直
  39. #  接修改 # Hero Data 下面的内容稍微复杂点,但是可以实现具体人物具体技能的需
  40. #  要。 方法是 人物编号 => [ [技能编号,学习必须等级], ],
  41. #  如: 1 => [ [1,4],[2,3],[3,1], ], 即是1号角色,一共可以学习3个技能
  42. #  (1,2,3号技能),而对应必须的等级是4.3.1 没有设定的角色,一律默认为不能
  43. #  学习任何技能。 p.s 目前只能用金钱购买
  44. #==============================================================================
  45. #module SKILL_SHOP
  46. #==============================================================================
  47. module SKILL_SHOP
  48.   # Learn Text
  49.   How_Learn = "隊伍訊息"
  50.   Can_Learn = "可 學"
  51.   Can_Learn_Lv = "必要等級"
  52.   Cant_Learn = "不可學"
  53.   Learnt = "已習得"
  54.   Teach = "技能購買"
  55.   Cancel = "離  開"
  56.   # Price Data
  57.   PRICE = {
  58.   # for No Set Price
  59.   0 => 1000,
  60.   # Add Price Here
  61. # Add Price Here
  62.   15 => 800,
  63.   16 => 2500,
  64.   19 => 500,
  65.   20 => 1000,
  66.   21 => 3000,
  67.   22 => 5000,
  68.   23 => 1000,
  69.   24 => 3000,
  70.   25 => 300,
  71.   26 => 1000,
  72.   27 => 1500,
  73.   28 => 5000,
  74.   29 => 8000,
  75.   30 => 1500,
  76.   31 => 5000,
  77.   32 => 8000,
  78.   33 => 1500,
  79.   34 => 5000,
  80.   35 => 8000,
  81.   36 => 3500,
  82.   37 => 8000,
  83.   38 => 3500,
  84.   39 => 8000,
  85.   40 => 3500,
  86.   41 => 8000,
  87.   42 => 3500,
  88.   43 => 8000,
  89.   44 => 3500,
  90.   45 => 8000,
  91.   46 => 1500,
  92.   47 => 1500,
  93.   48 => 1500,
  94.   49 => 1500,
  95.   50 => 1500,
  96.   51 => 1500,
  97.   52 => 1500,
  98.   53 => 1500,
  99.   59 => 500,
  100.   60 => 2000,
  101.   61 => 8000,
  102.   62 => 15000,
  103.   63 => 500,
  104.   64 => 3000,
  105.   65 => 5000,
  106.   66 => 8000,
  107.   68 => 8000,
  108.   69 => 1500,
  109.   70 => 3000,
  110.   71 => 6000,
  111.   72 => 15000,
  112.   73 => 7000,
  113.   74 => 7000,
  114.   75 => 7000,
  115.   76 => 15000,
  116.   77 => 15000,
  117.   78 => 15000,
  118.   79 => 7000,
  119.   # End
  120.   }
  121.   # Hero Data
  122.   SKILL_BUY = {
  123.   # Add what skill can hero buy Here
  124.   # [ID of skill,Level]
  125.  
  126.   1 => [
  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],[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],
  129.  
  130.   ],
  131.  
  132.   2 => [
  133.  
  134.   [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],
  135.  
  136.   ],
  137.  
  138.   3 => [
  139.  
  140.   [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],
  141.  
  142.   ],
  143.  
  144.   4 => [
  145.  
  146.   [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],
  147.  
  148.   ],
  149.  
  150.   5 => [
  151.  
  152.   [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],
  153.  
  154.   ],
  155.  
  156.   # End
  157.   }
  158.   # Add Price
  159.   def self.skill_price(id)
  160.     if PRICE.include?(id)
  161.       return PRICE[id]
  162.     else
  163.       return PRICE[0]
  164.     end
  165.   end
  166.   # Add Hero id
  167.   def self.skill_buy(id)
  168.     if SKILL_BUY.include?(id)
  169.       return SKILL_BUY[id]
  170.     else
  171.       return []
  172.     end
  173.   end
  174. end
  175. #==============================================================================
  176. #class Game_Actor
  177. #==============================================================================
  178. class Game_Actor < Game_Battler
  179.   def learn?(skill)
  180.     learn = skill_learn?(skill)
  181.     if learn == true
  182.       return false
  183.     else
  184.       return true
  185.     end
  186.   end
  187. end
  188. #==============================================================================
  189. #class Window_Skill_ShopBuy
  190. #==============================================================================
  191. class Window_Skill_ShopBuy < Window_Selectable
  192.   #--------------------------------------------------------------------------
  193.   def initialize(x, y)
  194.     super(x, y, 304, 304)
  195.     @skill_shop_goods = $skill_shop
  196.     refresh
  197.     self.index = 0
  198.   end
  199.   #--------------------------------------------------------------------------
  200.   def skill
  201.     return @data[self.index]
  202.   end
  203.   #--------------------------------------------------------------------------
  204.   def refresh
  205.     @data = []
  206.     for i in [email]0...@skill_shop_goods.size[/email]
  207.       skill = $data_skills[@skill_shop_goods[i]]
  208.       if skill != nil
  209.         @data.push(skill)
  210.       end
  211.     end
  212.     @item_max = @data.size
  213.     create_contents
  214.     for i in 0...@item_max
  215.       draw_item(i)
  216.     end
  217.   end
  218.   #--------------------------------------------------------------------------
  219.   def draw_item(index)
  220.     skill = @data[index]
  221.     price = SKILL_SHOP.skill_price(skill.id)
  222.     enabled = (price <= $game_party.gold)
  223.     rect = item_rect(index)
  224.     self.contents.clear_rect(rect)
  225.     draw_item_name(skill, rect.x, rect.y, enabled)
  226.     rect.width -= 4
  227.     self.contents.draw_text(rect, price, 2)
  228.   end
  229.   #--------------------------------------------------------------------------
  230.   def update_help
  231.     @help_window.set_text(skill == nil ? "" : skill.description)
  232.   end
  233. end
  234. #==============================================================================
  235. #class Window_Skill_ShopStatus
  236. #==============================================================================
  237. class Window_Skill_ShopStatus < Window_Selectable
  238.   #--------------------------------------------------------------------------
  239.   def initialize(x, y)
  240.     super(x, y, 240, 304)
  241.     @item = nil
  242.     refresh
  243.     self.active = false
  244.     self.index = -1
  245.   end
  246.   #--------------------------------------------------------------------------
  247.   def refresh
  248.     self.contents.clear
  249.     @item_max = $game_party.members.size
  250.     if @item != nil
  251.       self.contents.font.color = system_color
  252.       self.contents.draw_text(4, 0, 200, WLH, SKILL_SHOP::How_Learn)
  253.       for actor in $game_party.members
  254.         x = 4
  255.         y = WLH * (2 + actor.index * 2)
  256.         draw_actor_can_learn(actor, x, y)
  257.       end
  258.     end
  259.   end
  260.   #--------------------------------------------------------------------------
  261.   def draw_actor_can_learn(actor, x, y)
  262.     can = false
  263.     lv = false
  264.     ac_lv = 0
  265.     can_learn = SKILL_SHOP.skill_buy(actor.id)
  266.     id = @item.id
  267.     for i in 0...can_learn.size
  268.       if can_learn[i][0] == id
  269.         can = true
  270.         if can_learn[i][1] <= actor.level
  271.           lv = true
  272.         else
  273.           lv = false
  274.           ac_lv = can_learn[i][1]
  275.         end
  276.         break
  277.       else
  278.         can = false
  279.       end
  280.     end
  281.     enabled = (can and lv and actor.learn?(@item))
  282.     self.contents.font.color = normal_color
  283.     self.contents.font.color.alpha = enabled ? 255 : 128
  284.     name = actor.character_name
  285.     index = actor.character_index
  286.     size = contents.text_size(actor.name).width
  287.     draw_character(name, index, x + 20 + size , y + 30)
  288.     self.contents.draw_text(x, y, 200, WLH, actor.name)
  289.     if can == false
  290.       text = SKILL_SHOP::Cant_Learn
  291.     elsif can == true and lv == false
  292.       ac = ac_lv.to_s
  293.       text = SKILL_SHOP::Can_Learn_Lv + " " + ac + "+"
  294.     elsif actor.learn?(@item) == false
  295.       text = SKILL_SHOP::Learnt
  296.     else
  297.       text = SKILL_SHOP::Can_Learn
  298.     end
  299.     self.contents.draw_text(x, y, 200, WLH, text, 2)
  300.   end
  301.   #--------------------------------------------------------------------------
  302.   def item=(item)
  303.     if @item != item
  304.       @item = item
  305.       refresh
  306.     end
  307.   end
  308.   #--------------------------------------------------------------------------
  309.   def update_cursor
  310.     if @index < 0
  311.       self.cursor_rect.empty
  312.     elsif @index < @item_max
  313.       y = WLH * (2 + @index * 2)
  314.       self.cursor_rect.set(0, y - 4, contents.width,34)
  315.     end
  316.   end
  317. end
  318. #==============================================================================
  319. #class Scene_Skill_Shop
  320. #==============================================================================
  321. class Scene_Skill_Shop < Scene_Base
  322.   #--------------------------------------------------------------------------
  323.   def start
  324.     super
  325.     create_menu_background
  326.     create_command_window
  327.     @viewport = Viewport.new(0, 0, 544, 416)
  328.     @help_window = Window_Help.new
  329.     @gold_window = Window_Gold.new(384, 56)
  330.     @dummy_window = Window_Base.new(0, 112, 544, 304)
  331.     @buy_window = Window_Skill_ShopBuy.new(0, 112)
  332.     @buy_window.active = false
  333.     @buy_window.visible = false
  334.     @buy_window.help_window = @help_window
  335.     @status_window = Window_Skill_ShopStatus.new(304, 112)
  336.     @status_window.visible = false
  337.     @status_window.active = false
  338.   end
  339.   #--------------------------------------------------------------------------
  340.   def terminate
  341.     super
  342.     dispose_menu_background
  343.     dispose_command_window
  344.     @help_window.dispose
  345.     @gold_window.dispose
  346.     @dummy_window.dispose
  347.     @buy_window.dispose
  348.     @status_window.dispose
  349.   end  
  350.   #--------------------------------------------------------------------------
  351.   def update
  352.     super
  353.     update_menu_background
  354.     @help_window.update
  355.     @command_window.update
  356.     @gold_window.update
  357.     @dummy_window.update
  358.     @buy_window.update
  359.     @status_window.update
  360.     if @command_window.active
  361.       update_command_selection
  362.     elsif @buy_window.active
  363.       update_buy_selection
  364.     elsif @status_window.active
  365.       update_target_selection
  366.     end
  367.   end
  368.   #--------------------------------------------------------------------------
  369.   def create_command_window
  370.     s1 = SKILL_SHOP::Teach
  371.     s2 = SKILL_SHOP::Cancel
  372.     @command_window = Window_Command.new(384, [s1, s2], 2)
  373.     @command_window.y = 56
  374.   end
  375.   #--------------------------------------------------------------------------
  376.   def dispose_command_window
  377.     @command_window.dispose
  378.   end
  379.   #--------------------------------------------------------------------------
  380.   def update_command_selection
  381.     @help_window.set_text("")
  382.     if Input.trigger?(Input::B)
  383.       Sound.play_cancel
  384.       $scene = Scene_Map.new
  385.     elsif Input.trigger?(Input::C)
  386.       case @command_window.index
  387.       when 0
  388.         Sound.play_decision
  389.         @command_window.active = false
  390.         @dummy_window.visible = false
  391.         @buy_window.active = true
  392.         @buy_window.visible = true
  393.         @buy_window.refresh
  394.         @status_window.visible = true
  395.       when 1
  396.         Sound.play_decision
  397.         $scene = Scene_Map.new
  398.       end
  399.     end
  400.   end
  401.   #--------------------------------------------------------------------------
  402.   def update_buy_selection
  403.     @status_window.item = @buy_window.skill
  404.     if Input.trigger?(Input::B)
  405.       Sound.play_cancel
  406.       @command_window.active = true
  407.       @dummy_window.visible = true
  408.       @buy_window.active = false
  409.       @buy_window.visible = false
  410.       @status_window.visible = false
  411.       @status_window.item = nil
  412.       return
  413.     end
  414.     if Input.trigger?(Input::C)
  415.       @item = @buy_window.skill
  416.       @price = SKILL_SHOP.skill_price(@item.id)
  417.       enabled = (@price <= $game_party.gold)
  418.       if not enabled
  419.         Sound.play_buzzer
  420.       else
  421.         Sound.play_decision
  422.         show_target_window
  423.       end
  424.     end
  425.   end
  426.   #--------------------------------------------------------------------------
  427.   def update_target_selection
  428.     if Input.trigger?(Input::B)
  429.       Sound.play_cancel
  430.       hide_target_window
  431.     elsif Input.trigger?(Input::C)
  432.       [url=home.php?mod=space&uid=95897]@actor[/url] = $game_party.members[@status_window.index]
  433.       can = false
  434.       lv = false
  435.       can_learn = SKILL_SHOP.skill_buy(@actor.id)
  436.       id = @item.id
  437.       for i in 0...can_learn.size
  438.         if can_learn[i][0] == id
  439.           can = true
  440.           if can_learn[i][1] <= @actor.level
  441.             lv = true
  442.           else
  443.             lv = false
  444.           end
  445.           break
  446.         else
  447.           can = false
  448.         end
  449.       end
  450.       enabled = (can and lv and @actor.learn?(@item))
  451.       if not enabled
  452.         Sound.play_buzzer
  453.       else
  454.         learn_target(@item.id)
  455.       end
  456.     end
  457.   end
  458.   #--------------------------------------------------------------------------
  459.   def learn_target(skill_id)
  460.     Sound.play_shop
  461.     @actor.learn_skill(skill_id)
  462.     $game_party.lose_gold(@price)
  463.     @buy_window.refresh
  464.     @gold_window.refresh
  465.     @status_window.refresh
  466.     hide_target_window
  467.   end
  468.   #--------------------------------------------------------------------------
  469.   def show_target_window
  470.     @buy_window.active = false
  471.     @status_window.active = true
  472.     @status_window.index = 0
  473.   end
  474.   #--------------------------------------------------------------------------
  475.   def hide_target_window
  476.     @buy_window.active = true
  477.     @status_window.active = false
  478.     @status_window.index =- 1
  479.   end
  480. end


作者: 原野清平    时间: 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,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
注意逗号。
爪机不好弄这东西……每一个数字(除了最后一个)都要加上逗号。
作者: sakazaki    时间: 2013-3-1 22:47
原野清平 发表于 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)

RUBY 代码复制
  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


當機

RUBY 代码复制
  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

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




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