Advertisement
diamondandplatinum3

Check if an Actor has Nothing Equipped ~ RGSS3

Jun 16th, 2013
332
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Ruby 1.63 KB | None | 0 0
  1. #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  2. #             Check If An Actor has Nothing Equipped
  3. #             Author: DiamondandPlatinum3
  4. #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  5. #  Description:
  6. #
  7. #    This script allows you to check if any actor currently has nothing equipped
  8. #    or if any actor currently has no weapons equipped
  9. #
  10. #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  11. #------------------------------------------------------------------------------
  12. #  Instructions:
  13. #  
  14. #     Use the Following in a Conditional Branch Script Call
  15. #
  16. #       check_if_nothing_equipped( actor_id )
  17. #       check_if_no_weapon_equipped( actor_id )
  18. #
  19. #   Replacing Actor_ID with the actor you want to use this check on.
  20. #   Actor 1 would be Eric and Actor 2 would be Natalie, etc.
  21. #
  22. #     Example ScreenShot Here:
  23. #       http://img4host.net/upload/270438415104a141368c1.png
  24. #
  25. #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  26. class Game_Interpreter
  27.   def check_if_nothing_equipped( actor_id )
  28.     return false unless actor_id.is_a?(Integer)
  29.     actor = $game_actors[actor_id]
  30.     return false unless actor
  31.     for i in 0..(actor.equip_slots.size - 1)
  32.       return false if actor.equips[i]
  33.     end
  34.     return true
  35.   end
  36.   def check_if_no_weapon_equipped( actor_id )
  37.     return false unless actor_id.is_a?(Integer)
  38.     return false if $game_actors[actor_id].equips[0]
  39.     return false if $game_actors[actor_id].equips[1] && $game_actors[actor_id].equips[1].is_a?(RPG::Weapon)
  40.     return true
  41.   end
  42. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement