Advertisement
Guest User

Untitled

a guest
Apr 22nd, 2011
1,166
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Ruby 2.75 KB | None | 0 0
  1. #===============================================================================
  2. #
  3. # Shanghai Simple Script - Equipment Skills
  4. # Last Date Updated: 2010.05.25
  5. # Level: Normal
  6. #
  7. # Equip a weapon or armor to have a skill appear in your actors' skill lists.
  8. # Take off the equipment and it's gone. Simple as that.
  9. #===============================================================================
  10. # Instructions
  11. # -----------------------------------------------------------------------------
  12. # To install this script, open up your script editor and copy/paste this script
  13. # to an open slot below ▼ Materials but above ▼ Main. Remember to save.
  14. #
  15. # <equipskill: x>
  16. # <equipskill: x, x, x>
  17. # This gives the skill x for equipping the piece of equipment. Works only on
  18. # equipment noteboxes obviously.
  19. #===============================================================================
  20.  
  21. $imported = {} if $imported == nil
  22. $imported["EquipmentSkills"] = true
  23.  
  24. #==============================================================================
  25. # RPG::BaseItem
  26. #==============================================================================
  27.  
  28. class RPG::BaseItem
  29.   #--------------------------------------------------------------------------
  30.   # skills
  31.   #--------------------------------------------------------------------------
  32.   def skills
  33.     return @equipment_skills if @equipment_skills != nil
  34.     @equipment_skills = []
  35.     self.note.split(/[\r\n]+/).each { |line|
  36.       case line
  37.       when /<(?:EQUIPMENTSKILL|equipskill):[ ](\d+(?:\s*,\s*\d+)*)>/i
  38.         $1.scan(/\d+/).each { |num|
  39.         @equipment_skills.push($data_skills[num.to_i]) if num.to_i > 0 }
  40.       end
  41.     }
  42.     return @equipment_skills
  43.   end
  44. end
  45.  
  46. #==============================================================================
  47. # Game Actor
  48. #==============================================================================
  49.  
  50. class Game_Actor < Game_Battler
  51.   #--------------------------------------------------------------------------
  52.   # skills
  53.   #--------------------------------------------------------------------------
  54.   alias skills_sss_equipment_skills skills unless $@
  55.   def skills
  56.     list = skills_sss_equipment_skills
  57.     for equip in equips.compact
  58.       next if equip == nil
  59.       list += equip.skills
  60.     end
  61.     return list.uniq
  62.   end
  63.  
  64.   #--------------------------------------------------------------------------
  65.   # skill_can_use?
  66.   #--------------------------------------------------------------------------
  67.   def skill_can_use?(skill)
  68.     return super(skill)
  69.   end
  70. end
  71.  
  72. #===============================================================================
  73. #
  74. # END OF FILE
  75. #
  76. #===============================================================================
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement