Advertisement
Fomar0153

Fomar0153 - Specific Actor Items 1.0

Mar 14th, 2012
497
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Ruby 1.19 KB | None | 0 0
  1. =begin
  2. Specific Actor Items
  3. by Fomar0153
  4. Version 1.0
  5. ----------------------
  6. Notes
  7. ----------------------
  8. Let's restore a lost feature. This script allows you to make some
  9. items only affect certain characters. My use for this was skill tomes.
  10. ----------------------
  11. Instructions
  12. ----------------------
  13. Notetag the actor specific items e.g.
  14. <actoritem 1>
  15. just for Eric
  16. <actoritem 1,2>
  17. for Eric and Natalie
  18. etc
  19. Please be aware that the items can be used on the wrong actors but they
  20. will have no affect.
  21. ----------------------
  22. Known bugs
  23. ----------------------
  24. None
  25. =end
  26. class RPG::Item < RPG::UsableItem
  27.  
  28.   def for_specific_actors?
  29.     if @note =~ /<actoritem (.*)>/i
  30.       return true
  31.     else
  32.       return false
  33.     end
  34.   end
  35.  
  36.   def for_actor(id)
  37.     if @note =~ /<actoritem (.*)>/i
  38.       actor_ids = $1.split(",")
  39.       return actor_ids.include?(id.to_s)
  40.     end
  41.     return 0
  42.   end
  43.  
  44. end
  45.  
  46. class Game_Battler < Game_BattlerBase
  47.  
  48.   alias aoi_item_test item_test
  49.   def item_test(user, item)
  50.     if item.is_a?(RPG::Item) && item.for_specific_actors?
  51.       return false unless item.for_actor(self.id)
  52.     end
  53.     return aoi_item_test(user, item)
  54.   end
  55.  
  56. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement