• Just a reminder that providing specifics on, sharing links to, or naming websites where ROMs can be accessed is against the rules. If your post has any of this information it will be removed.
  • Our friends from the Johto Times are hosting a favorite Pokémon poll - and we'd love for you to participate! Click here for information on how to vote for your favorites!
  • Scottie, Todd, Serena, Kris - which Pokémon protagonist is your favorite? Let us know by voting in our poll!
  • 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
    8
    Years
    Hello community,

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

    [PokeCommunity.com] 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.
     
    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.
     
    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