Advertisement
Fomar0153

Fomar0153 - Additional Equipment Slots 1.0

Feb 19th, 2012
1,274
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Ruby 1.64 KB | None | 0 0
  1. =begin
  2. Additional Equipment Slots
  3. by Fomar0153
  4. Version 1.0
  5. ----------------------
  6. Notes
  7. ----------------------
  8. Requires my Custom Equipment Slots Script
  9. Allows you to add "slots" to equipment
  10. ----------------------
  11. Instructions
  12. ----------------------
  13. Set Extra_SlotType to the type of your slots.
  14. Then notetag your equipment like so:
  15. <slots x>
  16. where x is the number of slots
  17. ----------------------
  18. Known bugs
  19. ----------------------
  20. None
  21. =end
  22. module Extra_Slots
  23.   # Set this type as the type for all additional slots
  24.   Extra_SlotType = 7
  25. end
  26.  
  27. module RPG
  28.   class EquipItem
  29.   #--------------------------------------------------------------------------
  30.   # ● Note tagging for the masses
  31.   #--------------------------------------------------------------------------
  32.     def slots
  33.       if self.note =~ /<slots (.*)>/i
  34.         return $1.to_i
  35.       else
  36.         return 0
  37.       end
  38.     end
  39.   end
  40. end
  41.  
  42. class Game_Actor < Game_Battler
  43.   #--------------------------------------------------------------------------
  44.   # ● Aliases equip_slots
  45.   #--------------------------------------------------------------------------
  46.   alias extra_equip_slots equip_slots
  47.   def equip_slots
  48.     slots = extra_equip_slots
  49.     for equip in @equips
  50.       if (not equip.nil? and not equip.object.nil?) and
  51.         (equip.is_weapon? or equip.is_armor?)
  52.         if equip.object.slots > 0
  53.           for i in 1..equip.object.slots
  54.             slots.push(Extra_Slots::Extra_SlotType)
  55.           end
  56.         end
  57.       end
  58.     end
  59.     for i in 0..slots.size
  60.       @equips[i] = Game_BaseItem.new if @equips[i].nil?
  61.     end
  62.     return slots
  63.   end
  64. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement