查看: 2644|回复: 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寫法

[pre lang="ruby" line="1"]$skill_shop = [25,26,19,20,15,23,63,59,69]
$scene = Scene_Skill_Shop.new[/pre]

我只要第一行寫到跳行,它就當機了Q_Q
像是這樣
[pre lang="ruby" line="1"]$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[/pre]

請問如何修正

附上我設定好的腳本
[pre lang="ruby" line="1"]#==============================================================================
# RMVX魔法技能商店 Ver 2.0
#==============================================================================
# 作者: Nechigawara Sanzenin  翻译:一塌糊涂
# 警告!! : 仅限RMVX使用!! 不支持RMXP!!
#==============================================================================
# RMVX版 魔法技能商店
#==============================================================================
#Version Log
#==============================================================================
#2.0 Add Level requirement - Change Hero Select Window
#==============================================================================
=begin

使用方法:

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

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

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

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

  ],
  
  2 => [
  
  [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],
  
  ],

  3 => [
  
  [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],

  ],
  
  4 => [
  
  [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],

  ],

  5 => [
  
  [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],

  ],
  
  # End
  }
  # Add Price
  def self.skill_price(id)
    if PRICE.include?(id)
      return PRICE[id]
    else
      return PRICE[0]
    end
  end
  # Add Hero id
  def self.skill_buy(id)
    if SKILL_BUY.include?(id)
      return SKILL_BUY[id]
    else
      return []
    end
  end
end
#==============================================================================
#class Game_Actor
#==============================================================================
class Game_Actor < Game_Battler
  def learn?(skill)
    learn = skill_learn?(skill)
    if learn == true
      return false
    else
      return true
    end
  end
end
#==============================================================================
#class Window_Skill_ShopBuy
#==============================================================================
class Window_Skill_ShopBuy < Window_Selectable
  #--------------------------------------------------------------------------
  def initialize(x, y)
    super(x, y, 304, 304)
    @skill_shop_goods = $skill_shop
    refresh
    self.index = 0
  end
  #--------------------------------------------------------------------------
  def skill
    return @data[self.index]
  end
  #--------------------------------------------------------------------------
  def refresh
    @data = []
    for i in 0...@skill_shop_goods.size
      skill = $data_skills[@skill_shop_goods]
      if skill != nil
        @data.push(skill)
      end
    end
    @item_max = @data.size
    create_contents
    for i in 0...@item_max
      draw_item(i)
    end
  end
  #--------------------------------------------------------------------------
  def draw_item(index)
    skill = @data[index]
    price = SKILL_SHOP.skill_price(skill.id)
    enabled = (price <= $game_party.gold)
    rect = item_rect(index)
    self.contents.clear_rect(rect)
    draw_item_name(skill, rect.x, rect.y, enabled)
    rect.width -= 4
    self.contents.draw_text(rect, price, 2)
  end
  #--------------------------------------------------------------------------
  def update_help
    @help_window.set_text(skill == nil ? "" : skill.description)
  end
end
#==============================================================================
#class Window_Skill_ShopStatus
#==============================================================================
class Window_Skill_ShopStatus < Window_Selectable
  #--------------------------------------------------------------------------
  def initialize(x, y)
    super(x, y, 240, 304)
    @item = nil
    refresh
    self.active = false
    self.index = -1
  end
  #--------------------------------------------------------------------------
  def refresh
    self.contents.clear
    @item_max = $game_party.members.size
    if @item != nil
      self.contents.font.color = system_color
      self.contents.draw_text(4, 0, 200, WLH, SKILL_SHOP::How_Learn)
      for actor in $game_party.members
        x = 4
        y = WLH * (2 + actor.index * 2)
        draw_actor_can_learn(actor, x, y)
      end
    end
  end
  #--------------------------------------------------------------------------
  def draw_actor_can_learn(actor, x, y)
    can = false
    lv = false
    ac_lv = 0
    can_learn = SKILL_SHOP.skill_buy(actor.id)
    id = @item.id
    for i in 0...can_learn.size
      if can_learn[0] == id
        can = true
        if can_learn[1] <= actor.level
          lv = true
        else
          lv = false
          ac_lv = can_learn[1]
        end
        break
      else
        can = false
      end
    end
    enabled = (can and lv and actor.learn?(@item))
    self.contents.font.color = normal_color
    self.contents.font.color.alpha = enabled ? 255 : 128
    name = actor.character_name
    index = actor.character_index
    size = contents.text_size(actor.name).width
    draw_character(name, index, x + 20 + size , y + 30)
    self.contents.draw_text(x, y, 200, WLH, actor.name)
    if can == false
      text = SKILL_SHOP::Cant_Learn
    elsif can == true and lv == false
      ac = ac_lv.to_s
      text = SKILL_SHOP::Can_Learn_Lv + " " + ac + "+"
    elsif actor.learn?(@item) == false
      text = SKILL_SHOP::Learnt
    else
      text = SKILL_SHOP::Can_Learn
    end
    self.contents.draw_text(x, y, 200, WLH, text, 2)
  end
  #--------------------------------------------------------------------------
  def item=(item)
    if @item != item
      @item = item
      refresh
    end
  end
  #--------------------------------------------------------------------------
  def update_cursor
    if @index < 0
      self.cursor_rect.empty
    elsif @index < @item_max
      y = WLH * (2 + @index * 2)
      self.cursor_rect.set(0, y - 4, contents.width,34)
    end
  end
end
#==============================================================================
#class Scene_Skill_Shop
#==============================================================================
class Scene_Skill_Shop < Scene_Base
  #--------------------------------------------------------------------------
  def start
    super
    create_menu_background
    create_command_window
    @viewport = Viewport.new(0, 0, 544, 416)
    @help_window = Window_Help.new
    @gold_window = Window_Gold.new(384, 56)
    @dummy_window = Window_Base.new(0, 112, 544, 304)
    @buy_window = Window_Skill_ShopBuy.new(0, 112)
    @buy_window.active = false
    @buy_window.visible = false
    @buy_window.help_window = @help_window
    @status_window = Window_Skill_ShopStatus.new(304, 112)
    @status_window.visible = false
    @status_window.active = false
  end
  #--------------------------------------------------------------------------
  def terminate
    super
    dispose_menu_background
    dispose_command_window
    @help_window.dispose
    @gold_window.dispose
    @dummy_window.dispose
    @buy_window.dispose
    @status_window.dispose
  end  
  #--------------------------------------------------------------------------
  def update
    super
    update_menu_background
    @help_window.update
    @command_window.update
    @gold_window.update
    @dummy_window.update
    @buy_window.update
    @status_window.update
    if @command_window.active
      update_command_selection
    elsif @buy_window.active
      update_buy_selection
    elsif @status_window.active
      update_target_selection
    end
  end
  #--------------------------------------------------------------------------
  def create_command_window
    s1 = SKILL_SHOP::Teach
    s2 = SKILL_SHOP::Cancel
    @command_window = Window_Command.new(384, [s1, s2], 2)
    @command_window.y = 56
  end
  #--------------------------------------------------------------------------
  def dispose_command_window
    @command_window.dispose
  end
  #--------------------------------------------------------------------------
  def update_command_selection
    @help_window.set_text("")
    if Input.trigger?(Input::B)
      Sound.play_cancel
      $scene = Scene_Map.new
    elsif Input.trigger?(Input::C)
      case @command_window.index
      when 0
        Sound.play_decision
        @command_window.active = false
        @dummy_window.visible = false
        @buy_window.active = true
        @buy_window.visible = true
        @buy_window.refresh
        @status_window.visible = true
      when 1
        Sound.play_decision
        $scene = Scene_Map.new
      end
    end
  end
  #--------------------------------------------------------------------------
  def update_buy_selection
    @status_window.item = @buy_window.skill
    if Input.trigger?(Input::B)
      Sound.play_cancel
      @command_window.active = true
      @dummy_window.visible = true
      @buy_window.active = false
      @buy_window.visible = false
      @status_window.visible = false
      @status_window.item = nil
      return
    end
    if Input.trigger?(Input::C)
      @item = @buy_window.skill
      @price = SKILL_SHOP.skill_price(@item.id)
      enabled = (@price <= $game_party.gold)
      if not enabled
        Sound.play_buzzer
      else
        Sound.play_decision
        show_target_window
      end
    end
  end
  #--------------------------------------------------------------------------
  def update_target_selection
    if Input.trigger?(Input::B)
      Sound.play_cancel
      hide_target_window
    elsif Input.trigger?(Input::C)
      @actor = $game_party.members[@status_window.index]
      can = false
      lv = false
      can_learn = SKILL_SHOP.skill_buy(@actor.id)
      id = @item.id
      for i in 0...can_learn.size
        if can_learn[0] == id
          can = true
          if can_learn[1] <= @actor.level
            lv = true
          else
            lv = false
          end
          break
        else
          can = false
        end
      end
      enabled = (can and lv and @actor.learn?(@item))
      if not enabled
        Sound.play_buzzer
      else
        learn_target(@item.id)
      end
    end
  end
  #--------------------------------------------------------------------------
  def learn_target(skill_id)
    Sound.play_shop
    @actor.learn_skill(skill_id)
    $game_party.lose_gold(@price)
    @buy_window.refresh
    @gold_window.refresh
    @status_window.refresh
    hide_target_window
  end
  #--------------------------------------------------------------------------
  def show_target_window
    @buy_window.active = false
    @status_window.active = true
    @status_window.index = 0
  end
  #--------------------------------------------------------------------------
  def hide_target_window
    @buy_window.active = true
    @status_window.active = false
    @status_window.index =- 1
  end
end
[/pre]
梦石
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)

[pre lang="ruby" line="1"]$skill_shop =
[15,16,19,20,21,22,23,24,25,26,27,28,29,30,3
,1,2]
$scene = Scene_Skill_Shop.new[/pre]

當機

[pre lang="ruby" line="1"]$skill_shop =
[15,16,19,20,21,22,23,24,25,26,27,28,29,30,
31,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[/pre]

可以!!


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

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

点评

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

使用道具 举报

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

本版积分规则

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

在本版发帖返回顶部