estriole

EST - EFFECT SCENE CORE

Mar 28th, 2013
432
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Ruby 7.62 KB | None | 0 0
  1. =begin
  2.  
  3. EST - SCENE CORE
  4. v.2.1
  5.  
  6. credit
  7. Estriole
  8. Yanfly
  9.  
  10. Version History
  11. v.2.1 - 2013.03.30  - add compatibility patch for yanfly command party script
  12.                       with victor animated battle. so we can change party
  13.                       in battle using victor animated battle (before it will crash
  14. v.2.0 - forget date - rewrite the script
  15. v.1.0 - forget date - initial script
  16.  
  17. Introduction
  18. this is FULL rewrite of my effect scene core script.
  19. i use some of yanfly command equip script to recreate this script.
  20.  
  21. this script is tend to work for supporting switching scene for
  22. TSUKIHIME EFFECT MANAGER.
  23.  
  24. now we can make skill that have effect that call scene when the skill EXECUTED.
  25. the different with yanfly command equip. the scene is called when the command used.
  26. waste no turn at all. while this script called the scene when the skill EXECUTED.
  27. so it wasting that Actor turn. (also no way to abuse it by choosing command, canceling it)
  28.  
  29. and the difference with my old version... in old version skill need to be set
  30. to executed last (by modifying speed). since if it executed before another skill.
  31. all other skill inputted AFTER it will erased. (since i restarted the battle).
  32.  
  33. in this version the battle not restarted. but resumed from where it left of. so all
  34. action will work. it's only pausing the scene. run another scene. then resume the scene again.
  35.  
  36.  
  37. Also come with some compatibility patches
  38.  
  39. Compatibility
  40. built in compatibility patches for:
  41. 1) yanfly ace battle engine popup
  42. 2) moghunter popup script
  43. 3) yami combo counter script
  44. 4) yanfly enemy hp bar script
  45. 5) yanfly party system + yanfly command party (put this script below command party)
  46.  
  47. if you use another script that show sprites / window in battle it might need
  48. compatibility patch. since i don't know what script you used. i will explain
  49. how to make compatibility patch for this instead.
  50. basically:
  51. a) make compatibility patches by aliasing this method:
  52. class: Scene_Battle, method: thing_to_hide
  53. put compatibility patch there to hide that sprites/window
  54.  
  55. b) make compatibility patches by aliasing this method:
  56. class: Scene_Battle, method: thing_to_show_again
  57. put compatibility patch there to show that sprites/window IF needed
  58. (for example window battle log need to be shown again but popup have auto shown later).
  59.  
  60. so far tested work with Default Battle, Ace battle engine, Victor Animated Battle.
  61.  
  62. How to use
  63. first of all you need to understand how to use TSUKIHIME effect manager.
  64. put this code inside the 'correct' effect method:
  65.  
  66.  SceneManager.scene.call_scene(SceneName, effect_callback_symbol, effect)
  67.  
  68.  #the only required is SceneName. you could not pass another two if you use
  69.  that function without effect callback function from tsukihime effect manager
  70.  
  71.  for easier explaining i'll use example instead.. we see golden touch script.
  72.  before code:
  73.   class Game_Battler < Game_BattlerBase
  74.     def item_effect_golden_touch_global(user,target,effect)
  75.       SceneManager.call(Scene_GoldenTouch)
  76.       SceneManager.scene.set_effect_callback(:effect_golden_touch, effect)
  77.     end
  78.   end
  79.  change it to to make it works using scene core:
  80.   class Game_Battler < Game_BattlerBase
  81.     def item_effect_golden_touch_global(user,target,effect)
  82.       SceneManager.scene.call_scene(Scene_GoldenTouch, :effect_golden_touch, effect)
  83.     end
  84.   end
  85.  
  86. =end
  87.  
  88. # yanfly force recall code
  89. module SceneManager  
  90.   #--------------------------------------------------------------------------
  91.   # new method: self.force_recall
  92.   #--------------------------------------------------------------------------
  93.   def self.force_recall(scene_class)
  94.     @scene = scene_class
  95.   end
  96.  
  97. end # SceneManager
  98.  
  99. class Scene_Battle < Scene_Base
  100.   def call_scene(scene_class, eff_callback = nil, effect = nil)
  101.     saved_scene = self
  102.     Graphics.freeze
  103.     thing_to_hide
  104.     SceneManager.snapshot_for_background
  105.     SceneManager.call(scene_class)
  106.     SceneManager.scene.set_effect_callback(eff_callback.to_sym, effect) if eff_callback
  107.     SceneManager.scene.main
  108.     SceneManager.force_recall(saved_scene) #yanfly force recall technique
  109.     thing_to_show_again
  110.     @status_window.refresh
  111.     perform_transition        
  112.   end
  113.  
  114.   #you could alias this method if you have something to make compatible with
  115.   def thing_to_hide
  116.     @log_window.hide_background_box #hide log window black box background
  117.     @log_window.hide #hide log window
  118.     hide_extra_gauges if $imported["YEA-BattleEngine"] #hide extra gauges
  119.     @info_viewport.visible = false #hide info viewport
  120.     @spriteset.hide_enemy_hp_gauges if $imported["YEA-EnemyHPBars"] == true #hide hp bar
  121.     @spriteset.hide_popup if $imported["YEA-BattleEngine"] == true && YEA::BATTLE::ENABLE_POPUPS #hide yanfly popup
  122.     @spriteset.dispose_damage_sprites if $mog_rgss3_damage_pop == true #hide mog damage pop up
  123.     if $imported["YSE-PartyComboCounter"] == true #hide yami combo counter
  124.       @sprite_combo_count.opacity = 0
  125.       @sprite_combo_damage.opacity = 0
  126.       @sprite_combo_congrat.opacity = 0
  127.     end
  128.   end
  129.  
  130.   #you could alias this method if you have something to make compatible with
  131.   def thing_to_show_again
  132.     @log_window.show_background_box #show log window black box background
  133.     @log_window.show #show log window
  134.     show_extra_gauges if $imported["YEA-BattleEngine"] #show extra gauge
  135.     @info_viewport.visible = true #show info viewport
  136.   end
  137.  
  138.   #compatibility patch for yanfly party system - command party
  139.   def command_party
  140.     Graphics.freeze
  141.     @info_viewport.visible = false
  142.     hide_extra_gauges if $imported["YEA-BattleEngine"]
  143.     SceneManager.snapshot_for_background
  144.     previous_party = $game_party.battle_members.clone
  145.     index = @party_command_window.index
  146.     oy = @party_command_window.oy
  147.     #---
  148.     SceneManager.call(Scene_Party)
  149.     SceneManager.scene.main
  150.     victor_battle_sprite_patch
  151.     SceneManager.force_recall(self)
  152.     #---
  153.     show_extra_gauges if $imported["YEA-BattleEngine"]
  154.     if previous_party != $game_party.battle_members
  155.       $game_party.make_actions
  156.       $game_party.set_party_cooldown
  157.     end
  158.     @info_viewport.visible = true
  159.     @status_window.refresh
  160.     @party_command_window.setup
  161.     @party_command_window.select(index)
  162.     @party_command_window.oy = oy
  163.     perform_transition
  164.   end
  165.  
  166.   def victor_battle_sprite_patch
  167.     return if !$imported[:ve_animated_battle]
  168.     @spriteset.dispose_actors
  169.     @spriteset.create_actors
  170.     setup_spriteset
  171.   end  
  172.  
  173. end
  174.  
  175. class Spriteset_Battle  
  176.  
  177.   #--------------------------------------------------------------------------
  178.   # ● Dispose yea enemy hp bar
  179.   #--------------------------------------------------------------------------            
  180.   def hide_enemy_hp_gauges
  181.       battler_sprites.each {|sprite| sprite.hide_enemy_hp_gauges }
  182.   end
  183.   #--------------------------------------------------------------------------
  184.   # ● Dispose yea popup text
  185.   #--------------------------------------------------------------------------            
  186.   def hide_popup
  187.       battler_sprites.each {|sprite| sprite.hide_popup }
  188.   end
  189.  
  190. end
  191.  
  192. class Sprite_Battler < Sprite_Base
  193.   def hide_enemy_hp_gauges
  194.      @back_gauge_viewport.visible = false if @back_gauge_viewport
  195.      @hp_gauge_viewport.visible = false if @hp_gauge_viewport
  196.   end
  197.  
  198.   def hide_popup
  199.       for popup in @popups
  200.       popup.bitmap.dispose
  201.       popup.dispose
  202.       @popups.delete(popup)
  203.       popup = nil
  204.       end
  205.   end
  206. end
  207.  
  208. class Window_BattleLog < Window_Selectable
  209.   def hide_background_box
  210.     @back_sprite.visible = false
  211.   end
  212.   def show_background_box
  213.     @back_sprite.visible = true
  214.   end
  215. end
Advertisement
Add Comment
Please, Sign In to add comment