v18.1 Would it be possible to have the music not fade out and restart when defeating a certain Trainer class?

This thread pertains to v18.1 of Pokémon Essentials.

Sploopo

Rookie
Member
Joined
Feb 15, 2021
Posts
9
Age
24
The title (hopefully) says it all. I'm trying to make it so the music doesn't fade out and restart upon defeating a certain type of Trainer, just to make the mood of the area more tense. Is there any way that I could do this?
 

NettoHikari

Cooltrainer
Member
Joined
Jan 4, 2019
Posts
198
Tried downloading that and the FmodEx program. It's giving me an error saying "Script 'Script-RGSSLinker' line 9: Runtime Error occurred. LoadLibrary: RGSS Linker.dll". Is there anything that I can do to fix this?
Are you sure that in addition to the 2 scripts you have to install for FmodEx, you also downloaded the "RGSS Linker.dll" file and placed it in your project's root folder (among other files like Game.exe, Game.ini, etc.)? I've never actually used this script myself, so I'm not too sure otherwise.
 

Sploopo

Rookie
Member
Joined
Feb 15, 2021
Posts
9
Age
24
Are you sure that in addition to the 2 scripts you have to install for FmodEx, you also downloaded the "RGSS Linker.dll" file and placed it in your project's root folder (among other files like Game.exe, Game.ini, etc.)? I've never actually used this script myself, so I'm not too sure otherwise.
Didn't do that - I'm not sure exactly where to find it.
 

NettoHikari

Cooltrainer
Member
Joined
Jan 4, 2019
Posts
198
Didn't do that - I'm not sure exactly where to find it.
I'm assuming you're using this resource: https://reliccastle.com/resources/137/

If so, then it's literally the first link provided, the one on Mediafire. It's a zip file containing three DLL files, one of which is the RGSS Linker, and all three files need to be placed in the project's root. There are also two more Mediafire links, which contain updated versions of the "RGSS FmodEX.dll" and "fmodex.dll" files, that you'll have to download and replace in your project. Basically, you should be adding a total of 3 new DLL files to your project.
 

NettoHikari

Cooltrainer
Member
Joined
Jan 4, 2019
Posts
198
Managed to get this working - doesn't seem to work, goes back to where the music was pre-battle.

Is there any other method or would I have to edit something myself?
Oh, I'm really sorry, I totally misread your question and suggested the wrong script to you. So just to confirm, after winning a battle against a certain trainer class, you want the trainer BGM that was playing during the battle to continue playing in the overworld of the map, replacing the map's normal BGM? I think the relevant code you would need to edit is in PField_Visuals, under the function "def pbBattleAnimation(bgm=nil,battletype=0,foe=nil)":
Ruby:
if $game_system && $game_system.is_a?(Game_System)
  $game_system.bgm_resume(playingBGM)
  $game_system.bgs_resume(playingBGS)
end
This code resumes the map's BGM, which is run after the battle ends. You can prevent this code from running for certain trainer classes by changing that piece of code to the following:
Ruby:
certain_trainers = [PBTrainers::TRAINER1,PBTrainers::TRAINER2]
if $game_system && $game_system.is_a?(Game_System)
  if !(foe && certain_trainers.include?(foe[0].trainertype))
    $game_system.bgm_resume(playingBGM)
    $game_system.bgs_resume(playingBGS)
  end
end
Where you fill in whatever trainer classes you want to affect in the "certain_trainers" array.
 

Sploopo

Rookie
Member
Joined
Feb 15, 2021
Posts
9
Age
24
Oh, I'm really sorry, I totally misread your question and suggested the wrong script to you. So just to confirm, after winning a battle against a certain trainer class, you want the trainer BGM that was playing during the battle to continue playing in the overworld of the map, replacing the map's normal BGM? I think the relevant code you would need to edit is in PField_Visuals, under the function "def pbBattleAnimation(bgm=nil,battletype=0,foe=nil)":
Ruby:
if $game_system && $game_system.is_a?(Game_System)
  $game_system.bgm_resume(playingBGM)
  $game_system.bgs_resume(playingBGS)
end
This code resumes the map's BGM, which is run after the battle ends. You can prevent this code from running for certain trainer classes by changing that piece of code to the following:
Ruby:
certain_trainers = [PBTrainers::TRAINER1,PBTrainers::TRAINER2]
if $game_system && $game_system.is_a?(Game_System)
  if !(foe && certain_trainers.include?(foe[0].trainertype))
    $game_system.bgm_resume(playingBGM)
    $game_system.bgs_resume(playingBGS)
  end
end
Where you fill in whatever trainer classes you want to affect in the "certain_trainers" array.
Thanks. Going to try this out ASAP.
 

Sploopo

Rookie
Member
Joined
Feb 15, 2021
Posts
9
Age
24
Oh, I'm really sorry, I totally misread your question and suggested the wrong script to you. So just to confirm, after winning a battle against a certain trainer class, you want the trainer BGM that was playing during the battle to continue playing in the overworld of the map, replacing the map's normal BGM? I think the relevant code you would need to edit is in PField_Visuals, under the function "def pbBattleAnimation(bgm=nil,battletype=0,foe=nil)":
Ruby:
if $game_system && $game_system.is_a?(Game_System)
  $game_system.bgm_resume(playingBGM)
  $game_system.bgs_resume(playingBGS)
end
This code resumes the map's BGM, which is run after the battle ends. You can prevent this code from running for certain trainer classes by changing that piece of code to the following:
Ruby:
certain_trainers = [PBTrainers::TRAINER1,PBTrainers::TRAINER2]
if $game_system && $game_system.is_a?(Game_System)
  if !(foe && certain_trainers.include?(foe[0].trainertype))
    $game_system.bgm_resume(playingBGM)
    $game_system.bgs_resume(playingBGS)
  end
end
Where you fill in whatever trainer classes you want to affect in the "certain_trainers" array.
Tried implementing this, nothing happened. I'm pretty sure it could be some kind of conflict with EBDX changing the way in-game music works, so I'll have to ask LukaSJ about that.
 
Top