daily pastebin goal
28%
SHARE
TWEET

Equippable Limits Compatibility Add-on with Instance Items

Meguido May 21st, 2014 206 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #~ =============================================================================
  2. #~  Title: Equippable Limits Compatibility Add-on with Instance Items
  3. #~  Author: Meguido (Fatbros)
  4. #~  Date: May 9, 2014
  5. #~ -----------------------------------------------------------------------------  
  6. #~  ** Terms of Use
  7. #~  * Free to use in commercial/non-commercial projects
  8. #~  * Credits required in your project
  9. #~  * For Hime' scripts see: http://www.himeworks.com/terms-of-use/
  10. #~ -----------------------------------------------------------------------------
  11. #~  ** Description
  12. #~  
  13. #~  This script adds compatibility between Equippable Limits and Instance Items.
  14. #~  Both scripts reachable from here: http://www.himeworks.com/
  15. #~  
  16. #~ -----------------------------------------------------------------------------
  17. #~  ** Installation
  18. #~  
  19. #~  Place this script below Equippable Limits script
  20. #~ =============================================================================
  21.  
  22. $imported = {} if $imported.nil?
  23. $imported["MEG_EquippableLimitsAO"] = true
  24.  
  25. unless $imported["TH_EquippableLimits"]
  26.   msgbox("Tsukihime's Equippable Limits not detected. Get it here: http://himeworks.wordpress.com/2013/04/11/equippable-limits/   Exiting now.")
  27.   exit
  28. end
  29. unless $imported["TH_InstanceItems"]
  30.   msgbox("Tsukihime's Instance not detected. Get it here: http://www.himeworks.com/2014/01/07/instance-items/   Exiting now.")
  31.   exit
  32. end
  33.  
  34. #==============================================================================
  35. # ** Game_Actor
  36. #------------------------------------------------------------------------------
  37. #  This class handles actors. It is used within the Game_Actors class
  38. # ($game_actors) and is also referenced from the Game_Party class ($game_party).
  39. #==============================================================================
  40.  
  41. class Game_Actor < Game_Battler
  42.  
  43.   #-----------------------------------------------------------------------------
  44.   # * Rewritten method
  45.   #-----------------------------------------------------------------------------
  46.   def equippable_limit_ok?(item)
  47.     return true if item.nil?
  48.     limit = @is_release_check ? item.equippable_limit + 1 : item.equippable_limit
  49.     case item.equippable_limit_type
  50.     when :id
  51.       if item.is_template?
  52.         return equips.count(item) < limit
  53.       else
  54.         titem = $game_party.get_template(item)
  55.         limit = @is_release_check ? titem.equippable_limit + 1 : titem.equippable_limit
  56.         total_intances = 0
  57.         equips.each do |i|
  58.           next if i.nil?
  59.           temp_i = $game_party.get_template(i)
  60.           next unless temp_i.id == titem.id
  61.           total_intances += 1
  62.         end
  63.         return true if total_intances < limit
  64.       end
  65.     when :type
  66.       if item.is_a?(RPG::Weapon)
  67.         p equips.count {|eq| eq.is_a?(RPG::Weapon) && eq.wtype_id == item.wtype_id}
  68.         return equips.count {|eq| eq.is_a?(RPG::Weapon) && eq.wtype_id == item.wtype_id} < limit
  69.       elsif item.is_a?(RPG::Armor)
  70.         return equips.count {|eq| eq.is_a?(RPG::Armor) && eq.atype_id == item.atype_id } < limit
  71.       end
  72.     end
  73.   end
  74. end
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top