Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #~ =============================================================================
- #~ Title: Equippable Limits Compatibility Add-on with Instance Items
- #~ Author: Meguido (Fatbros)
- #~ Date: May 9, 2014
- #~ -----------------------------------------------------------------------------
- #~ ** Terms of Use
- #~ * Free to use in commercial/non-commercial projects
- #~ * Credits required in your project
- #~ * For Hime' scripts see: http://www.himeworks.com/terms-of-use/
- #~ -----------------------------------------------------------------------------
- #~ ** Description
- #~
- #~ This script adds compatibility between Equippable Limits and Instance Items.
- #~ Both scripts reachable from here: http://www.himeworks.com/
- #~
- #~ -----------------------------------------------------------------------------
- #~ ** Installation
- #~
- #~ Place this script below Equippable Limits script
- #~ =============================================================================
- $imported = {} if $imported.nil?
- $imported["MEG_EquippableLimitsAO"] = true
- unless $imported["TH_EquippableLimits"]
- msgbox("Tsukihime's Equippable Limits not detected. Get it here: http://himeworks.wordpress.com/2013/04/11/equippable-limits/ Exiting now.")
- exit
- end
- unless $imported["TH_InstanceItems"]
- msgbox("Tsukihime's Instance not detected. Get it here: http://www.himeworks.com/2014/01/07/instance-items/ Exiting now.")
- exit
- end
- #==============================================================================
- # ** Game_Actor
- #------------------------------------------------------------------------------
- # This class handles actors. It is used within the Game_Actors class
- # ($game_actors) and is also referenced from the Game_Party class ($game_party).
- #==============================================================================
- class Game_Actor < Game_Battler
- #-----------------------------------------------------------------------------
- # * Rewritten method
- #-----------------------------------------------------------------------------
- def equippable_limit_ok?(item)
- return true if item.nil?
- limit = @is_release_check ? item.equippable_limit + 1 : item.equippable_limit
- case item.equippable_limit_type
- when :id
- if item.is_template?
- return equips.count(item) < limit
- else
- titem = $game_party.get_template(item)
- limit = @is_release_check ? titem.equippable_limit + 1 : titem.equippable_limit
- total_intances = 0
- equips.each do |i|
- next if i.nil?
- temp_i = $game_party.get_template(i)
- next unless temp_i.id == titem.id
- total_intances += 1
- end
- return true if total_intances < limit
- end
- when :type
- if item.is_a?(RPG::Weapon)
- p equips.count {|eq| eq.is_a?(RPG::Weapon) && eq.wtype_id == item.wtype_id}
- return equips.count {|eq| eq.is_a?(RPG::Weapon) && eq.wtype_id == item.wtype_id} < limit
- elsif item.is_a?(RPG::Armor)
- return equips.count {|eq| eq.is_a?(RPG::Armor) && eq.atype_id == item.atype_id } < limit
- end
- end
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement