Advertisement
kurashi

Skills Choice On Every Third Level[RGSS3]

Feb 12th, 2016
499
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Ruby 2.26 KB | None | 0 0
  1. =begin
  2. Skills Choice On Every Third Level v 1.0
  3. Created by Kio Kurashi
  4. Version History:
  5. 1.0 = Initial Version
  6.  
  7. Free for commercial and personal use. Credit is not required, but appreciated.
  8.  
  9. Known bugs: None.
  10. =end
  11.  
  12. module Class_Skillsets
  13.   CLASS = []#<-- Do not touch.
  14. =begin
  15.   Setup is CLASS[Class Id] = ['level0','level1','level2','level3',
  16.                             [First skill ID,Second skill ID],'level5',
  17.                                 'level6']
  18.   Unfortunatly you must have the space for each level though the
  19.   ones that don't get skills can have whatever you want in them as
  20.   they will not be read for the script. Still needs to be valid syntax though.
  21.   Example:
  22.         CLASS[1] = ['level0','level1','level2','level3',
  23.                       [30,5],'level5','level6']
  24.                      
  25.   Add in yours below.
  26. =end  
  27.  
  28.  
  29.  
  30. end
  31.  
  32.  
  33.  
  34. ####                              ####
  35. ### DO NOT EDIT BEYOND THIS POINT. ###
  36. ####                              ####
  37. class Game_Actor
  38. include Class_Skillsets
  39.   def level_up
  40.     @level += 1
  41. #~     $game_message.add("#{name} Leveled Up!!")
  42.     if (@level-1) % 3 == 0
  43.       $game_message.add("Pick a skill for #{name} to learn.")
  44.       params = []
  45.       choices = []
  46.       classidis = @class_id
  47.       levelis = @level
  48.       p CLASS[classidis][levelis]
  49.       skills = CLASS[classidis][levelis]
  50.       choices.push("#{$data_skills[skills[0]].name}")
  51.       choices.push("#{$data_skills[skills[1]].name}")
  52.       params.push(choices)
  53.       params.push(0)
  54.       setup_choices(params)
  55.       Fiber.yield while $game_message.choice? if SceneManager.scene.is_a?(Scene_Map)
  56.       SceneManager.scene.wait_for_message while $game_message.choice? if SceneManager.scene.is_a?(Scene_Battle)
  57.       choice_result = $skill_choice_result
  58.       case choice_result
  59.         when 1
  60.           learn_skill(skills[0])
  61.         when 2
  62.           learn_skill(skills[1])
  63.         end
  64.         $skill_choice_result = 0
  65.     end
  66.    
  67.     refresh
  68.   end
  69.  
  70.   def setup_choices(params)
  71.     params[0].each {|s| $game_message.choices.push(s) }
  72.     $game_message.choice_cancel_type = params[1]
  73.     $game_message.choice_proc = Proc.new {|n|
  74.     begin; @branch[@indent] = n;rescue;end
  75.     $skill_choice_result = n + 1
  76.     }
  77.   end
  78. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement