Advertisement
Fomar0153

Fomar0153 - Secondary Classes 1.0

Mar 8th, 2012
2,004
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. Secondary Classes
  3. by Fomar0153
  4. Version 1.0
  5. ----------------------
  6. Notes
  7. ----------------------
  8. This script allows you to give a character a second class they can learn
  9. some or all of that classes skills and optionally inherit all of the
  10. secondary classes traits and a percentage of it's paramaters.
  11. ----------------------
  12. Instructions
  13. ----------------------
  14. Setup the two variables in the module to your liking and any for any skill
  15. that you wish to be primary only notetag the skill learning box (the one
  16. with level, skill and notes) with <primary>
  17. To change an actor's subclass call
  18. $game_actors[x].change_sec_class(class_id)
  19. To define a starting sub class notetag the actor like so:
  20. <secclass x>
  21. ----------------------
  22. Known bugs
  23. ----------------------
  24. None
  25. =end
  26. module Fomar
  27.  
  28.   # Have all the features/traits of the secondary class
  29.   SECONDARY_CLASSES_ADD_FEATURES = false
  30.   # Percentage of secondary class's params to be added
  31.   SECONDARY_CLASSES_PARAMS = 10
  32.  
  33. end
  34.  
  35. class Game_Actor < Game_Battler
  36.  
  37.   attr_accessor :sec_class_id
  38.  
  39.   alias sc_setup setup
  40.   def setup(actor_id)
  41.     @sec_class_id = 0
  42.     if $data_actors[actor_id].note =~ /<secclass (.*)>/i
  43.       @sec_class_id = $1.to_i
  44.     end
  45.     sc_setup(actor_id)
  46.   end
  47.  
  48.   alias sc_init_skills init_skills
  49.   def init_skills
  50.     sc_init_skills
  51.     return if sec_class_id == 0
  52.     self.sec_class.learnings.each do |learning|
  53.       learn_skill(learning.skill_id) if learning.level <= @level and
  54.         not $data_skills[learning.skill_id].note.include?("<primary>")
  55.     end
  56.   end
  57.  
  58.   def sec_class
  59.     $data_classes[@sec_class_id]
  60.   end
  61.  
  62.   alias sc_feature_objects feature_objects
  63.   def feature_objects
  64.     return sc_feature_objects if @sec_class_id == 0
  65.     if Fomar::SECONDARY_CLASSES_ADD_FEATURES
  66.       return sc_feature_objects + [self.sec_class]
  67.     else
  68.       return sc_feature_objects
  69.     end
  70.   end
  71.  
  72.   def change_sec_class(class_id)
  73.     @sec_class_id = class_id
  74.     refresh
  75.   end
  76.  
  77.   alias sc_param_base param_base
  78.   def param_base(param_id)
  79.     if @sec_class_id == 0
  80.       return sc_param_base(param_id)
  81.     else
  82.       return sc_param_base(param_id) + ((Fomar::SECONDARY_CLASSES_PARAMS * self.sec_class.params[param_id, @level])/100)
  83.     end
  84.   end
  85. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement