• Our software update is now concluded. You will need to reset your password to log in. In order to do this, you will have to click "Log in" in the top right corner and then "Forgot your password?".
  • Welcome to PokéCommunity! Register now and join one of the best fan communities on the 'net to talk Pokémon and more! We are not affiliated with The Pokémon Company or Nintendo.

[Scripting Question] When the BGM changes in battle, the opponent's battler sprite turns to the opposite side!

2
Posts
3
Years
    • Seen Jul 3, 2020
    Hi everyone!
    I was looking for a way to change the battle BGM in battle, as in Pokémon B/W/2 gym battles. That said, I ran into this thread (I cannot post links because this is my first post, but the title is:"How to change battle BGM in battle...") and I found the script I was searching for. I tried it and it eventually worked, but there's a problem: the opponent's Pokémon's battler sprite turns to the opposite side as soon as the BGM changes! Moreover, it looks as if the Pokéball were tossed from my side towards the opponent's side. Can someone help? Here's the section in question (around line 1296 of the PokeBattle_Battle script):
    Spoiler:

    def pbSendOut(index,pokemon)
    pbSetSeen(pokemon)
    @peer.pbOnEnteringBattle(self,pokemon)
    if pbIsOpposing?(index)
    @scene.pbTrainerSendOut(index,pokemon)
    if $game_switches[62] and pbPokemonCount(@party2)==1
    pbBGMPlay("Victory is Right Before Your Eyes!",100,100)

    end
    @scene.pbSendOut(index,pokemon)
    end
    @scene.pbResetMoveIndex(index)
    end

    Thanks to who'll answer.
     
    233
    Posts
    5
    Years
    • Seen Oct 9, 2023
    You accidentally deleted part of the old function while trying to add this new code. Here's how it looks without the BGM edit:
    Code:
    def pbSendOut(index,pokemon)
      pbSetSeen(pokemon)
      @peer.pbOnEnteringBattle(self,pokemon)
      if pbIsOpposing?(index)
        @scene.pbTrainerSendOut(index,pokemon)
      else
        @scene.pbSendOut(index,pokemon)
      end
      @scene.pbResetMoveIndex(index)
    end
    And here's how it should look after your BGM edit:
    Code:
    def pbSendOut(index,pokemon)
      pbSetSeen(pokemon)
      @peer.pbOnEnteringBattle(self,pokemon)
      if pbIsOpposing?(index)
        @scene.pbTrainerSendOut(index,pokemon)
        if $game_switches[62] && pbPokemonCount(@party2)==1
          pbBGMPlay("Victory is Right Before Your Eyes!",100,100)
        end
      else
        @scene.pbSendOut(index,pokemon)
      end
      @scene.pbResetMoveIndex(index)
    end
    You deleted the "else", so "@scene.pbSendOut" would be called every time the opponent switches Pokemon, which makes it look like it's being sent out on the player's side.
     
    2
    Posts
    3
    Years
    • Seen Jul 3, 2020
    You accidentally deleted part of the old function while trying to add this new code. Here's how it looks without the BGM edit:
    Code:
    def pbSendOut(index,pokemon)
      pbSetSeen(pokemon)
      @peer.pbOnEnteringBattle(self,pokemon)
      if pbIsOpposing?(index)
        @scene.pbTrainerSendOut(index,pokemon)
      else
        @scene.pbSendOut(index,pokemon)
      end
      @scene.pbResetMoveIndex(index)
    end
    And here's how it should look after your BGM edit:
    Code:
    def pbSendOut(index,pokemon)
      pbSetSeen(pokemon)
      @peer.pbOnEnteringBattle(self,pokemon)
      if pbIsOpposing?(index)
        @scene.pbTrainerSendOut(index,pokemon)
        if $game_switches[62] && pbPokemonCount(@party2)==1
          pbBGMPlay("Victory is Right Before Your Eyes!",100,100)
        end
      else
        @scene.pbSendOut(index,pokemon)
      end
      @scene.pbResetMoveIndex(index)
    end
    You deleted the "else", so "@scene.pbSendOut" would be called every time the opponent switches Pokemon, which makes it look like it's being sent out on the player's side.

    Oh God, I totally forgot I had deleted that "else" from the script. Ah the perks of being a newbie... Thank you so much for your reply, your help was fundamental!
     
    Back
    Top