设为首页收藏本站|繁體中文

Project1

 找回密码
 注册会员
搜索
查看: 1392|回复: 6
打印 上一主题 下一主题

[已经解决] 求改个脚本。把经验该为钱就行

 关闭 [复制链接]

Lv1.梦旅人

梦石
0
星屑
50
在线时间
207 小时
注册时间
2008-12-6
帖子
152
跳转到指定楼层
1
发表于 2011-7-27 23:40:24 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 zgm1100 于 2011-7-27 23:41 编辑
  1. $shizi_skillup_id = []
  2. $shizi_skillup_exp =[]
  3. =begin
  4. 技能升级系统
  5. 下面的为自定义内容,格式为:
  6. $shizi_skillup_id[0] = [[技能ID]     ,[技能ID]     , .. ,[技能ID]        ]
  7. $shizi_skillup_exp[0] =[[升级需要EXP],[升级需要EXP], .. ,[是否保留原技能]]
  8. $shizi_skillup_id[1] = [[技能ID]     ,[技能ID]     , .. ,[技能ID]        ]
  9. $shizi_skillup_exp[1] =[[升级需要EXP],[升级需要EXP], .. ,[是否保留原技能]]
  10. ...
  11. 空格可以去掉, 那只是编写时对齐用的
  12. 如果保留原技能(升级不遗忘旧技能,具体功能自己开发),“是否保留原技能”为true,
  13. 否则为false
  14. 技能ID一定要用[]框住,而“是否保留原技能”则不需要。
  15. 自定义内容↓
  16. =end
  17. $shizi_技能学习音 = ["005-System05",80]
  18. $shizi_skillup_id[0] = [[1],[2],[3]  ]
  19. $shizi_skillup_exp[0] =[100,200,false]
  20. $shizi_skillup_id[1] = [[2,3],[4] ]
  21. $shizi_skillup_exp[1] =[500  ,true]
  22. $shizi_skillup_id[2] = [[4] ,[5]  ]
  23. $shizi_skillup_exp[2] =[1000,false]
  24. $shizi_skillup_id[3] = [[22],[23],[24] ]
  25. $shizi_skillup_exp[3] =[300 ,600 ,false]
  26. $shizi_skillup_id[4] = [[23,24],[59]]
  27. $shizi_skillup_exp[4] =[1500   ,true]
  28. #==============================================================================
  29. # 脚本内容
  30. #==============================================================================
  31. def get_nextskill(id,actor)
  32.   get = []
  33.   if $shizi_skillup_id.size != $shizi_skillup_exp.size
  34.     p "数量不符"
  35.     exit
  36.   end
  37.   for i in 0...$shizi_skillup_id.size
  38.     i_1 = $shizi_skillup_id[i]
  39.     for j in 2..i_1.size
  40.       j_1 = i_1[i_1.size-j]
  41.       if j_1.include?(id)
  42.         skill = $shizi_skillup_exp[i]
  43.         skill_1 = skill[j_1.size-j]
  44.         if skill.include?(true)
  45.           get[get.size] = [i_1[i_1.size-j+1][0],skill[i_1.size-j],true]
  46.         else
  47.           get[get.size] = [i_1[i_1.size-j+1][0],skill[i_1.size-j],false]
  48.         end
  49.       end
  50.     end
  51.   end
  52.   skill_id = []
  53.   for i in 0...actor.skills.size
  54.     skill = $data_skills[actor.skills[i]]
  55.     if skill != nil
  56.       skill_id.push(skill)
  57.     end
  58.   end
  59.   for i in 0...get.size
  60.     if skill_id.include?(get[i][0])
  61.       get.delete_at(i)
  62.     end
  63.   end
  64.   return get
  65. end
  66. def get_nextskill_id(num)
  67.   get = []
  68.   for i in num
  69.     get[get.size] = i[0]
  70.   end
  71.   return get
  72. end
  73. #==============================================================================
  74. # ● 空白窗口
  75. #==============================================================================
  76. class Window_Shizi_White < Window_Base
  77.   def initialize
  78.     super(0,0,640,480)
  79.     self.contents = Bitmap.new(width - 32, height - 32)
  80.   end
  81.   def clear
  82.     self.contents.clear
  83.   end
  84.   def refresh
  85.     self.contents = Bitmap.new(width - 32, height - 32)
  86.   end
  87.   def draw(text, align = 1)
  88.     if text != @text or align != @align
  89.       self.contents.clear
  90.       self.contents.font.color = normal_color
  91.       self.contents.draw_text(4, 0, self.width - 40, 32, text, align)
  92.       @text = text
  93.       @align = align
  94.     end
  95.     self.visible = true
  96.   end
  97. end
  98. #==============================================================================
  99. # ● 选择技能窗口
  100. #==============================================================================
  101. class Window_Shizi_Skill < Window_Selectable
  102.   def initialize(actor)
  103.     super(0, 0, 320, 416)
  104.     self.contents = Bitmap.new(width - 32, height - 32)
  105.     self.y = 64
  106.     @actor = actor
  107.     refresh
  108.     self.index = 0
  109.   end
  110.   def skill
  111.     return @data[self.index]
  112.   end
  113.   def refresh
  114.     if self.contents != nil
  115.       self.contents.dispose
  116.       self.contents = nil
  117.     end
  118.     @data = []
  119.     for i in [email protected]
  120.       skill = $data_skills[@actor.skills[i]]
  121.       if skill != nil
  122.         @data.push(skill)
  123.       end
  124.     end
  125.     @item_max = @data.size
  126.     if @item_max > 0
  127.       self.contents = Bitmap.new(width - 32, row_max * 32)
  128.       for i in 0...@item_max
  129.         draw_item(i)
  130.       end
  131.     end
  132.   end
  133.   def draw_item(index)
  134.     skill = @data[index]
  135.     if @actor.skill_can_use?(skill.id)
  136.       self.contents.font.color = normal_color
  137.     else
  138.       self.contents.font.color = disabled_color
  139.     end
  140.     x = 4
  141.     y = index * 32
  142.     rect = Rect.new(x, y, self.width / @column_max - 32, 32)
  143.     self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
  144.     bitmap = RPG::Cache.icon(skill.icon_name)
  145.     opacity = self.contents.font.color == normal_color ? 255 : 128
  146.     self.contents.blt(x, y + 4, bitmap, Rect.new(0, 0, 24, 24), opacity)
  147.     self.contents.draw_text(x + 28, y, 204, 32, skill.name, 0)
  148.     self.contents.draw_text(x + 232, y, 48, 32, skill.sp_cost.to_s, 2)
  149.   end
  150. end
  151. #==============================================================================
  152. # ● 升级技能窗口
  153. #==============================================================================
  154. class Window_Shizi_Skillup < Window_Selectable
  155.   def initialize
  156.     super(0, 0, 320, 416)
  157.     self.contents = Bitmap.new(width - 32, height - 32)
  158.     self.y = 64
  159.     self.x = 320
  160.     self.index = 0
  161.   end
  162.   def refresh(num,exp,skil)
  163.     if self.contents != nil
  164.       self.contents.dispose
  165.       self.contents = nil
  166.     end
  167.     @data = get_nextskill_id(num)
  168.     @item_max = @data.size
  169.     if @item_max > 0
  170.       self.contents = Bitmap.new(width - 32, row_max * 32)
  171.       for i in 0...@item_max
  172.         draw_item(i,exp,num,skil)
  173.       end
  174.     else
  175.       self.contents = Bitmap.new(width - 32, height - 32)
  176.       self.contents.font.color = disabled_color
  177.       self.contents.draw_text(0, 0, width - 32, 32, "不能再升级", 1)
  178.     end
  179.   end
  180.   def draw_item(index,exp,num,skil)
  181.     skill = $data_skills[@data[index]]
  182.     if exp >= num[index][1] or skil.include?(skill)
  183.       self.contents.font.color = normal_color
  184.     else
  185.       self.contents.font.color = disabled_color
  186.     end
  187.     x = 4
  188.     y = index * 32
  189.     rect = Rect.new(x, y, self.width / @column_max - 32, 32)
  190.     self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
  191.     bitmap = RPG::Cache.icon(skill.icon_name)
  192.     opacity = self.contents.font.color == normal_color ? 255 : 128
  193.     self.contents.blt(x, y + 4, bitmap, Rect.new(0, 0, 24, 24), opacity)
  194.     self.contents.draw_text(x + 28, y, 204, 32, skill.name, 0)
  195.     self.contents.draw_text(x + 232, y, 48, 32, skill.sp_cost.to_s, 2)
  196.   end
  197. end
  198. #==============================================================================
  199. # ● 升级技能场景
  200. #==============================================================================
  201. class Scene_Skillup
  202.   def initialize(actor_index = 0, equip_index = 0)
  203.     @actor_index = actor_index
  204.   end
  205.   def main
  206.     @actor = $game_party.actors[@actor_index]
  207.     @skill_window = Window_Shizi_Skill.new(@actor)
  208.     @skill_window.index = 0
  209.     @skill_window.active = true
  210.     @skillup_window = Window_Shizi_Skillup.new
  211.     @skillup_window.active = false
  212.     @draw_window = Window_Shizi_White.new
  213.     @draw_window.height = 64
  214.     @draw_window.refresh
  215.     Graphics.transition
  216.     loop do
  217.       Graphics.update
  218.       Input.update
  219.       update
  220.       if $scene != self
  221.         break
  222.       end
  223.     end
  224.     Graphics.freeze
  225.     @skill_window.dispose
  226.     @skillup_window.dispose
  227.     @draw_window.dispose
  228.   end
  229.   def update
  230.     if @skillindex == nil and @skill_window.active
  231.       @skillindex = 0
  232.       @skill_id_1 = @skill_window.skill.id
  233.       @skill_id_2 = get_nextskill(@skill_id_1,@actor)
  234.       @skillup_window.refresh(@skill_id_2,@actor.exp,get_skil)
  235.       text = @actor.name + "  " + "exp:"+ @actor.exp.to_s
  236.       @draw_window.draw(text)
  237.     end
  238.     if @skillupindex == nil and @skillup_window.active
  239.       @skillupindex = 0
  240.       text ="升级需要经验:" + @skill_id_2[@skillup_window.index][1].to_s
  241.       @draw_window.draw(text)
  242.     end
  243.     @skill_window.update
  244.     @skillup_window.update
  245.     @draw_window.update
  246.     if @skill_window.active
  247.       update_skill
  248.       return
  249.     end
  250.     if @skillup_window.active
  251.       update_skillup
  252.       return
  253.     end
  254.   end
  255.   def get_skil
  256.     skil = []
  257.     for i in [email protected]
  258.       shizi_skill = $data_skills[@actor.skills[i]]
  259.       if shizi_skill != nil
  260.         skil.push(shizi_skill.id)
  261.       end
  262.     end
  263.     return skil
  264.   end
  265.   def update_skill
  266.     if Input.trigger?(Input::R)
  267.       $game_system.se_play($data_system.cursor_se)
  268.       @actor_index += 1
  269.       @actor_index %= $game_party.actors.size
  270.       $scene = Scene_Skillup.new(@actor_index)
  271.       return
  272.     end
  273.     if Input.trigger?(Input::L)
  274.       $game_system.se_play($data_system.cursor_se)
  275.       @actor_index += $game_party.actors.size - 1
  276.       @actor_index %= $game_party.actors.size
  277.       $scene = Scene_Skillup.new(@actor_index)
  278.       return
  279.     end
  280.     if Input.trigger?(Input::B)
  281.       $game_system.se_play($data_system.cancel_se)
  282.       $scene = Scene_Map.new
  283.       return
  284.     end
  285.     if @skill_window.index != @skillindex
  286.       @skillindex = @skill_window.index
  287.       @skill_id_1 = @skill_window.skill.id
  288.       @skill_id_2 = get_nextskill(@skill_id_1,@actor)
  289.       @skillup_window.refresh(@skill_id_2,@actor.exp,get_skil)
  290.     end
  291.     if Input.trigger?(Input::C)
  292.       if @skill_id_2 != []
  293.         @skill_window.active = false
  294.         @skillup_window.active = true
  295.         $game_system.se_play($data_system.decision_se)
  296.         @skillindex = nil
  297.       else
  298.         $game_system.se_play($data_system.buzzer_se)
  299.       end
  300.     end
  301.   end
  302.   def update_skillup
  303.     if @skillup_window.index != @skillupindex
  304.       @skillupindex = @skillup_window.index
  305.       text ="升级需要经验:" + @skill_id_2[@skillup_window.index][1].to_s
  306.       @draw_window.draw(text)
  307.     end
  308.     if Input.trigger?(Input::B)
  309.       $game_system.se_play($data_system.cancel_se)
  310.       @skillup_window.index = 0
  311.       @skillup_window.active = false
  312.       @skill_window.active = true
  313.       @skillupindex = nil
  314.       return
  315.     end
  316.     if Input.trigger?(Input::C)
  317.       if @actor.exp >= @skill_id_2[@skillup_window.index][1] and @actor.skill_learn?(@skill_id_2[@skillup_window.index][0]) == false
  318.         Audio.se_play("Audio/SE/" + $shizi_技能学习音[0],$shizi_技能学习音[1])
  319.         @actor.exp -= @skill_id_2[@skillup_window.index][1]
  320.         if @skill_id_2[@skillup_window.index][2] == false
  321.           @actor.forget_skill(@skill_window.skill.id)
  322.         end
  323.         @actor.learn_skill(@skill_id_2[@skillup_window.index][0])
  324.         @skill_window.refresh
  325.         @skill_id_1 = @skill_window.skill.id
  326.         @skill_id_2 = get_nextskill(@skill_id_1,@actor)
  327.         @skillup_window.refresh(@skill_id_2,@actor.exp,get_skil)
  328.         @skillup_window.index = 0
  329.         if get_nextskill(@skill_window.skill.id,@actor) == []
  330.           @skillup_window.active = false
  331.           @skillupindex = nil
  332.           @skill_window.active = true
  333.         end
  334.       else
  335.         $game_system.se_play($data_system.buzzer_se)
  336.       end
  337.     end
  338.   end
  339. end
复制代码
就是把技能升级所需要的经验,该为需要钱升级就行。

点评

噗这个不是我的脚本么  发表于 2011-7-27 23:52
小 · Μ
我的游戏:
http://rpg.blue/thread-208614-1-1.html

Lv1.梦旅人

虱子

梦石
0
星屑
121
在线时间
1782 小时
注册时间
2010-6-19
帖子
3597
2
发表于 2011-7-27 23:57:27 | 只看该作者
  1. $shizi_skillup_id = []
  2. $shizi_skillup_exp =[]
  3. =begin
  4. 技能升级系统
  5. 下面的为自定义内容,格式为:
  6. $shizi_skillup_id[0] = [[技能ID]     ,[技能ID]     , .. ,[技能ID]        ]
  7. $shizi_skillup_exp[0] =[[升级需要EXP],[升级需要EXP], .. ,[是否保留原技能]]
  8. $shizi_skillup_id[1] = [[技能ID]     ,[技能ID]     , .. ,[技能ID]        ]
  9. $shizi_skillup_exp[1] =[[升级需要EXP],[升级需要EXP], .. ,[是否保留原技能]]
  10. ...
  11. 空格可以去掉, 那只是编写时对齐用的
  12. 如果保留原技能(升级不遗忘旧技能,具体功能自己开发),“是否保留原技能”为true,
  13. 否则为false
  14. 技能ID一定要用[]框住,而“是否保留原技能”则不需要。
  15. 自定义内容↓
  16. =end
  17. $shizi_技能学习音 = ["005-System05",80]
  18. $shizi_skillup_id[0] = [[1],[2],[3]  ]
  19. $shizi_skillup_exp[0] =[100,200,false]
  20. $shizi_skillup_id[1] = [[2,3],[4] ]
  21. $shizi_skillup_exp[1] =[500  ,true]
  22. $shizi_skillup_id[2] = [[4] ,[5]  ]
  23. $shizi_skillup_exp[2] =[1000,false]
  24. $shizi_skillup_id[3] = [[22],[23],[24] ]
  25. $shizi_skillup_exp[3] =[300 ,600 ,false]
  26. $shizi_skillup_id[4] = [[23,24],[59]]
  27. $shizi_skillup_exp[4] =[1500   ,true]
  28. #==============================================================================
  29. # 脚本内容
  30. #==============================================================================
  31. def get_nextskill(id,actor)
  32.   get = []
  33.   if $shizi_skillup_id.size != $shizi_skillup_exp.size
  34.     p "数量不符"
  35.     exit
  36.   end
  37.   for i in 0...$shizi_skillup_id.size
  38.     i_1 = $shizi_skillup_id[i]
  39.     for j in 2..i_1.size
  40.       j_1 = i_1[i_1.size-j]
  41.       if j_1.include?(id)
  42.         skill = $shizi_skillup_exp[i]
  43.         skill_1 = skill[j_1.size-j]
  44.         if skill.include?(true)
  45.           get[get.size] = [i_1[i_1.size-j+1][0],skill[i_1.size-j],true]
  46.         else
  47.           get[get.size] = [i_1[i_1.size-j+1][0],skill[i_1.size-j],false]
  48.         end
  49.       end
  50.     end
  51.   end
  52.   skill_id = []
  53.   for i in 0...actor.skills.size
  54.     skill = $data_skills[actor.skills[i]]
  55.     if skill != nil
  56.       skill_id.push(skill)
  57.     end
  58.   end
  59.   for i in 0...get.size
  60.     if skill_id.include?(get[i][0])
  61.       get.delete_at(i)
  62.     end
  63.   end
  64.   return get
  65. end
  66. def get_nextskill_id(num)
  67.   get = []
  68.   for i in num
  69.     get[get.size] = i[0]
  70.   end
  71.   return get
  72. end
  73. #==============================================================================
  74. # ● 空白窗口
  75. #==============================================================================
  76. class Window_Shizi_White < Window_Base
  77.   def initialize
  78.     super(0,0,640,480)
  79.     self.contents = Bitmap.new(width - 32, height - 32)
  80.   end
  81.   def clear
  82.     self.contents.clear
  83.   end
  84.   def refresh
  85.     self.contents = Bitmap.new(width - 32, height - 32)
  86.   end
  87.   def draw(text, align = 1)
  88.     if text != @text or align != @align
  89.       self.contents.clear
  90.       self.contents.font.color = normal_color
  91.       self.contents.draw_text(4, 0, self.width - 40, 32, text, align)
  92.       @text = text
  93.       @align = align
  94.     end
  95.     self.visible = true
  96.   end
  97. end
  98. #==============================================================================
  99. # ● 选择技能窗口
  100. #==============================================================================
  101. class Window_Shizi_Skill < Window_Selectable
  102.   def initialize(actor)
  103.     super(0, 0, 320, 416)
  104.     self.contents = Bitmap.new(width - 32, height - 32)
  105.     self.y = 64
  106.     @actor = actor
  107.     refresh
  108.     self.index = 0
  109.   end
  110.   def skill
  111.     return @data[self.index]
  112.   end
  113.   def refresh
  114.     if self.contents != nil
  115.       self.contents.dispose
  116.       self.contents = nil
  117.     end
  118.     @data = []
  119.     for i in [email protected]
  120.       skill = $data_skills[@actor.skills[i]]
  121.       if skill != nil
  122.         @data.push(skill)
  123.       end
  124.     end
  125.     @item_max = @data.size
  126.     if @item_max > 0
  127.       self.contents = Bitmap.new(width - 32, row_max * 32)
  128.       for i in 0...@item_max
  129.         draw_item(i)
  130.       end
  131.     end
  132.   end
  133.   def draw_item(index)
  134.     skill = @data[index]
  135.     if @actor.skill_can_use?(skill.id)
  136.       self.contents.font.color = normal_color
  137.     else
  138.       self.contents.font.color = disabled_color
  139.     end
  140.     x = 4
  141.     y = index * 32
  142.     rect = Rect.new(x, y, self.width / @column_max - 32, 32)
  143.     self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
  144.     bitmap = RPG::Cache.icon(skill.icon_name)
  145.     opacity = self.contents.font.color == normal_color ? 255 : 128
  146.     self.contents.blt(x, y + 4, bitmap, Rect.new(0, 0, 24, 24), opacity)
  147.     self.contents.draw_text(x + 28, y, 204, 32, skill.name, 0)
  148.     self.contents.draw_text(x + 232, y, 48, 32, skill.sp_cost.to_s, 2)
  149.   end
  150. end
  151. #==============================================================================
  152. # ● 升级技能窗口
  153. #==============================================================================
  154. class Window_Shizi_Skillup < Window_Selectable
  155.   def initialize
  156.     super(0, 0, 320, 416)
  157.     self.contents = Bitmap.new(width - 32, height - 32)
  158.     self.y = 64
  159.     self.x = 320
  160.     self.index = 0
  161.   end
  162.   def refresh(num,gold,skil)
  163.     if self.contents != nil
  164.       self.contents.dispose
  165.       self.contents = nil
  166.     end
  167.     @data = get_nextskill_id(num)
  168.     @item_max = @data.size
  169.     if @item_max > 0
  170.       self.contents = Bitmap.new(width - 32, row_max * 32)
  171.       for i in 0...@item_max
  172.         draw_item(i,gold,num,skil)
  173.       end
  174.     else
  175.       self.contents = Bitmap.new(width - 32, height - 32)
  176.       self.contents.font.color = disabled_color
  177.       self.contents.draw_text(0, 0, width - 32, 32, "不能再升级", 1)
  178.     end
  179.   end
  180.   def draw_item(index,gold,num,skil)
  181.     skill = $data_skills[@data[index]]
  182.     if $game_party.gold >= num[index][1] or skil.include?(skill)
  183.       self.contents.font.color = normal_color
  184.     else
  185.       self.contents.font.color = disabled_color
  186.     end
  187.     x = 4
  188.     y = index * 32
  189.     rect = Rect.new(x, y, self.width / @column_max - 32, 32)
  190.     self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
  191.     bitmap = RPG::Cache.icon(skill.icon_name)
  192.     opacity = self.contents.font.color == normal_color ? 255 : 128
  193.     self.contents.blt(x, y + 4, bitmap, Rect.new(0, 0, 24, 24), opacity)
  194.     self.contents.draw_text(x + 28, y, 204, 32, skill.name, 0)
  195.     self.contents.draw_text(x + 232, y, 48, 32, skill.sp_cost.to_s, 2)
  196.   end
  197. end
  198. #==============================================================================
  199. # ● 升级技能场景
  200. #==============================================================================
  201. class Scene_Skillup
  202.   def initialize(actor_index = 0, equip_index = 0)
  203.     @actor_index = actor_index
  204.   end
  205.   def main
  206.     @actor = $game_party.actors[@actor_index]
  207.     @skill_window = Window_Shizi_Skill.new(@actor)
  208.     @skill_window.index = 0
  209.     @skill_window.active = true
  210.     @skillup_window = Window_Shizi_Skillup.new
  211.     @skillup_window.active = false
  212.     @draw_window = Window_Shizi_White.new
  213.     @draw_window.height = 64
  214.     @draw_window.refresh
  215.     Graphics.transition
  216.     loop do
  217.       Graphics.update
  218.       Input.update
  219.       update
  220.       if $scene != self
  221.         break
  222.       end
  223.     end
  224.     Graphics.freeze
  225.     @skill_window.dispose
  226.     @skillup_window.dispose
  227.     @draw_window.dispose
  228.   end
  229.   def update
  230.     if @skillindex == nil and @skill_window.active
  231.       @skillindex = 0
  232.       @skill_id_1 = @skill_window.skill.id
  233.       @skill_id_2 = get_nextskill(@skill_id_1,@actor)
  234.       @skillup_window.refresh(@skill_id_2,$game_party.gold,get_skil)
  235.       text = @actor.name + "  " + "金钱:"+ $game_player.gold.to_s
  236.       @draw_window.draw(text)
  237.     end
  238.     if @skillupindex == nil and @skillup_window.active
  239.       @skillupindex = 0
  240.       text ="升级需要金钱:" + @skill_id_2[@skillup_window.index][1].to_s
  241.       @draw_window.draw(text)
  242.     end
  243.     @skill_window.update
  244.     @skillup_window.update
  245.     @draw_window.update
  246.     if @skill_window.active
  247.       update_skill
  248.       return
  249.     end
  250.     if @skillup_window.active
  251.       update_skillup
  252.       return
  253.     end
  254.   end
  255.   def get_skil
  256.     skil = []
  257.     for i in [email protected]
  258.       shizi_skill = $data_skills[@actor.skills[i]]
  259.       if shizi_skill != nil
  260.         skil.push(shizi_skill.id)
  261.       end
  262.     end
  263.     return skil
  264.   end
  265.   def update_skill
  266.     if Input.trigger?(Input::R)
  267.       $game_system.se_play($data_system.cursor_se)
  268.       @actor_index += 1
  269.       @actor_index %= $game_party.actors.size
  270.       $scene = Scene_Skillup.new(@actor_index)
  271.       return
  272.     end
  273.     if Input.trigger?(Input::L)
  274.       $game_system.se_play($data_system.cursor_se)
  275.       @actor_index += $game_party.actors.size - 1
  276.       @actor_index %= $game_party.actors.size
  277.       $scene = Scene_Skillup.new(@actor_index)
  278.       return
  279.     end
  280.     if Input.trigger?(Input::B)
  281.       $game_system.se_play($data_system.cancel_se)
  282.       $scene = Scene_Map.new
  283.       return
  284.     end
  285.     if @skill_window.index != @skillindex
  286.       @skillindex = @skill_window.index
  287.       @skill_id_1 = @skill_window.skill.id
  288.       @skill_id_2 = get_nextskill(@skill_id_1,@actor)
  289.       @skillup_window.refresh(@skill_id_2,$game_party.gold,get_skil)
  290.     end
  291.     if Input.trigger?(Input::C)
  292.       if @skill_id_2 != []
  293.         @skill_window.active = false
  294.         @skillup_window.active = true
  295.         $game_system.se_play($data_system.decision_se)
  296.         @skillindex = nil
  297.       else
  298.         $game_system.se_play($data_system.buzzer_se)
  299.       end
  300.     end
  301.   end
  302.   def update_skillup
  303.     if @skillup_window.index != @skillupindex
  304.       @skillupindex = @skillup_window.index
  305.       text ="升级需要金钱:" + @skill_id_2[@skillup_window.index][1].to_s
  306.       @draw_window.draw(text)
  307.     end
  308.     if Input.trigger?(Input::B)
  309.       $game_system.se_play($data_system.cancel_se)
  310.       @skillup_window.index = 0
  311.       @skillup_window.active = false
  312.       @skill_window.active = true
  313.       @skillupindex = nil
  314.       return
  315.     end
  316.     if Input.trigger?(Input::C)
  317.       if $game_party.gold >= @skill_id_2[@skillup_window.index][1] and @actor.skill_learn?(@skill_id_2[@skillup_window.index][0]) == false
  318.         Audio.se_play("Audio/SE/" + $shizi_技能学习音[0],$shizi_技能学习音[1])
  319.         $game_party.gold -= @skill_id_2[@skillup_window.index][1]
  320.         if @skill_id_2[@skillup_window.index][2] == false
  321.           @actor.forget_skill(@skill_window.skill.id)
  322.         end
  323.         @actor.learn_skill(@skill_id_2[@skillup_window.index][0])
  324.         @skill_window.refresh
  325.         @skill_id_1 = @skill_window.skill.id
  326.         @skill_id_2 = get_nextskill(@skill_id_1,@actor)
  327.         @skillup_window.refresh(@skill_id_2,@actor.exp,get_skil)
  328.         @skillup_window.index = 0
  329.         if get_nextskill(@skill_window.skill.id,@actor) == []
  330.           @skillup_window.active = false
  331.           @skillupindex = nil
  332.           @skill_window.active = true
  333.         end
  334.       else
  335.         $game_system.se_play($data_system.buzzer_se)
  336.       end
  337.     end
  338.   end
  339. end
复制代码
不确定成功

http://rpg.blue/thread-175056-1-2.html
PVZ型塔防物一个
http://rpg.blue/thread-155199-1-2.html
RMXP技术讨论区手动认可帖,得到答案请认可
回复

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
50
在线时间
207 小时
注册时间
2008-12-6
帖子
152
3
 楼主| 发表于 2011-7-28 00:19:47 | 只看该作者
不行。。会直接退出游戏
小 · Μ
我的游戏:
http://rpg.blue/thread-208614-1-1.html
回复

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
57
在线时间
161 小时
注册时间
2011-2-2
帖子
469
4
发表于 2011-7-28 00:35:01 | 只看该作者
  1. $shizi_技能学习音 = ["005-System05",80]

  2. $shizi_skillup_id[0] = [[1],[2],[3]  ]

  3. $shizi_skillup_gold[0] =[100,200,false]

  4. $shizi_skillup_id[1] = [[2,3],[4] ]

  5. $shizi_skillup_gold[1] =[500  ,true]

  6. $shizi_skillup_id[2] = [[4] ,[5]  ]

  7. $shizi_skillup_gold[2] =[1000,false]

  8. $shizi_skillup_id[3] = [[22],[23],[24] ]

  9. $shizi_skillup_gold[3] =[300 ,600 ,false]

  10. $shizi_skillup_id[4] = [[23,24],[59]]

  11. $shizi_skillup_gold[4] =[1500   ,true]

复制代码
在自定义那覆盖上
我又回来打酱油了
回复

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
50
在线时间
207 小时
注册时间
2008-12-6
帖子
152
5
 楼主| 发表于 2011-7-28 09:57:10 | 只看该作者
还是不行,,一调用$scene = Scene_Skillup.new就会退出游戏。、
小 · Μ
我的游戏:
http://rpg.blue/thread-208614-1-1.html
回复

使用道具 举报

Lv1.梦旅人

虱子

梦石
0
星屑
121
在线时间
1782 小时
注册时间
2010-6-19
帖子
3597
6
发表于 2011-7-28 10:53:14 | 只看该作者
  1. $shizi_skillup_id = []
  2. $shizi_skillup_exp =[]
  3. =begin
  4. 技能升级系统
  5. 下面的为自定义内容,格式为:
  6. $shizi_skillup_id[0] = [[技能ID]     ,[技能ID]     , .. ,[技能ID]        ]
  7. $shizi_skillup_exp[0] =[[升级需要EXP],[升级需要EXP], .. ,[是否保留原技能]]
  8. $shizi_skillup_id[1] = [[技能ID]     ,[技能ID]     , .. ,[技能ID]        ]
  9. $shizi_skillup_exp[1] =[[升级需要EXP],[升级需要EXP], .. ,[是否保留原技能]]
  10. ...
  11. 空格可以去掉, 那只是编写时对齐用的
  12. 如果保留原技能(升级不遗忘旧技能,具体功能自己开发),“是否保留原技能”为true,
  13. 否则为false
  14. 技能ID一定要用[]框住,而“是否保留原技能”则不需要。
  15. 自定义内容↓
  16. =end
  17. $shizi_技能学习音 = ["005-System05",80]
  18. $shizi_skillup_id[0] = [[1],[2],[3]  ]
  19. $shizi_skillup_exp[0] =[100,200,false]
  20. $shizi_skillup_id[1] = [[2,3],[4] ]
  21. $shizi_skillup_exp[1] =[500  ,true]
  22. $shizi_skillup_id[2] = [[4] ,[5]  ]
  23. $shizi_skillup_exp[2] =[1000,false]
  24. $shizi_skillup_id[3] = [[22],[23],[24] ]
  25. $shizi_skillup_exp[3] =[300 ,600 ,false]
  26. $shizi_skillup_id[4] = [[23,24],[59]]
  27. $shizi_skillup_exp[4] =[1500   ,true]
  28. #==============================================================================
  29. # 脚本内容
  30. #==============================================================================
  31. def get_nextskill(id,actor)
  32.   get = []
  33.   if $shizi_skillup_id.size != $shizi_skillup_exp.size
  34.     p "数量不符"
  35.     exit
  36.   end
  37.   for i in 0...$shizi_skillup_id.size
  38.     i_1 = $shizi_skillup_id[i]
  39.     for j in 2..i_1.size
  40.       j_1 = i_1[i_1.size-j]
  41.       if j_1.include?(id)
  42.         skill = $shizi_skillup_exp[i]
  43.         skill_1 = skill[j_1.size-j]
  44.         if skill.include?(true)
  45.           get[get.size] = [i_1[i_1.size-j+1][0],skill[i_1.size-j],true]
  46.         else
  47.           get[get.size] = [i_1[i_1.size-j+1][0],skill[i_1.size-j],false]
  48.         end
  49.       end
  50.     end
  51.   end
  52.   skill_id = []
  53.   for i in 0...actor.skills.size
  54.     skill = $data_skills[actor.skills[i]]
  55.     if skill != nil
  56.       skill_id.push(skill)
  57.     end
  58.   end
  59.   for i in 0...get.size
  60.     if skill_id.include?(get[i][0])
  61.       get.delete_at(i)
  62.     end
  63.   end
  64.   return get
  65. end
  66. def get_nextskill_id(num)
  67.   get = []
  68.   for i in num
  69.     get[get.size] = i[0]
  70.   end
  71.   return get
  72. end
  73. #==============================================================================
  74. # ● 空白窗口
  75. #==============================================================================
  76. class Window_Shizi_White < Window_Base
  77.   def initialize
  78.     super(0,0,640,480)
  79.     self.contents = Bitmap.new(width - 32, height - 32)
  80.   end
  81.   def clear
  82.     self.contents.clear
  83.   end
  84.   def refresh
  85.     self.contents = Bitmap.new(width - 32, height - 32)
  86.   end
  87.   def draw(text, align = 1)
  88.     if text != @text or align != @align
  89.       self.contents.clear
  90.       self.contents.font.color = normal_color
  91.       self.contents.draw_text(4, 0, self.width - 40, 32, text, align)
  92.       @text = text
  93.       @align = align
  94.     end
  95.     self.visible = true
  96.   end
  97. end
  98. #==============================================================================
  99. # ● 选择技能窗口
  100. #==============================================================================
  101. class Window_Shizi_Skill < Window_Selectable
  102.   def initialize(actor)
  103.     super(0, 0, 320, 416)
  104.     self.contents = Bitmap.new(width - 32, height - 32)
  105.     self.y = 64
  106.     @actor = actor
  107.     refresh
  108.     self.index = 0
  109.   end
  110.   def skill
  111.     return @data[self.index]
  112.   end
  113.   def refresh
  114.     if self.contents != nil
  115.       self.contents.dispose
  116.       self.contents = nil
  117.     end
  118.     @data = []
  119.     for i in [email protected]
  120.       skill = $data_skills[@actor.skills[i]]
  121.       if skill != nil
  122.         @data.push(skill)
  123.       end
  124.     end
  125.     @item_max = @data.size
  126.     if @item_max > 0
  127.       self.contents = Bitmap.new(width - 32, row_max * 32)
  128.       for i in 0...@item_max
  129.         draw_item(i)
  130.       end
  131.     end
  132.   end
  133.   def draw_item(index)
  134.     skill = @data[index]
  135.     if @actor.skill_can_use?(skill.id)
  136.       self.contents.font.color = normal_color
  137.     else
  138.       self.contents.font.color = disabled_color
  139.     end
  140.     x = 4
  141.     y = index * 32
  142.     rect = Rect.new(x, y, self.width / @column_max - 32, 32)
  143.     self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
  144.     bitmap = RPG::Cache.icon(skill.icon_name)
  145.     opacity = self.contents.font.color == normal_color ? 255 : 128
  146.     self.contents.blt(x, y + 4, bitmap, Rect.new(0, 0, 24, 24), opacity)
  147.     self.contents.draw_text(x + 28, y, 204, 32, skill.name, 0)
  148.     self.contents.draw_text(x + 232, y, 48, 32, skill.sp_cost.to_s, 2)
  149.   end
  150. end
  151. #==============================================================================
  152. # ● 升级技能窗口
  153. #==============================================================================
  154. class Window_Shizi_Skillup < Window_Selectable
  155.   def initialize
  156.     super(0, 0, 320, 416)
  157.     self.contents = Bitmap.new(width - 32, height - 32)
  158.     self.y = 64
  159.     self.x = 320
  160.     self.index = 0
  161.   end
  162.   def refresh(num,gold,skil)
  163.     if self.contents != nil
  164.       self.contents.dispose
  165.       self.contents = nil
  166.     end
  167.     @data = get_nextskill_id(num)
  168.     @item_max = @data.size
  169.     if @item_max > 0
  170.       self.contents = Bitmap.new(width - 32, row_max * 32)
  171.       for i in 0...@item_max
  172.         draw_item(i,gold,num,skil)
  173.       end
  174.     else
  175.       self.contents = Bitmap.new(width - 32, height - 32)
  176.       self.contents.font.color = disabled_color
  177.       self.contents.draw_text(0, 0, width - 32, 32, "不能再升级", 1)
  178.     end
  179.   end
  180.   def draw_item(index,gold,num,skil)
  181.     skill = $data_skills[@data[index]]
  182.     if gold >= num[index][1] or skil.include?(skill)
  183.       self.contents.font.color = normal_color
  184.     else
  185.       self.contents.font.color = disabled_color
  186.     end
  187.     x = 4
  188.     y = index * 32
  189.     rect = Rect.new(x, y, self.width / @column_max - 32, 32)
  190.     self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
  191.     bitmap = RPG::Cache.icon(skill.icon_name)
  192.     opacity = self.contents.font.color == normal_color ? 255 : 128
  193.     self.contents.blt(x, y + 4, bitmap, Rect.new(0, 0, 24, 24), opacity)
  194.     self.contents.draw_text(x + 28, y, 204, 32, skill.name, 0)
  195.     self.contents.draw_text(x + 232, y, 48, 32, skill.sp_cost.to_s, 2)
  196.   end
  197. end
  198. #==============================================================================
  199. # ● 升级技能场景
  200. #==============================================================================
  201. class Scene_Skillup
  202.   def initialize(actor_index = 0, equip_index = 0)
  203.     @actor_index = actor_index
  204.   end
  205.   def main
  206.     @actor = $game_party.actors[@actor_index]
  207.     @skill_window = Window_Shizi_Skill.new(@actor)
  208.     @skill_window.index = 0
  209.     @skill_window.active = true
  210.     @skillup_window = Window_Shizi_Skillup.new
  211.     @skillup_window.active = false
  212.     @draw_window = Window_Shizi_White.new
  213.     @draw_window.height = 64
  214.     @draw_window.refresh
  215.     Graphics.transition
  216.     loop do
  217.       Graphics.update
  218.       Input.update
  219.       update
  220.       if $scene != self
  221.         break
  222.       end
  223.     end
  224.     Graphics.freeze
  225.     @skill_window.dispose
  226.     @skillup_window.dispose
  227.     @draw_window.dispose
  228.   end
  229.   def update
  230.     if @skillindex == nil and @skill_window.active
  231.       @skillindex = 0
  232.       @skill_id_1 = @skill_window.skill.id
  233.       @skill_id_2 = get_nextskill(@skill_id_1,@actor)
  234.       @skillup_window.refresh(@skill_id_2,$game_party.gold,get_skil)
  235.       text = @actor.name + "  " + $data_system.words.gold + ":"+ $game_party.gold.to_s
  236.       @draw_window.draw(text)
  237.     end
  238.     if @skillupindex == nil and @skillup_window.active
  239.       @skillupindex = 0
  240.       text ="升级需要" + $data_system.words.gold + ":" + @skill_id_2[@skillup_window.index][1].to_s
  241.       @draw_window.draw(text)
  242.     end
  243.     @skill_window.update
  244.     @skillup_window.update
  245.     @draw_window.update
  246.     if @skill_window.active
  247.       update_skill
  248.       return
  249.     end
  250.     if @skillup_window.active
  251.       update_skillup
  252.       return
  253.     end
  254.   end
  255.   def get_skil
  256.     skil = []
  257.     for i in [email protected]
  258.       shizi_skill = $data_skills[@actor.skills[i]]
  259.       if shizi_skill != nil
  260.         skil.push(shizi_skill.id)
  261.       end
  262.     end
  263.     return skil
  264.   end
  265.   def update_skill
  266.     if Input.trigger?(Input::R)
  267.       $game_system.se_play($data_system.cursor_se)
  268.       @actor_index += 1
  269.       @actor_index %= $game_party.actors.size
  270.       $scene = Scene_Skillup.new(@actor_index)
  271.       return
  272.     end
  273.     if Input.trigger?(Input::L)
  274.       $game_system.se_play($data_system.cursor_se)
  275.       @actor_index += $game_party.actors.size - 1
  276.       @actor_index %= $game_party.actors.size
  277.       $scene = Scene_Skillup.new(@actor_index)
  278.       return
  279.     end
  280.     if Input.trigger?(Input::B)
  281.       $game_system.se_play($data_system.cancel_se)
  282.       $scene = Scene_Map.new
  283.       return
  284.     end
  285.     if @skill_window.index != @skillindex
  286.       @skillindex = @skill_window.index
  287.       @skill_id_1 = @skill_window.skill.id
  288.       @skill_id_2 = get_nextskill(@skill_id_1,@actor)
  289.       @skillup_window.refresh(@skill_id_2,@actor.exp,get_skil)
  290.     end
  291.     if Input.trigger?(Input::C)
  292.       if @skill_id_2 != []
  293.         @skill_window.active = false
  294.         @skillup_window.active = true
  295.         $game_system.se_play($data_system.decision_se)
  296.         @skillindex = nil
  297.       else
  298.         $game_system.se_play($data_system.buzzer_se)
  299.       end
  300.     end
  301.   end
  302.   def update_skillup
  303.     if @skillup_window.index != @skillupindex
  304.       @skillupindex = @skillup_window.index
  305.       text ="升级需要" + $data_system.words.gold + ":" + @skill_id_2[@skillup_window.index][1].to_s
  306.       @draw_window.draw(text)
  307.     end
  308.     if Input.trigger?(Input::B)
  309.       $game_system.se_play($data_system.cancel_se)
  310.       @skillup_window.index = 0
  311.       @skillup_window.active = false
  312.       @skill_window.active = true
  313.       @skillupindex = nil
  314.       return
  315.     end
  316.     if Input.trigger?(Input::C)
  317.       if @actor.exp >= @skill_id_2[@skillup_window.index][1] and @actor.skill_learn?(@skill_id_2[@skillup_window.index][0]) == false
  318.         Audio.se_play("Audio/SE/" + $shizi_技能学习音[0],$shizi_技能学习音[1])
  319.         $game_party.gold -= @skill_id_2[@skillup_window.index][1]
  320.         #@actor.exp -= @skill_id_2[@skillup_window.index][1]
  321.         if @skill_id_2[@skillup_window.index][2] == false
  322.           @actor.forget_skill(@skill_window.skill.id)
  323.         end
  324.         @actor.learn_skill(@skill_id_2[@skillup_window.index][0])
  325.         @skill_window.refresh
  326.         @skill_id_1 = @skill_window.skill.id
  327.         @skill_id_2 = get_nextskill(@skill_id_1,@actor)
  328.         @skillup_window.refresh(@skill_id_2,@actor.exp,get_skil)
  329.         @skillup_window.index = 0
  330.         if get_nextskill(@skill_window.skill.id,@actor) == []
  331.           @skillup_window.active = false
  332.           @skillupindex = nil
  333.           @skill_window.active = true
  334.         end
  335.       else
  336.         $game_system.se_play($data_system.buzzer_se)
  337.       end
  338.     end
  339.   end
  340. end
