RMRK is retiring.
Registration is disabled. The site will remain online, but eventually become a read-only archive. More information.

RMRK.net has nothing to do with Blockchains, Cryptocurrency or NFTs. We have been around since the early 2000s, but there is a new group using the RMRK name that deals with those things. We have nothing to do with them.
NFTs are a scam, and if somebody is trying to persuade you to buy or invest in crypto/blockchain/NFT content, please turn them down and save your money. See this video for more information.
[VXA] Flash Selected Enemy 1.0.0

0 Members and 1 Guest are viewing this topic.

*
Rep:
Level 97
2014 Most Unsung Member2014 Best RPG Maker User - Engine2013 Best RPG Maker User (Scripting)2012 Best Member2012 Best RPG Maker User (Scripting)2012 Favorite Staff Member2012 Most Mature MemberSecret Santa 2012 ParticipantProject of the Month winner for July 20092011 Best Use of Avatar and Signature Space2011 Best RPG Maker User (Scripting)2011 Most Mature Member2011 Favourite Staff Member2011 Best Veteran2010 Best Use Of Avatar And Signature Space2010 Favourite Staff Member
Flash Selected Enemy
Version: 1.0.0
Author: modern algebra
Date: July 18, 2012

Version History


  • <Version 1.0> 2012.07.18 - Original Release

Description


This script makes it so that when choosing a target in battle, the battler of the currently selected enemy will flash.

Features

  • Easy graphical feedback for targetting in battle
  • Can set the colour and duration of the flash, as well as the rest time between flashes

Screenshots



Instructions

Simply paste the script into the Script Editor, below Materials but above Main. Beyond that, the script is plug & play and enemy battlers will flash white when selected. If you wish, you can edit the colour, duration, and timing of the flashes starting at line 30.

Script


Code: [Select]
#==============================================================================
#    Flash Selected Enemy
#    Version: 1.0.0
#    Author: modern algebra (rmrk.net)
#    Date: July 18, 2012
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
#  Description:
#   
#    This script will flash the battler of any enemy currently selected when
#   the player is targetting.
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
#  Instructions:
#   
#    Paste this script into its own slot in the Script Editor, above Main but
#   below Materials.
#
#    This script is designed to work with the DBS and may be incompatible with
#   other battle scripts.
#
#    This script is completely plug & play, and without modification the
#   selected enemy will whiten. If you want to change the colour to which it
#   flashes, the duration of the flash, or the time between flashes, then go to
#   the editable region starting at line 30 and change those three options.
#==============================================================================

$imported ||= {}
$imported[:"FlashSelectedEnemy 1.0.0"] = true

#\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
#    BEGIN Editable Region
#||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
FSE_REST_FRAMES = 4        # Number of frames between flashes
FSE_FLASH_DURATION = 24    # Number of frames for each flash to complete
FSE_FLASH_COLOUR = [255,255,255] # Colour of the flash, format: [red, green, blue]
#||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
#    END Editable Region
#//////////////////////////////////////////////////////////////////////////////

#==============================================================================
# ** Sprite Battler
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
#  Summary of Changes:
#    aliased method - start_effect; update_effect
#    new method - update_fse_flash
#==============================================================================

class Sprite_Battler
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Start Effect
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  alias ma_fse_strteffct_7fk9 start_effect
  def start_effect(effect_type, *args, &block)
    if effect_type == :fse_flash
      @effect_duration = FSE_FLASH_DURATION
      @fse_flash_mod = 320 / FSE_FLASH_DURATION
      @battler_visible = true
    end
    ma_fse_strteffct_7fk9(effect_type, *args, &block)
  end
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Update Effect
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  alias ma_fse_updeffct_9hv2 update_effect
  def update_effect(*args, &block)
    # If playing an FSE flash
    if @effect_duration > 0 && @effect_type == :fse_flash
      update_fse_flash
    end
    # Stop effect if set to stop
    if @battler.sprite_effect_type == :fse_revert_to_normal
      revert_to_normal
      @battler.sprite_effect_type = nil
    end
    ma_fse_updeffct_9hv2(*args, &block) # Run Original Method
  end
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Update Flash
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  def update_fse_flash
    self.color.set(*FSE_FLASH_COLOUR)
    if @effect_duration > (FSE_FLASH_DURATION / 2)
      self.color.alpha = (FSE_FLASH_DURATION - @effect_duration) * @fse_flash_mod
    else
      self.color.alpha = @effect_duration * @fse_flash_mod
    end
  end
end

#==============================================================================
# ** Scene_Battle
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
#  Summary of Changes:
#    aliased method - select_enemy_selection; update
#==============================================================================

class Scene_Battle
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Start Enemy Selection
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  alias ma_fse_strtenemyselect_3hk9 select_enemy_selection
  def select_enemy_selection(*args, &block)
    ma_fse_strtenemyselect_3hk9(*args, &block)
    @fse_effect_frames = FSE_FLASH_DURATION
    @fse_flash_frames = 0 # Initialize blink count
  end
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Frame Update
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  alias ma_fse_udat_8hz5 update
  def update(*args, &block)
    old_enemy = @enemy_window.active ? @enemy_window.enemy : nil
    ma_fse_udat_8hz5(*args, &block)
    if !@enemy_window.active || old_enemy != @enemy_window.enemy # If cursor moves
      # Set the flash to the newly selected enemy
      old_enemy.sprite_effect_type = :fse_revert_to_normal if old_enemy && !old_enemy.dead?
      @fse_flash_frames = 0
    end
    if @enemy_window.active
      if @fse_flash_frames <= 0
        @fse_flash_frames = @fse_effect_frames + FSE_REST_FRAMES
        @enemy_window.enemy.sprite_effect_type = :fse_flash
      end
      @fse_flash_frames -= 1
    end
  end
end

This script is also hosted at Pastebin

Credit


  • modern algebra

Support


Please report bugs, ask questions, and make suggestions in this topic at RMRK.

Known Compatibility Issues

It will not work with some custom battle systems, particularly ones that already have a feature like this built in, such as Yanfly's Ace Battle Engine.

Terms of Use


I adopt the RMRK Terms of Use.
« Last Edit: January 31, 2013, 09:47:58 PM by modern algebra »

********
Rep:
Level 96
2011 Most Missed Member2010 Zero To Hero
I know that this will eventually see use in a project of mine. : ) Good work Modern, the little modules like this are the best in my opinion.

*
Rep:
Level 97
2014 Most Unsung Member2014 Best RPG Maker User - Engine2013 Best RPG Maker User (Scripting)2012 Best Member2012 Best RPG Maker User (Scripting)2012 Favorite Staff Member2012 Most Mature MemberSecret Santa 2012 ParticipantProject of the Month winner for July 20092011 Best Use of Avatar and Signature Space2011 Best RPG Maker User (Scripting)2011 Most Mature Member2011 Favourite Staff Member2011 Best Veteran2010 Best Use Of Avatar And Signature Space2010 Favourite Staff Member
Thanks! I'm glad you like it.

**
Rep: +0/-0Level 82
I've gotten a strange error when using this script. The battle plays normally for
awhile but then freezes with no errors. I tried it in a fresh project and got the
same result when I killed one enemy and use silence on the remaining two.

*
Rep:
Level 97
2014 Most Unsung Member2014 Best RPG Maker User - Engine2013 Best RPG Maker User (Scripting)2012 Best Member2012 Best RPG Maker User (Scripting)2012 Favorite Staff Member2012 Most Mature MemberSecret Santa 2012 ParticipantProject of the Month winner for July 20092011 Best Use of Avatar and Signature Space2011 Best RPG Maker User (Scripting)2011 Most Mature Member2011 Favourite Staff Member2011 Best Veteran2010 Best Use Of Avatar And Signature Space2010 Favourite Staff Member
I haven't been able to reproduce the error.

What do you mean by freezing anyway? Do you just mean that the enemies don't attack anymore but the actor still can? If so, then it might just be that they are silenced and you haven't given them any actions that aren't magical, like attack.

If that's not the case, I will need to see a demo with the error recreated.

**
Rep: +0/-0Level 82
Sorry about that. It seems it was a problem with rpg maker itself.
A quick computer reset fixed it.

**
Rep: +0/-0Level 35
RMRK Junior
I've had it freeze in battle with just Yanfly's ACE Core Engine installed and Zeus' Fullscreen++. Here's more info:
http://rmrk.net/index.php?topic=50046.0
DrunkDorks.com (us)
Facebook.com/DrunkDorks (us)
Twitter.com/OrihimeWarlock (me)