Advertisement
Kakakadafi

Kadafi - Usable Item Disable State

Dec 7th, 2014
263
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Ruby 1.58 KB | None | 0 0
  1. #=============================================================================
  2. # Kadafi - Usable Item Disable State
  3. # Version : 1.0
  4. # Contact : http://www.facebook.com/xandalfi
  5. # =============================================================================
  6. ($imported ||= {})[:Kadafi_UsableItemDisableState] = true
  7. # =============================================================================
  8. # CHANGE LOGS:
  9. # -----------------------------------------------------------------------------
  10. # 2014.12.20 - Finished script
  11. # =============================================================================
  12. =begin
  13.  
  14.   Introduction :
  15.   This script allow you to disable the use of UsableItem (item / skill)
  16.   according to the actor state.
  17.  
  18.   How to Use :
  19.   Notetag at item / skill note box: <disable_state: state_id>
  20.  
  21.   Terms of Use :
  22.   1. Credit me as Kadafi
  23.  
  24. =end
  25. # =============================================================================
  26. # Don't edit below this line unless you know what to do.
  27. # =============================================================================
  28. class RPG::UsableItem < RPG::BaseItem
  29.   def disable_state
  30.     return @disable_state if @disable_state
  31.     note[/<disable_state\s*:\s*(\d+)/i]
  32.     @disable_state = $1.to_i
  33.     return @disable_state
  34.   end
  35. end
  36.  
  37. class Window_BattleItem < Window_ItemList
  38.   def enable?(item)
  39.     !BattleManager.actor.state?(item.disable_state)
  40.   end
  41. end
  42.  
  43. class Window_SkillList < Window_Selectable
  44.   def enable?(item)
  45.     @actor && @actor.usable?(item) && !BattleManager.actor.state?(item.disable_state)
  46.   end
  47. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement