CyberForte

DoW Flash Enemy

Oct 10th, 2017
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Ruby 5.21 KB | None | 0 0
  1. #==============================================================================
  2. #    Flash Selected Enemy
  3. #    Version: 1.0
  4. #    Author: modern algebra (rmrk.net)
  5. #    Date: September 1, 2009
  6. #++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  7. #  Description:
  8. #
  9. #    This script blinks the battler of the enemy when it is hovered over in the
  10. #   targetting window of the battle scene.
  11. #++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  12. #  Instructions:
  13. #
  14. #    This script is plug & play. Just put it somewhere below Materials and
  15. #   above Main in the Script Editor (F11).
  16. #
  17. #    If you wish to configure the rest period between flashes, or the type of
  18. #   flash (blink or whiten), then go to line 27
  19. #==============================================================================
  20.  
  21. #==============================================================================
  22. # ** Global Constants
  23. #++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  24. #    new constants - FSE_REST_FRAMES; FSE_FLASH_TYPE
  25. #==============================================================================
  26.  
  27. FSE_REST_FRAMES = 4 # The number of frames between battler flashes
  28. FSE_FLASH_TYPE = 1  # The type of effect. 1 => Whiten; 2 => Blink
  29.  
  30. #==============================================================================
  31. # ** Game Battler
  32. #++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  33. #  Summary of Changes:
  34. #    attr_accessor - stop_effect
  35. #    aliased method - initialize
  36. #==============================================================================
  37.  
  38. class Game_Battler
  39.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  40.   # * Public Instance Variables
  41.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  42.   attr_accessor :stop_effect # boolean to turn off any effect immediately
  43.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  44.   # * Object Initialization
  45.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  46.   alias malgbra_init_btllerblinkenmy_0nf3 initialize unless $@
  47.   def initialize (*args)
  48.     @stop_effect = false # Initialize stop effect boolean
  49.     malgbra_init_btllerblinkenmy_0nf3 (*args) # Run Original Method
  50.   end
  51. end
  52.  
  53. #==============================================================================
  54. # ** Sprite Battler
  55. #++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  56. #  Summary of Changes:
  57. #    aliased method - update_effect
  58. #==============================================================================
  59.  
  60. class Sprite_Battler
  61.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  62.   # * Stop Effect
  63.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  64.   alias malgbr_updeffct_blnksenmy_9hv2 update_effect unless $@
  65.   def update_effect (*args)
  66.     # Stop effect if set to stop
  67.     if @battler.stop_effect
  68.       @effect_duration = 1
  69.       @battler.stop_effect = false
  70.     end
  71.     # Run Original Method
  72.     malgbr_updeffct_blnksenmy_9hv2 (*args)
  73.   end
  74. end
  75.  
  76. #==============================================================================
  77. # ** Scene_Battle
  78. #++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  79. #  Summary of Changes:
  80. #    aliased method - start_target_enemy_selection, end_target_enemy_selection,
  81. #      update_target_enemy_selection
  82. #==============================================================================
  83.  
  84. class Scene_Battle
  85.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  86.   # * Start Target Enemy Selection
  87.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  88.   alias malgbr_blinkenmytrgt_strtslct_6dc2 start_target_enemy_selection unless $@
  89.   def start_target_enemy_selection (*args)
  90.     @fse_effect_frames = FSE_FLASH_TYPE == 1 ? 16 : 20
  91.     @blink_frames = @fse_effect_frames + FSE_REST_FRAMES # Initialize blink count
  92.     # Run Original Method
  93.     malgbr_blinkenmytrgt_strtslct_6dc2 (*args)
  94.   end
  95.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  96.   # * Update Target Enemy Selection
  97.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  98.   alias modrna_enmyblink_updtrgtselct_9la2 update_target_enemy_selection unless $@
  99.   def update_target_enemy_selection (*args)
  100.     old_enemy = @target_enemy_window.enemy
  101.     # Run Original Method
  102.     modrna_enmyblink_updtrgtselct_9la2 (*args)
  103.     # If target has changed
  104.     if @target_enemy_window.nil? || old_enemy != @target_enemy_window.enemy
  105.       # Stop that enemy from blinking
  106.       old_enemy.stop_effect = true
  107.       return if @target_enemy_window.nil?
  108.       # start other blink
  109.       @blink_frames = @fse_effect_frames + FSE_REST_FRAMES
  110.     end
  111.     # Blink selected battler when count is up
  112.     if @blink_frames >= @fse_effect_frames + FSE_REST_FRAMES
  113.       @blink_frames = 0
  114.       if FSE_FLASH_TYPE == 1    # White Flash
  115.         @target_enemy_window.enemy.white_flash = true
  116.       elsif FSE_FLASH_TYPE == 2 # Blink
  117.         @target_enemy_window.enemy.blink = true
  118.       end
  119.     end
  120.     @blink_frames += 1
  121.   end
  122. end
Advertisement
Add Comment
Please, Sign In to add comment