• 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.
  • Ever thought it'd be cool to have your art, writing, or challenge runs featured on PokéCommunity? Click here for info - we'd love to spotlight your work!
  • Dawn, Gloria, Juliana, or Summer - 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.

[Scripting Question] Set weather for next battle

princessyiris

Banned
  • 34
    Posts
    5
    Years
    • Seen Feb 6, 2020
    I need to know what the code is that causes the next battle to have a specific weather.

    Context:
    The main character is playing a battling simulator on his PC.
    He's fighting a virtual opponent, and it is supposed to have Hail throughout the fight.
    I can't have the weather appear in the overworld, because it doesn't make sense for it to be snowing in his room.

    I figured out how to change the battleback using
    Code:
    $PokemonGlobal.nextBattleBack = "Mountain"
    but I can't find any information on how to set actual weather for the next battle.
     
    Weather is set up in def pbPrepareBattle. You'd just have to add a condition after the normal set weather to set the weather to your desired one.
    I don't wanna sound like a simpleton, but I don't actually know how to do that. Pretty much everything I've needed to do in the games so far was something I could basically copy and paste from the wiki.
     
    Hey no worries, I was just pointing you in the right direction for if you did know. fish thing.

    If I'm gonna show you though, I might as well go all the way and set up a nextBattleWeather while I'm at it!

    First things first, we go to script section PField_Metadata to edit class PokemonGlobalMetadata to add a new attr_accessor, nextBattleWeather. You can put that beside attr_accessor :nextBattleBack.

    next in the def initialize under @nextBattleBack = nil, we add @nextBattleWeather = nil

    That was phase 1. Phase 2, we edit def pbPrepareBattle. Above battle.shiftStyle = ($PokemonSystem.battlestyle==0) put
    Code:
      if $PokemonGlobal && $PokemonGlobal.nextBattleWeather
        battle.weather         = $PokemonGlobal.nextBattleWeather
        battle.weatherduration = -1
      end

    Finally, Phase 3, add in the parts that turn off these effects because the battle was activated and done. It's just a matter of finding all the places $PokemonGlobal.nextBattleBack = nil is set and putting $PokemonGlobal.nextBattleWeather = nil. There are 3 spots, 2 in PField_Battles, def pbWildBattle and def pbDoubleWildBattle, and one in PField_Visuals in def pbBattleAnimation

    Finally, in the event, you can call $PokemonGlobal.nextBattleWeather = PBWeather::HAIL (or the desired PBWeather) to make the next battle do that.
     
    Back
    Top