Advertisement
Fomar0153

Fomar0153 - Skill Master

Jan 13th, 2012
353
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Ruby 2.33 KB | None | 0 0
  1. =begin
  2. Skill Master Script
  3. by Fomar0153
  4. Version 1.0
  5. ----------------------
  6. Notes
  7. ----------------------
  8. Requires my unique classes script
  9. Allows you to learn new skills by using your existing skills.
  10. ----------------------
  11. Instructions
  12. ----------------------
  13. You will need to edit module Skill_Uses, further instructions
  14. are located there.
  15. ----------------------
  16. Known bugs
  17. ----------------------
  18. None
  19. =end
  20.  
  21. module Skill_Uses
  22.  
  23.   SKILLS = []
  24.   # Add/Edit lines like the one below
  25.   # SKILLS[ORIGINAL] = [NEW, USES, REPLACE] REPLACE should be true or false
  26.   SKILLS[3] = [4, 50, true]
  27.   # Reads as: When using skill 3 for it's 50th time replace it with skill 4
  28.  
  29. end
  30.  
  31. class Game_SkillMaster < Game_Actor
  32.   #--------------------------------------------------------------------------
  33.   # ● New Method setup
  34.   #--------------------------------------------------------------------------
  35.   def setup(actor_id)
  36.     super(actor_id)
  37.     @skill_uses = []
  38.   end
  39.   #--------------------------------------------------------------------------
  40.   # ● New Method add_skill_use
  41.   #--------------------------------------------------------------------------
  42.   def add_skill_use(id)
  43.     if @skill_uses[id] == nil
  44.       @skill_uses[id] = 0
  45.     end
  46.     @skill_uses[id] += 1
  47.     unless Skill_Uses::SKILLS[id] == nil
  48.       if @skill_uses[id] == Skill_Uses::SKILLS[id][1]
  49.         learn_skill(Skill_Uses::SKILLS[id][0])
  50.         forget_skill(id) if Skill_Uses::SKILLS[id][2]
  51.         SceneManager.scene.add_text(@name + " learns " + $data_skills[Skill_Uses::SKILLS[id][0]].name + ".")
  52.       end
  53.     end
  54.   end
  55. end
  56.  
  57. class Game_Battler < Game_BattlerBase
  58.   #--------------------------------------------------------------------------
  59.   # ● Aliases item_apply
  60.   #--------------------------------------------------------------------------
  61.   alias fomar0004_item_apply item_apply
  62.   def item_apply(user, item)
  63.     if user.is_a?(Game_SkillMaster) and item.is_a?(RPG::Skill)
  64.       user.add_skill_use(item.id)
  65.     end
  66.     fomar0004_item_apply(user, item)
  67.   end
  68. end
  69.  
  70. class Scene_Battle < Scene_Base
  71.   #--------------------------------------------------------------------------
  72.   # ● New method add_text
  73.   #--------------------------------------------------------------------------
  74.   def add_text(text)
  75.     @log_window.add_text(text)
  76.   end
  77. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement