Advertisement
Fomar0153

Fomar0153 - Custom Equipment Slots 1.2

Feb 13th, 2012
6,249
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Ruby 3.31 KB | None | 0 0
  1. =begin
  2. Custom Equipment Slots Script
  3. by Fomar0153
  4. Version 1.2
  5. ----------------------
  6. Notes
  7. ----------------------
  8. No requirements
  9. Allows you to customise what equipment characters can equip
  10. e.g. add new slots or increase the number of accessories.
  11. ----------------------
  12. Instructions
  13. ----------------------
  14. You will need to edit the script in two locations both are near
  15. the top of the script look for:
  16. Slots[7] = "Spell Tomes"
  17. return [0,0,2,3,4,4,4,7] if dual_wield?
  18. and follow the instructions where they are.
  19. ----------------------
  20. Changle Log
  21. ----------------------
  22. 1.0 -> 1.1 : Fixed a bug that caused a crash when equipping a weapon.
  23. 1.1 -> 1.2 : Fixed a bug with optimisation and remove all
  24.              Increased compatibility
  25. ----------------------
  26. Known bugs
  27. ----------------------
  28. None
  29. =end
  30. #--------------------------------------------------------------------------
  31. # ● New Module Extra_Slots
  32. #--------------------------------------------------------------------------
  33. module Extra_Slots
  34.  
  35.   Slots = []
  36.   # Edit here to add new slot types
  37.   # Slots[armour_type_id] = "name"
  38.   # I know it is named in the database but I don't believe you can access
  39.   # that name through Vocab
  40.   Slots[7] = "Spell Tomes"
  41.  
  42. end
  43.  
  44. class Game_Actor < Game_Battler
  45.   #--------------------------------------------------------------------------
  46.   # ● Rewrites equip_slots
  47.   #--------------------------------------------------------------------------
  48.   # Edit here to change what slots are available to your characters
  49.   # 0 - Weapon
  50.   # 1 - Shield
  51.   # 2 - Head
  52.   # 3 - Body
  53.   # 4 - Accessory
  54.   # 5+ a custom slot
  55.   def equip_slots
  56.     return [0,0,2,3,4,4,4,7] if dual_wield?
  57.     return [0,1,2,3,4,4,4,7]
  58.   end
  59. end
  60.  
  61. class Window_EquipSlot < Window_Selectable
  62.   #--------------------------------------------------------------------------
  63.   # ● Rewrites slot_name
  64.   #--------------------------------------------------------------------------
  65.   def slot_name(index)
  66.     if @actor.equip_slots[index] >= 5
  67.       Extra_Slots::Slots[@actor.equip_slots[index]]
  68.     else
  69.       @actor ? Vocab::etype(@actor.equip_slots[index]) : ""
  70.     end
  71.   end
  72. end
  73.  
  74. class Scene_Equip < Scene_MenuBase
  75.   #--------------------------------------------------------------------------
  76.   # ● Aliases create_slot_window
  77.   #--------------------------------------------------------------------------
  78.   alias custom_slots_create_slot_window create_slot_window
  79.   def create_slot_window
  80.     custom_slots_create_slot_window
  81.     @slot_window.create_contents
  82.     @slot_window.refresh
  83.   end
  84.   #--------------------------------------------------------------------------
  85.   # ● Aliases on_actor_change
  86.   #--------------------------------------------------------------------------
  87.   alias custom_slots_on_actor_change on_actor_change
  88.   def on_actor_change
  89.     custom_slots_on_actor_change
  90.     @slot_window.create_contents
  91.     @slot_window.refresh
  92.   end
  93. end
  94.  
  95. module RPG
  96.   class Armor
  97.   #--------------------------------------------------------------------------
  98.   # ● I wish I'd done this originally.
  99.   #--------------------------------------------------------------------------
  100.     def etype_id
  101.       if Extra_Slots::Slots[self.atype_id] == nil
  102.         return @etype_id
  103.       else
  104.         return self.atype_id
  105.       end
  106.     end
  107.   end
  108. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement