• 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.

Question about conditional branch

24
Posts
7
Years
  • Hello community,

    I made a route which has different BGMs for day and night times. A event page looks like this:

    Question about conditional branch


    I added the conditional branch $PokemonGlobal.surfing so it doesn't play the BGM while surfing. But I also don't want it to play while getting noticed by a trainer and in a fight. I actually made it with the trainer, but later I deleted the script and now I can't remember it. pbNoticePlayer, Kernel.pbNoticePlayer, and Kernel.pbNoticePlayer(get_character(0)) as conditional branch gives me an error.

    I hope you can help me.
     
    226
    Posts
    8
    Years
    • Seen Jul 19, 2023
    Actually there is a much easier way to do this.

    In your scripts you should have something like:

    Code:
          if PBDayNight.isNight?(pbGetTimeNow) &&
             FileTest.audio_exist?("Audio/BGM/"+ @map.bgm.name+ "n")
            pbCueBGM(@map.bgm.name+"n",1.0,@map.bgm.volume,@map.bgm.pitch)
          else
            pbCueBGM(@map.bgm,1.0)

    Which means if it is the night and if you have a file named as your BGM with a "n" at the end, it will play that file. For instance if you have a "Route1" audiofile associated with a map and you add a "Route1n" audiofile, it should play automatically the second one during the night.
     
    24
    Posts
    7
    Years
  • Actually there is a much easier way to do this.

    In your scripts you should have something like:

    Code:
          if PBDayNight.isNight?(pbGetTimeNow) &&
             FileTest.audio_exist?("Audio/BGM/"+ @map.bgm.name+ "n")
            pbCueBGM(@map.bgm.name+"n",1.0,@map.bgm.volume,@map.bgm.pitch)
          else
            pbCueBGM(@map.bgm,1.0)

    Which means if it is the night and if you have a file named as your BGM with a "n" at the end, it will play that file. For instance if you have a "Route1" audiofile associated with a map and you add a "Route1n" audiofile, it should play automatically the second one during the night.

    Thank you for your help.
     
    Back
    Top