复制代码
这次应该没问题了

http://rpg.blue/thread-175056-1-2.html
PVZ型塔防物一个
http://rpg.blue/thread-155199-1-2.html
RMXP技术讨论区手动认可帖,得到答案请认可
回复

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
50
在线时间
207 小时
注册时间
2008-12-6
帖子
152
7
 楼主| 发表于 2011-7-28 11:09:49 | 只看该作者
本帖最后由 zgm1100 于 2011-7-28 11:27 编辑

哇。。可以调出窗口了。。不过。。还有个小问题:不能学习技能,学习了就自动退出游戏。是美化得到物品提示问题?。。。

320行左右的:$game_party.gold -= @skill_id_2[@skillup_window.index][1]  有问题


zgm1100于2011-7-28 21:08补充以下内容:
$game_party.gain_gold(- @skill_id_2[@skillup_window.index][1])
该这么改。。
测试成功!!哈哈!!
小 · Μ
我的游戏:
http://rpg.blue/thread-208614-1-1.html
回复

使用道具 举报

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

本版积分规则

拿上你的纸笔,建造一个属于你的梦想世界,加入吧。
 注册会员
找回密码

站长信箱:[email protected]|手机版|小黑屋|无图版|Project1游戏制作

GMT+8, 2024-4-20 10:48

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

快速回复 返回顶部 返回列表