Advertisement
TheSixth

Tool Variable Usage for Falcao's ABS by Sixth

Jan 5th, 2016
346
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Ruby 4.36 KB | None | 0 0
  1. #===============================================================================
  2. # * [ACE] Tool Variable Usage for Falcao's Pearl ABS Liquid v3
  3. #===============================================================================
  4. # * Made by: Sixth (www.rpgmakervxace.net, www.forums.rpgmakerweb.com)
  5. # * Version: 1.0
  6. # * Updated: 06/01/2016
  7. # * Requires: Falcao's Pearl ABS Liquid v3
  8. #-------------------------------------------------------------------------------
  9. # * < Change Log >
  10. #-------------------------------------------------------------------------------
  11. # * Version 1.0 (06/01/2016)
  12. #   - Initial release.
  13. #-------------------------------------------------------------------------------
  14. # * < Description >
  15. #-------------------------------------------------------------------------------
  16. # * This script lets you make tools which "use" game variables instead of
  17. #   MP, TP or other items.
  18. #-------------------------------------------------------------------------------
  19. # * < Note-tags >
  20. #-------------------------------------------------------------------------------
  21. # * To assign a variable requirement for a tool, use this note-tag:
  22. #  
  23. #     <var req: variable_id>
  24. #
  25. #   Replace 'variable_id' with the ID of the variable the tool will "use".
  26. #   A tool with this note-tag will display the amount of the assigned variable
  27. #   currently has on the toolbar.
  28. #   The tool will automatically decrease the value of the assigned variable
  29. #   by 1 upon usage!
  30. #-------------------------------------------------------------------------------
  31. # * < Installation >
  32. #-------------------------------------------------------------------------------
  33. # * Place this scipt below the last script from Falcao's Pearl ABS Liquid v3
  34. #   script series but above Main!
  35. # * If you are using my Toolbar Addon for Falcao's ABS script, you must put
  36. #   this one below that one!
  37. #-------------------------------------------------------------------------------
  38. # * < Compatibility Info >
  39. #-------------------------------------------------------------------------------
  40. # * No known incompatibilities.
  41. #-------------------------------------------------------------------------------
  42. # * < Known Issues >
  43. #-------------------------------------------------------------------------------
  44. # * No known issues.
  45. #-------------------------------------------------------------------------------
  46. # * < Terms of Use >
  47. #-------------------------------------------------------------------------------
  48. # * Free to use for whatever purposes you want.
  49. # * Credit me (Sixth) in your game, pretty please! :P
  50. # * Posting modified versions of this script is allowed as long as you notice me
  51. #   about it with a link to it!
  52. #===============================================================================
  53. $imported = {} if $imported.nil?
  54. $imported["SixthABSToolVariables"] = true
  55. #===============================================================================
  56. # No settings! O.o
  57. #===============================================================================
  58.  
  59. class RPG::BaseItem
  60.  
  61.   attr_accessor :var_req
  62.  
  63.   def var_req
  64.     init_var_req if @var_req.nil?
  65.     return @var_req
  66.   end
  67.  
  68.   def init_var_req
  69.     @var_req = 0
  70.     @var_req = $1.to_i if @note =~ /<var req: (\d+)>/i
  71.   end
  72.  
  73. end
  74.  
  75. class Game_CharacterBase
  76.  
  77.   alias set_var_req7753 load_abs_tool
  78.   def load_abs_tool(item)
  79.     set_var_req7753(item)
  80.     if battler.is_a?(Game_Actor) && item
  81.       if item.var_req != 0 && $game_variables[item.var_req] > 0
  82.         $game_variables[item.var_req] -= 1
  83.       end
  84.     end
  85.   end
  86.    
  87. end
  88.  
  89. class Game_BattlerBase
  90.  
  91.   alias add_var_reqs7753 usable?
  92.   def usable?(item)
  93.     if item && item.var_req != 0
  94.       return false if $game_variables[item.var_req] <= 0
  95.     end
  96.     add_var_reqs7753(item)    
  97.   end
  98.  
  99. end
  100.  
  101. class Sprite_PearlTool < Sprite
  102.    
  103.   alias add_var_check8873 ammo_ready?
  104.   def ammo_ready?(item)
  105.     if item && item.var_req != 0
  106.       return true
  107.     end
  108.     add_var_check8873(item)
  109.   end
  110.  
  111.   alias add_var_display8832 itemcost
  112.   def itemcost(item)
  113.     if item && item.var_req != 0
  114.       return $game_variables[item.var_req]
  115.     end
  116.     add_var_display8832(item)
  117.   end
  118.  
  119. end
  120. #==============================================================================
  121. # !!END OF SCRIPT - OHH, NOES!!
  122. #==============================================================================
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement