Advertisement
Dekita

Untitled

May 16th, 2013
231
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.66 KB | None | 0 0
  1. #===============================================================================
  2. #
  3. # http://dekitarpg.wordpress.com/
  4. #
  5. #===============================================================================
  6. # This Snippet simply creates a method to check if an actor has a certain
  7. # equipment type (weapon / armor) equipped in a certain equip slot
  8. # can also check for specific equipment
  9. #-------------------------------------------------------------------------------
  10. # use :
  11. #------
  12. # de_check(actor_id, equip_slot_id, equip_id, check_type)
  13. # Works as a script call for things like conditional branch checks.
  14. #-------------------------------------------------------------------------------
  15. # examples:
  16. #----------
  17. # de_check(1, 0, 1, 'w_id')
  18. # checks if actor 1's equip slot 0 has weapon id 1 in it.
  19. #
  20. # de_check(5, 1, 1, 'a_id')
  21. # checks if actor 5's equip slot 1 has armor id 1 in it.
  22. #
  23. # de_check(1, 0, 1, 'w_type')
  24. # checks if actor 1's equip slot 0 has weapon type 1 in it.
  25. #
  26. # de_check(10, 3, 2, 'a_type')
  27. # checks if actor 10's equip slot 3 has armor type 2 in it.
  28. #-------------------------------------------------------------------------------
  29. # Do not modify below unless you know what you are doing.
  30. #===============================================================================
  31. class Game_Interpreter
  32. #===============================================================================
  33. #-----------------------------------------------------------------------------
  34. # << Method to check an actors equipment is a specific item or type of item
  35. #-----------------------------------------------------------------------------
  36. def de_check(actor_id=nil,eqp_s_id=nil,equip_id=nil,check_type=nil)
  37. return false unless actor_id != nil
  38. return false unless eqp_s_id != nil
  39. return false unless equip_id != nil
  40. return false unless check_type != nil
  41. a = $game_actors[actor_id]
  42. case check_type.downcase.to_sym
  43. when :w_id
  44. v = a.equips[eqp_s_id] != nil && actor.equips[eqp_s_id].id == equip_id
  45. when :a_id
  46. v = a.equips[eqp_s_id] != nil && actor.equips[eqp_s_id].id == equip_id
  47. when :w_type
  48. v = a.equips[eqp_s_id] != nil && actor.equips[eqp_s_id].wtype_id == equip_id
  49. when :a_type
  50. v = a.equips[eqp_s_id] != nil && actor.equips[eqp_s_id].atype_id == equip_id
  51. else ; v = nil ; end
  52. return v if v != nil
  53. return false
  54. end
  55.  
  56. end
  57. #===============================================================================
  58. # http://dekitarpg.wordpress.com/
  59. #===============================================================================
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement