Advertisement
Vlue

Restore/Set

Aug 5th, 2012
1,875
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Ruby 2.74 KB | None | 0 0
  1. #Restore After Battle 1.3
  2. #----------#
  3. #Features: Allows you to set designated amounts of hp or mp to restore after
  4. #                  a battle or level for different methods of game style.
  5. #
  6. #Usage: Plug and play and customize
  7. #              
  8. #Customization: Set below, in comments.
  9. #----------#
  10. #-- Script by: V.M of D.T
  11. #
  12. #- Questions or comments can be:
  13. #    given by email: sumptuaryspade@live.ca
  14. #    provided on facebook: http://www.facebook.com/DaimoniousTailsGames
  15. #   All my other scripts and projects can be found here: http://daimonioustails.weebly.com/
  16. #
  17. #--- Free to use in any project, commercial or non-commercial, with credit given
  18. # - - Though a donation's always a nice way to say thank you~ (I also accept actual thank you's)
  19.  
  20. #Restore after level for specific actors only:
  21. RAB_SPECIFIC_ACTORS = false
  22. #Array of actor id's (Array format example: [5,6,78])
  23. RAB_ACTORS = []
  24.  
  25. #Restore after battle for specific actors only:
  26. RAB_SPECIFIC_ACTORS_B = false
  27. #Array of actor id's
  28. RAB_ACTORS_B = []
  29.  
  30. LEVELRESTORE  = true #Full restore Upon leveling
  31. PARTIALRESTORE = false #Restore only the hp/mp gained on a level
  32. BATTLERESTORE = true #Set restore Upon battle end
  33.  
  34. #HPSETTYPE and MPSETTYPE
  35. # Set to 0 for setting of hp/mp to a specific number after battle.
  36. # Set to 1 for setting of hp/mp to a specific percentage after battle.
  37. # Set to 2 for adding to hp/mp by a certain percentage of maxhp/maxmp
  38. HPSETTYPE = 0    
  39. MPSETTYPE = 0
  40.  
  41. #The numbers to use when setting hp/mp after battle!
  42. HPSET    = 100
  43. MPSET    = 100
  44.  
  45. class Game_Actor < Game_Battler
  46.   attr_reader   :actor_id
  47.   alias recover_level_up level_up
  48.   def level_up
  49.     if PARTIALRESTORE
  50.       lhp = self.mhp; lmp = self.mmp
  51.     end
  52.     recover_level_up
  53.     return if RAB_SPECIFIC_ACTORS and !RAB_ACTORS.include?(@actor_id)
  54.     if PARTIALRESTORE
  55.       self.hp += self.mhp - lhp;self.mp += self.mmp - lmp
  56.     end
  57.     self.hp = self.mhp if LEVELRESTORE or self.hp > self.mhp
  58.     self.mp = self.mmp if LEVELRESTORE or self.mp > self.mmp
  59.   end
  60. end
  61.  
  62. class Scene_Battle < Scene_Base  
  63.   alias recover_terminate terminate
  64.   def terminate
  65.     if BATTLERESTORE != true then recover_terminate else
  66.       recover_terminate
  67.       for actor in $game_party.members
  68.         next if RAB_SPECIFIC_ACTORS_B and !RAB_ACTORS.include?(actor.actor_id)
  69.         case HPSETTYPE
  70.         when 0
  71.           actor.hp = HPSET
  72.         when 1
  73.           actor.hp = actor.mhp * HPSET / 100
  74.         when 2
  75.           actor.hp += actor.mhp * HPSET / 100
  76.         end
  77.         case MPSETTYPE
  78.         when 0
  79.           actor.mp = MPSET
  80.         when 1
  81.           actor.mp = actor.mmp * MPSET / 100
  82.         when 2
  83.           actor.mp += actor.mmp * MPSET / 100
  84.         end
  85.       end
  86.     end
  87.   end
  88. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement