Fade Out Screen in Battle + Mute Sound? (VX Ace)

Hi there. Trying to make a dungeon where the player gets teleported to the entrance after dying in battle (Encounters are random). Got it working through troop events which fade out the screen, abort the battle and lead into a common event (Which then teleports the player). However, there's still some imperfections.


Unfortunately, the battle screen and the regular map seem to have different settings when it comes to screen fadeouts. When I fade out or tint the screen black in battle, it won't carry over when the battle ends, which makes it so that you always briefly see the map you were on before being teleported back to the entrance of the dungeon.

Is there a way to just make the screen stay faded out after battle?


Another issue is the sound. No matter what I do, you still hear the BGM of the map for a brief moment before being teleported to the entrance of the dungeon through the common event.

Is there a way to just universally mute and unmute all sound at will? That would solve this problem but I'm not aware of any way to do this. Been wondering this for a while actually since it would help in a variety of situations.

Thanks.
That's because the transition to the map causes the graphics to fadein.
You can see this in the Scene_Map code.
Doing something like
Ruby:
class Scene_Map < Scene_Base
  alias r2_perform_transition_from_battle perform_transition
  def perform_transition
    return if $game_switches[2] == true
    r2_perform_transition_from_battle
  end
end
will stop the transition of the graphics until you turn the switch off.

So all you need to do is use this and turn the switch on in battle then turn it off in your common event.
and in battle use
RPG::BGM.stop
RPG::BGS.stop
RPG::ME.stop
to stop all music
That's because the transition to the map causes the graphics to fadein.
You can see this in the Scene_Map code.
Doing something like
Ruby:
class Scene_Map < Scene_Base
  alias r2_perform_transition_from_battle perform_transition
  def perform_transition
    return if $game_switches[2] == true
    r2_perform_transition_from_battle
  end
end
will stop the transition of the graphics until you turn the switch off.

So all you need to do is use this and turn the switch on in battle then turn it off in your common event.
First of all thanks for the help!
It works, but now I can't figure out how to fade in again. The Fadein Screen command does nothing - the only thing that works from what I've tried is the player pressing the menu button after being teleported, which resets the screen visibility (For some reason).
and in battle use
RPG::BGM.stop
RPG::BGS.stop
RPG::ME.stop
to stop all music
Maybe I'm just clueless, but not sure how to use these. Bringing them up in a script call does nothing.
Are you doing it in a script call in the common event? It won't work there.
You said you stopped the battle in the troop page, so use it there. I tested that and it worked fine.
For the return to fadein, sorry missed that. I was using the debug menu so I didn't see the issue.
In your common event just use Graphics.transition(30)

Original thread: https://forums.rpgmakerweb.com/threads/fade-out-screen-in-battle-mute-sound-vx-ace.143256/