- 21
- Posts
- 7
- Years
- Ardennes, France
- Seen Jan 18, 2025
Hello,
As in the title, I would like to have an option to keep the map song (or a song played) in battle (as you can see with Sworld and Shield version, in the "battle" tower elevator). The song is not restarted when the battle starts, no jingle of victory, and the song is not cut when the battle is over.
I think this idea may interested some makers, and maybe become a suggestion for Essentials.
Thanks for your interest.
EDIT: I created a switch (game switch 75) that now keeps the music uncut even with the battles. There are some modifications to be made on some scripts.
Find them below and add what is in bold.
Optional: You can create a common event in parallel with the Game Switch 75 for playing a song (you can play with variables for different songs in this common event).
Dont forget if you lose to add "stop the Game Switch 75" in the cure event (ex: nurse in Pokémon Centers).
PokeBattle_Scene
Overworld_BattleStarting
Utilities_BattleAudio
As in the title, I would like to have an option to keep the map song (or a song played) in battle (as you can see with Sworld and Shield version, in the "battle" tower elevator). The song is not restarted when the battle starts, no jingle of victory, and the song is not cut when the battle is over.
I think this idea may interested some makers, and maybe become a suggestion for Essentials.
Thanks for your interest.
EDIT: I created a switch (game switch 75) that now keeps the music uncut even with the battles. There are some modifications to be made on some scripts.
Find them below and add what is in bold.
Optional: You can create a common event in parallel with the Game Switch 75 for playing a song (you can play with variables for different songs in this common event).
Dont forget if you lose to add "stop the Game Switch 75" in the cure event (ex: nurse in Pokémon Centers).
PokeBattle_Scene
Spoiler:
#=============================================================================
# Phases
#=============================================================================
def pbBeginCommandPhase
@sprites["messageWindow"].text = ""
end
def pbBeginAttackPhase
pbSelectBattler(-1)
pbShowWindow(MESSAGE_BOX)
end
def pbBeginEndOfRoundPhase
end
def pbEndBattle(_result)
@abortable = false
pbShowWindow(BLANK)
# Fade out all sprites
if not $game_switches[75]
pbBGMFade(1.0)
end
pbFadeOutAndHide(@sprites)
pbDisposeSprites
end
# Phases
#=============================================================================
def pbBeginCommandPhase
@sprites["messageWindow"].text = ""
end
def pbBeginAttackPhase
pbSelectBattler(-1)
pbShowWindow(MESSAGE_BOX)
end
def pbBeginEndOfRoundPhase
end
def pbEndBattle(_result)
@abortable = false
pbShowWindow(BLANK)
# Fade out all sprites
if not $game_switches[75]
pbBGMFade(1.0)
end
pbFadeOutAndHide(@sprites)
pbDisposeSprites
end
Overworld_BattleStarting
Spoiler:
# End the trainer intro music
if not $game_switches[75]
Audio.me_stop
end
if not $game_switches[75]
Audio.me_stop
end
Utilities_BattleAudio
Spoiler:
#===============================================================================
# Load various wild battle music
#===============================================================================
def pbGetWildBattleBGM(_wildParty) # wildParty is an array of Pokémon objects
if not $game_switches[75]
if $PokemonGlobal.nextBattleBGM
return $PokemonGlobal.nextBattleBGM.clone
end
ret = nil
if !ret
# Check map metadata
map_metadata = GameData::MapMetadata.try_get($game_map.map_id)
music = (map_metadata) ? map_metadata.wild_battle_BGM : nil
ret = pbStringToAudioFile(music) if music && music != ""
end
if !ret
# Check global metadata
music = GameData::Metadata.get.wild_battle_BGM
ret = pbStringToAudioFile(music) if music && music!=""
end
ret = pbStringToAudioFile("Battle wild") if !ret
return ret
end
end
def pbGetWildVictoryME
if not $game_switches[75]
if $PokemonGlobal.nextBattleME
return $PokemonGlobal.nextBattleME.clone
end
ret = nil
if !ret
# Check map metadata
map_metadata = GameData::MapMetadata.try_get($game_map.map_id)
music = (map_metadata) ? map_metadata.wild_victory_ME : nil
ret = pbStringToAudioFile(music) if music && music != ""
end
if !ret
# Check global metadata
music = GameData::Metadata.get.wild_victory_ME
ret = pbStringToAudioFile(music) if music && music!=""
end
ret = pbStringToAudioFile("Battle victory") if !ret
ret.name = "../../Audio/ME/"+ret.name
return ret
end
end
def pbGetWildCaptureME
if not $game_switches[75]
if $PokemonGlobal.nextBattleCaptureME
return $PokemonGlobal.nextBattleCaptureME.clone
end
ret = nil
if !ret
# Check map metadata
map_metadata = GameData::MapMetadata.try_get($game_map.map_id)
music = (map_metadata) ? map_metadata.wild_capture_ME : nil
ret = pbStringToAudioFile(music) if music && music != ""
end
if !ret
# Check global metadata
music = GameData::Metadata.get.wild_capture_ME
ret = pbStringToAudioFile(music) if music && music!=""
end
ret = pbStringToAudioFile("Battle capture success") if !ret
ret.name = "../../Audio/ME/"+ret.name
return ret
end
end
#===============================================================================
# Load/play various trainer battle music
#===============================================================================
def pbPlayTrainerIntroME(trainer_type)
if not $game_switches[75]
trainer_type_data = GameData::TrainerType.get(trainer_type)
return if nil_or_empty?(trainer_type_data.intro_ME)
bgm = pbStringToAudioFile(trainer_type_data.intro_ME)
pbMEPlay(bgm)
end
end
def pbGetTrainerBattleBGM(trainer) # can be a Player, NPCTrainer or an array of them
if not $game_switches[75]
if $PokemonGlobal.nextBattleBGM
return $PokemonGlobal.nextBattleBGM.clone
end
ret = nil
music = nil
trainerarray = (trainer.is_a?(Array)) ? trainer : [trainer]
trainerarray.each do |t|
trainer_type_data = GameData::TrainerType.get(t.trainer_type)
music = trainer_type_data.battle_BGM if trainer_type_data.battle_BGM
end
ret = pbStringToAudioFile(music) if music && music!=""
if !ret
# Check map metadata
map_metadata = GameData::MapMetadata.try_get($game_map.map_id)
music = (map_metadata) ? map_metadata.trainer_battle_BGM : nil
ret = pbStringToAudioFile(music) if music && music != ""
end
if !ret
# Check global metadata
music = GameData::Metadata.get.trainer_battle_BGM
if music && music!=""
ret = pbStringToAudioFile(music)
end
end
ret = pbStringToAudioFile("Battle trainer") if !ret
return ret
end
end
def pbGetTrainerBattleBGMFromType(trainertype)
if not $game_switches[75]
if $PokemonGlobal.nextBattleBGM
return $PokemonGlobal.nextBattleBGM.clone
end
trainer_type_data = GameData::TrainerType.get(trainertype)
ret = trainer_type_data.battle_BGM if trainer_type_data.battle_BGM
if !ret
# Check map metadata
map_metadata = GameData::MapMetadata.try_get($game_map.map_id)
music = (map_metadata) ? map_metadata.trainer_battle_BGM : nil
ret = pbStringToAudioFile(music) if music && music != ""
end
if !ret
# Check global metadata
music = GameData::Metadata.get.trainer_battle_BGM
ret = pbStringToAudioFile(music) if music && music!=""
end
ret = pbStringToAudioFile("Battle trainer") if !ret
return ret
end
end
def pbGetTrainerVictoryME(trainer) # can be a Player, NPCTrainer or an array of them
if not $game_switches[75]
if $PokemonGlobal.nextBattleME
return $PokemonGlobal.nextBattleME.clone
end
music = nil
trainerarray = (trainer.is_a?(Array)) ? trainer : [trainer]
trainerarray.each do |t|
trainer_type_data = GameData::TrainerType.get(t.trainer_type)
music = trainer_type_data.victory_ME if trainer_type_data.victory_ME
end
ret = nil
if music && music!=""
ret = pbStringToAudioFile(music)
end
if !ret
# Check map metadata
map_metadata = GameData::MapMetadata.try_get($game_map.map_id)
music = (map_metadata) ? map_metadata.trainer_victory_ME : nil
ret = pbStringToAudioFile(music) if music && music != ""
end
if !ret
# Check global metadata
music = GameData::Metadata.get.trainer_victory_ME
if music && music!=""
ret = pbStringToAudioFile(music)
end
end
ret = pbStringToAudioFile("Battle victory") if !ret
ret.name = "../../Audio/ME/"+ret.name
return ret
end
end
# Load various wild battle music
#===============================================================================
def pbGetWildBattleBGM(_wildParty) # wildParty is an array of Pokémon objects
if not $game_switches[75]
if $PokemonGlobal.nextBattleBGM
return $PokemonGlobal.nextBattleBGM.clone
end
ret = nil
if !ret
# Check map metadata
map_metadata = GameData::MapMetadata.try_get($game_map.map_id)
music = (map_metadata) ? map_metadata.wild_battle_BGM : nil
ret = pbStringToAudioFile(music) if music && music != ""
end
if !ret
# Check global metadata
music = GameData::Metadata.get.wild_battle_BGM
ret = pbStringToAudioFile(music) if music && music!=""
end
ret = pbStringToAudioFile("Battle wild") if !ret
return ret
end
end
def pbGetWildVictoryME
if not $game_switches[75]
if $PokemonGlobal.nextBattleME
return $PokemonGlobal.nextBattleME.clone
end
ret = nil
if !ret
# Check map metadata
map_metadata = GameData::MapMetadata.try_get($game_map.map_id)
music = (map_metadata) ? map_metadata.wild_victory_ME : nil
ret = pbStringToAudioFile(music) if music && music != ""
end
if !ret
# Check global metadata
music = GameData::Metadata.get.wild_victory_ME
ret = pbStringToAudioFile(music) if music && music!=""
end
ret = pbStringToAudioFile("Battle victory") if !ret
ret.name = "../../Audio/ME/"+ret.name
return ret
end
end
def pbGetWildCaptureME
if not $game_switches[75]
if $PokemonGlobal.nextBattleCaptureME
return $PokemonGlobal.nextBattleCaptureME.clone
end
ret = nil
if !ret
# Check map metadata
map_metadata = GameData::MapMetadata.try_get($game_map.map_id)
music = (map_metadata) ? map_metadata.wild_capture_ME : nil
ret = pbStringToAudioFile(music) if music && music != ""
end
if !ret
# Check global metadata
music = GameData::Metadata.get.wild_capture_ME
ret = pbStringToAudioFile(music) if music && music!=""
end
ret = pbStringToAudioFile("Battle capture success") if !ret
ret.name = "../../Audio/ME/"+ret.name
return ret
end
end
#===============================================================================
# Load/play various trainer battle music
#===============================================================================
def pbPlayTrainerIntroME(trainer_type)
if not $game_switches[75]
trainer_type_data = GameData::TrainerType.get(trainer_type)
return if nil_or_empty?(trainer_type_data.intro_ME)
bgm = pbStringToAudioFile(trainer_type_data.intro_ME)
pbMEPlay(bgm)
end
end
def pbGetTrainerBattleBGM(trainer) # can be a Player, NPCTrainer or an array of them
if not $game_switches[75]
if $PokemonGlobal.nextBattleBGM
return $PokemonGlobal.nextBattleBGM.clone
end
ret = nil
music = nil
trainerarray = (trainer.is_a?(Array)) ? trainer : [trainer]
trainerarray.each do |t|
trainer_type_data = GameData::TrainerType.get(t.trainer_type)
music = trainer_type_data.battle_BGM if trainer_type_data.battle_BGM
end
ret = pbStringToAudioFile(music) if music && music!=""
if !ret
# Check map metadata
map_metadata = GameData::MapMetadata.try_get($game_map.map_id)
music = (map_metadata) ? map_metadata.trainer_battle_BGM : nil
ret = pbStringToAudioFile(music) if music && music != ""
end
if !ret
# Check global metadata
music = GameData::Metadata.get.trainer_battle_BGM
if music && music!=""
ret = pbStringToAudioFile(music)
end
end
ret = pbStringToAudioFile("Battle trainer") if !ret
return ret
end
end
def pbGetTrainerBattleBGMFromType(trainertype)
if not $game_switches[75]
if $PokemonGlobal.nextBattleBGM
return $PokemonGlobal.nextBattleBGM.clone
end
trainer_type_data = GameData::TrainerType.get(trainertype)
ret = trainer_type_data.battle_BGM if trainer_type_data.battle_BGM
if !ret
# Check map metadata
map_metadata = GameData::MapMetadata.try_get($game_map.map_id)
music = (map_metadata) ? map_metadata.trainer_battle_BGM : nil
ret = pbStringToAudioFile(music) if music && music != ""
end
if !ret
# Check global metadata
music = GameData::Metadata.get.trainer_battle_BGM
ret = pbStringToAudioFile(music) if music && music!=""
end
ret = pbStringToAudioFile("Battle trainer") if !ret
return ret
end
end
def pbGetTrainerVictoryME(trainer) # can be a Player, NPCTrainer or an array of them
if not $game_switches[75]
if $PokemonGlobal.nextBattleME
return $PokemonGlobal.nextBattleME.clone
end
music = nil
trainerarray = (trainer.is_a?(Array)) ? trainer : [trainer]
trainerarray.each do |t|
trainer_type_data = GameData::TrainerType.get(t.trainer_type)
music = trainer_type_data.victory_ME if trainer_type_data.victory_ME
end
ret = nil
if music && music!=""
ret = pbStringToAudioFile(music)
end
if !ret
# Check map metadata
map_metadata = GameData::MapMetadata.try_get($game_map.map_id)
music = (map_metadata) ? map_metadata.trainer_victory_ME : nil
ret = pbStringToAudioFile(music) if music && music != ""
end
if !ret
# Check global metadata
music = GameData::Metadata.get.trainer_victory_ME
if music && music!=""
ret = pbStringToAudioFile(music)
end
end
ret = pbStringToAudioFile("Battle victory") if !ret
ret.name = "../../Audio/ME/"+ret.name
return ret
end
end
Last edited: