Advertisement
Fomar0153

Fomar0153 - Elementalist Class 1.1

Apr 2nd, 2012
291
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Ruby 2.25 KB | None | 0 0
  1. =begin
  2. Elementalist Class
  3. by Fomar0153
  4. Version 1.1
  5. ----------------------
  6. Notes
  7. ----------------------
  8. Requires my unique classes script
  9. Allows you to learn new skills by using skills of the same element.
  10. ----------------------
  11. Instructions
  12. ----------------------
  13. To make an elementalist in the unique classes script set it up like this:
  14.     when 4 # Elementalist
  15.       @data[actor_id] ||= Game_Elementalist.new(actor_id)
  16.  
  17. You will need to edit module Fomar, further instructions
  18. are located there.
  19. ----------------------
  20. Change Log
  21. ----------------------
  22. 1.0 -> 1.1 Fixed a bug that could cause crashing.
  23. ----------------------
  24. Known bugs
  25. ----------------------
  26. None
  27. =end
  28.  
  29. module Fomar
  30.  
  31.   ELEMENTS = []
  32.   # Add/Edit lines like the ones below
  33.   ELEMENTS[3] = {}
  34.   # ELEMENTS[id][uses] = [NEW_SKILL_ID, NEW_SKILL_ID...]
  35.   ELEMENTS[3][50]  = [52,53]
  36.   ELEMENTS[3][100] = [54]
  37.  
  38. end
  39.  
  40. class Game_Elementalist < Game_Actor
  41.   #--------------------------------------------------------------------------
  42.   # ● New Method setup
  43.   #--------------------------------------------------------------------------
  44.   def setup(actor_id)
  45.     super(actor_id)
  46.     @element_uses = []
  47.   end
  48.   #--------------------------------------------------------------------------
  49.   # ● New Method add_element_use
  50.   #--------------------------------------------------------------------------
  51.   def add_element_use(id)
  52.     return if id == -1
  53.     if @element_uses[id].nil?
  54.       @element_uses[id] = 0
  55.     end
  56.     @element_uses[id] += 1
  57.     return if Fomar::ELEMENTS[id].nil?
  58.     unless Fomar::ELEMENTS[id][@element_uses[id]].nil?
  59.       for skill in Fomar::ELEMENTS[id][@element_uses[id]]
  60.         learn_skill(skill)
  61.         $game_message.add(@name + ' learns ' + $data_skills[skill].name)
  62.       end
  63.     end
  64.   end
  65. end
  66.  
  67. class Game_Battler < Game_BattlerBase
  68.   #--------------------------------------------------------------------------
  69.   # ● Aliases item_apply
  70.   #--------------------------------------------------------------------------
  71.   alias uce_item_apply item_apply
  72.   def item_apply(user, item)
  73.     uce_item_apply(user, item)
  74.     if user.is_a?(Game_Elementalist) and item.is_a?(RPG::Skill)
  75.       user.add_element_use(item.damage.element_id)
  76.     end
  77.   end
  78. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement