bgillisp

Add state when TP Max

Aug 17th, 2014
192
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. # Tp Add State Script, version 1.0
  2. # Created by bgillisp, 8/17/2014
  3.  
  4. # Add a state when a specific TP value is reached on an actor.
  5. # By default, this will add a state when a TP value of 100 is
  6. # reached, then will clear TP to 0.
  7.  
  8. #TO USE:
  9. # Add this script in materials, but below main.
  10. # By default, it will add state 14 when TP hits 100 unless
  11. # edited below. See Editable region for how to change this.
  12. #
  13. # When setting up your state, it is important to set
  14. # ***in the state*** when the state is to be removed
  15. # If this is not done, the state may remain even after the
  16. # battle has ended.
  17.  
  18. #Terms of Use:
  19. # Free for use in commerical and non-commerical projects, with
  20. # credit given.
  21.  
  22. #-------------------------------------------------------------------------
  23. #Editable Region
  24.  
  25. module BGTpmax_Add_State
  26. #Constant for when to add the state. Lower if you wish the state to be
  27. #added sooner.
  28. TP_MAX = 100
  29.  
  30. #Number of state to add when the value TP_MAX is hit. Change this
  31. #nmber to whatever state you want added when TP_MAX is hit.
  32. State_to_add = 14
  33.  
  34. #Set to true if you wish TP to reset to 0 when state is added.
  35. #Set to false to leave the TP alone when the state is added.
  36. Reset_to_zero = true
  37.  
  38. end
  39.  
  40. #End of Editable Region
  41. #--------------------------------------------------------------------------
  42.  
  43.  
  44. #Do not edit anything below here unless you know what you are doing.
  45. #Failure to ahead to this warning may result in unpredictable behavior in
  46. #your game. Consider yourself warned
  47. #__________________________________________________________________________
  48.  
  49. class Game_Battler < Game_BattlerBase
  50.  
  51. alias bgtpmax_add_state_refresh refresh
  52. def refresh
  53.  
  54. #Call aliased method
  55. bgtpmax_add_state_refresh
  56. if(self.tp >= BGTpmax_Add_State::TP_MAX)
  57. add_state(BGTpmax_Add_State::State_to_add)
  58.  
  59. #Clear TP if flag enabled for that
  60. if(BGTpmax_Add_State::Reset_to_zero == true)
  61. self.tp = 0
  62. end
  63. end
  64. end
  65.  
  66. end #End of Game_Battler class
RAW Paste Data