Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #===============================================================================
- #
- # http://dekitarpg.wordpress.com/
- #
- #===============================================================================
- # This Snippet simply creates a method to check if an actor has a certain
- # equipment type (weapon / armor) equipped in a certain equip slot
- # can also check for specific equipment
- #-------------------------------------------------------------------------------
- # use :
- #------
- # de_check(actor_id, equip_slot_id, equip_id, check_type)
- # Works as a script call for things like conditional branch checks.
- #-------------------------------------------------------------------------------
- # examples:
- #----------
- # de_check(1, 0, 1, 'w_id')
- # checks if actor 1's equip slot 0 has weapon id 1 in it.
- #
- # de_check(5, 1, 1, 'a_id')
- # checks if actor 5's equip slot 1 has armor id 1 in it.
- #
- # de_check(1, 0, 1, 'w_type')
- # checks if actor 1's equip slot 0 has weapon type 1 in it.
- #
- # de_check(10, 3, 2, 'a_type')
- # checks if actor 10's equip slot 3 has armor type 2 in it.
- #-------------------------------------------------------------------------------
- # Do not modify below unless you know what you are doing.
- #===============================================================================
- class Game_Interpreter
- #===============================================================================
- #-----------------------------------------------------------------------------
- # << Method to check an actors equipment is a specific item or type of item
- #-----------------------------------------------------------------------------
- def de_check(actor_id=nil,eqp_s_id=nil,equip_id=nil,check_type=nil)
- return false unless actor_id != nil
- return false unless eqp_s_id != nil
- return false unless equip_id != nil
- return false unless check_type != nil
- a = $game_actors[actor_id]
- case check_type.downcase.to_sym
- when :w_id
- v = a.equips[eqp_s_id] != nil && actor.equips[eqp_s_id].id == equip_id
- when :a_id
- v = a.equips[eqp_s_id] != nil && actor.equips[eqp_s_id].id == equip_id
- when :w_type
- v = a.equips[eqp_s_id] != nil && actor.equips[eqp_s_id].wtype_id == equip_id
- when :a_type
- v = a.equips[eqp_s_id] != nil && actor.equips[eqp_s_id].atype_id == equip_id
- else ; v = nil ; end
- return v if v != nil
- return false
- end
- end
- #===============================================================================
- # http://dekitarpg.wordpress.com/
- #===============================================================================
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement