Advertisement
Fomar0153

Fomar0153 - Skills Replace Skills 1.0

Mar 6th, 2012
1,697
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Ruby 1.11 KB | None | 0 0
  1. =begin
  2. Skills Replace Skills
  3. by Fomar0153
  4. Version 1.0
  5. ----------------------
  6. Notes
  7. ----------------------
  8. This script allows you to have a skill replace another skill
  9. ----------------------
  10. Instructions
  11. ----------------------
  12. Notetag the skills like so:
  13. <replaces x>
  14. and when that skill is learned it will replace x and stop it
  15. from being re-learnt.
  16. ----------------------
  17. Known bugs
  18. ----------------------
  19. None
  20. =end
  21. class Game_Actor < Game_Battler
  22.  
  23.   attr_reader   :skills_replaced
  24.  
  25.   alias fsr_setup setup
  26.   def setup(actor_id)
  27.     @skills_replaced = []
  28.     fsr_setup(actor_id)
  29.   end
  30.  
  31.   alias fsr_learn_skill learn_skill
  32.   def learn_skill(skill_id)
  33.     unless skill_learn?($data_skills[skill_id])
  34.       fsr_learn_skill(skill_id)
  35.       if $data_skills[skill_id].note =~ /<replaces (.*)>/i
  36.         forget_skill($1.to_i)
  37.         @skills_replaced.push($1.to_i)
  38.       end
  39.     end
  40.   end
  41.  
  42.   alias fsr_skill_learn? skill_learn?
  43.   def skill_learn?(skill)
  44.     return true if fsr_skill_learn?(skill)
  45.     return  (skill.is_a?(RPG::Skill) && @skills_replaced.include?(skill.id))
  46.   end
  47.  
  48. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement