Switching battlebacks during battle using TheoAllen - Animated Battlebacks

Hey all - I've got a possibly complicated question. I'm using the TheoAllen animated battlebacks script and I'm trying to switch the battleback during battle.

https://github.com/theoallen/RGSS3/blob/master/Animated Battleback.rb

So I've got a lantern you can turn on and off that works on the map. I want the lantern to also effect/switch the battleback. Right now, I'm able to switch the battleback outside of battle when using the lantern. I just can't get it to work in battle. I suspect it might not even be possible (with the script as is)?

I found this piece of code- "$game_system.anim_bb = "keyname" - posted on another thread that I'm using with a (Lantern On-Off) switch and parallel process to have the correct battleback when you enter battle. Tried adjusting this script call but no dice - "$game_map.change_battleback("battleback1", "battleback2")".

Just wondering if anyone is familiar with the script and can think of a way to make this happen. Or does anyone know if there's another battleback script that allows for switching/swapping during battle? Thank you.
switching the battleback during battle seems very tricky in itself, i like the idea concept you have. i did come across this recently actually so thought id share since i seen it recent. its a fourm post with a few options that may help you out, i dont think you can do the change with Theos script itself but one of these may help to lead you in the right direction.

Thanks for the link! It's been very helpful. This may be trickier then my brain can handle 🙁 I've come up with a simple solution though - I show a black picture with the opacity at 250 to simulate darkness. The animation can be seen underneath but no big deal. The issue now is when an encounter in darkness begins, there's a brief instance at the start of battle where the black picture doesn't show. So everything is "lit". I'm not seeing a simple workaround to this.

giphy.gif


@TheoAllen Sorry to be a bother. Out of curiousity, is it possible to switch animated battlebacks during battle? I'm thinking even if it is, it'd be simpler to not use an animated bb in this instance. Thank you 🙂

Ok. So even if I don't use animated bb, the issue here now seems to be the "flash" of light before battle. It's a small detail but I'd like to "fix" it. I made some other changes to the eventing but I'm still having problems. Now only the enemies show "lit" for a moment (and I can't toggle between backgrounds anymore). Anyone know how I might accomplish having the battlers in darkness from the start? Thanks for the help everyone!

1707823856013.gif
Ah yes, my old script that is somehow popular.
Since you figured out the script call, try to add this patch below my script.
Ruby:
class AnimBB
  def name
    $game_system.anim_bb
  end
end
Then use the script call $game_system.anim_bb = "keyname"
The battleback should be refreshed in the next cycle.
The catch is, the total frame should be the same as the previous animated battleback.
I haven't tried it though. Let me know the result.

Anything more than that needs a little bit of a code refactor to accommodate changing battleback during the battle.
Hey! Thanks a bunch!!!! My previous issue is fixed. Now I can toggle between animated battleback! My second battleback is 7 images of the same black image but swapping between them - on the map and/or in battle - seems to be working correctly.

I'm still having trouble with the enemy troops displaying totally lit moments before the command list displays. I'm actually mixing your script code with eventing a show picture to darken the enemies but it just doesn't seem to be "fast" enough.

This is a question for anyone - what could I do to work around or even fix this? Seems like I need another script to tint the battlers before battle or something. If anyone has suggestions on how to accomplish the idea - I'd appreciate it! Thanks!

1707829128607.png
@heyguy Give this a go.

Just something I whipped up real quick. Could be another way to achieve this, but thought I could provide some input and hopefully this is what you need if I understood correctly.

You will need a "Battle_Image_Cover.png" placed in the Graphics/System folder. I have attached the black image below. Feel free to modify the size dimensions for your game. No method overrides and only aliasing the existing. So, probably good to put below all the other scripts and should work.

Spoiler: FG7 - Battle Start Image Cover
Ruby:
#==============================================================================
# Title: Battle Start Image Cover
# Author: FG7
# Engine: RPG Maker VX Ace
#==============================================================================
# ** Description |
# ----------------
# Adds a quick temporary image to block battlers from being seen and then
# becoming visible once the battle starts (post start)
#==============================================================================
# ** Terms of Use |
# -----------------
# * Free to use in non-commercial projects and commercial projects
# * Feel free to modify and improve the script. Credit is still required.
# * Credit FG7
#==============================================================================

#==============================================================================
# ** Module: FG7::Battle_Start_Image_Cover
#------------------------------------------------------------------------------
#  This modules creates a static variable to be used within the script.
#==============================================================================

module FG7
  module Battle_Start_Image_Cover
 
#==============================================================================
# -------------------- ALLOWED TO EDIT BELOW THIS LINE ---------------------- #
#==============================================================================
 
    # Sets the image used for the battle image cover
    Image = "Graphics/System/Battle_Image_Cover.png"
   
#==============================================================================
# ---------- DO NOT EDIT BELOW THIS LINE (FOR ADVANCED USERS) --------------- #
#==============================================================================
 
  end
end

#==============================================================================
# ** Scene_Battle
#------------------------------------------------------------------------------
#  This class performs battle screen processing.
#==============================================================================

class Scene_Battle < Scene_Base
  #--------------------------------------------------------------------------
  # * Alias Method: Start Processing
  #--------------------------------------------------------------------------
  alias :fg7_battle_start_image_cover_start :start
  def start
    create_battle_cover_image
    fg7_battle_start_image_cover_start
  end
  #--------------------------------------------------------------------------
  # * Alias Method: Post-Start Processing
  #--------------------------------------------------------------------------
  alias :fg7_battle_start_image_cover_post_start :post_start
  def post_start
    fg7_battle_start_image_cover_post_start
    dispose_battle_cover_image
  end
  #--------------------------------------------------------------------------
  # * New Method: Creates Battle Cover Image
  #--------------------------------------------------------------------------
  def create_battle_cover_image
    @battle_cover_sprite = Sprite.new
    @battle_cover_sprite.opacity = 255
    @battle_cover_sprite.z = 99 # Feel free to change the z index
    @battle_cover_sprite.bitmap = Bitmap.new(FG7::Battle_Start_Image_Cover::Image)
  end
  #--------------------------------------------------------------------------
  # * New Method: Disposes Battle Cover Image
  #--------------------------------------------------------------------------
  def dispose_battle_cover_image
    @battle_cover_sprite.bitmap.dispose
    @battle_cover_sprite.dispose
  end
  #--------------------------------------------------------------------------
  # * Alias Method: Termination Processing
  #--------------------------------------------------------------------------
  alias :fg7_battle_start_image_cover_terminate :terminate
  def terminate
    fg7_battle_start_image_cover_terminate
    dispose_battle_cover_image
  end
end

Image Attached:

Battle_Image_Cover.png
Wow!!! Thanks for taking the time to make this - it works great! It seems like the concept is now complete.

I was trying to brainstorm how I might tackle this and came up with using a graphics state script. There's a script that loops an animation on top of an enemy when a state is applied. No idea if it would work those few seconds before battle. No need to try it now, though. I managed to add a switch to your script to control the cover image too. It's perfect - thank you!

Original thread: https://forums.rpgmakerweb.com/threads/switching-battlebacks-during-battle-using-theoallen-animated-battlebacks.165692/