TheSixth

State Removal Animations

Nov 29th, 2020 (edited)
583
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. =begin
  2.  
  3. - State Removal Animations v1.1
  4. - Made by: Sixth
  5.  
  6. - Description:
  7.  
  8. This short script will let you play animations when states are removed in
  9. battle.
  10.  
  11. - Note-tags:
  12.  
  13. To set up a state removal animation, use this note-tag on your states:
  14.  
  15.   <rem_anim: anim_id>
  16.  
  17. Replace the anim_id with the database ID of the animation you want to play.
  18.  
  19.   Examples:
  20.  
  21.   <rem_anim: 14>   <rem_anim: 146>   <rem_anim: 49>
  22.  
  23. - Important note:
  24.  
  25. Note that this will only show animations on enemies by default.
  26. If you want to show them for actors too, you can simply place a # sign right
  27. before this part in the script:
  28.  
  29.   && target.is_a?(Game_Enemy)
  30.  
  31. You will still need a battle script that enables animations to be played on
  32. actors, and even than, this script may or may not function with the battle
  33. script you use for that.
  34.  
  35. Also, since this script overwrites a method in the battle log, chances are,
  36. it won't work well with custom battle log scripts without a patch.
  37.  
  38. Added compatibility with Raizen's Akea Advanced Battle Pop-up script (v1.1+).
  39.  
  40. - Installation:
  41.  
  42. Place this script between Materials and Main!
  43. If you use a batttle log script, try to place this script below that one.
  44. If it still won't work, you will probably need a patch for these to work
  45. together.
  46.  
  47. If you use Raizen's Akea Advanced Battle Pop-up script, place this script below
  48. that script!
  49.  
  50. =end
  51.  
  52. class RPG::State < RPG::BaseItem
  53.  
  54.   attr_accessor :rem_anim
  55.  
  56.   def rem_anim
  57.     init_rem_anim if @rem_anim.nil?
  58.     return @rem_anim
  59.   end
  60.  
  61.   def init_rem_anim
  62.     @rem_anim = @note =~ /<rem_anim:(?:\s*)(\d+)>/i ? $1.to_i : 0
  63.   end
  64.  
  65. end
  66.  
  67. class Window_BattleLog < Window_Selectable
  68.  
  69.   def display_removed_states(target) # Overwrite!
  70.     target.result.removed_state_objects.each do |state|
  71.       st_anim = false
  72.       sh_log = true
  73.       if state.rem_anim > 0 && target.is_a?(Game_Enemy)
  74.         target.animation_id = state.rem_anim
  75.         st_anim = true
  76.       end
  77.       if $included && $included[:akea_battlepopup] # Akea Popup compatibility!
  78.         unless Akea_BattlePop::States_No_Pop.include?(state.name)
  79.           SceneManager.scene.get_abp_type(target, nil, Akea_BattlePop::Recover_Name)
  80.           @method_wait.call(Akea_BattlePop::Time_Pop)
  81.           @get_all_pop_wait = (Akea_BattlePop::BattlePop[6][:movement].size - Akea_BattlePop::Time_Pop)
  82.         end
  83.         sh_log = Akea_BattlePop::Show_log
  84.       end
  85.       if sh_log && !state.message4.empty?
  86.         replace_text(target.name + state.message4)
  87.         wait
  88.       end
  89.       SceneManager.scene.wait_for_animation if st_anim
  90.     end
  91.   end
  92.  
  93. end
  94. # End of script!
RAW Paste Data