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

I need help making Weathers

  • 21
    Posts
    11
    Years
    • Seen Oct 25, 2021
    So I want to make a couple of new weathers for the game I'm making. One of them is a meteor shower type weather that functions like hail except dark types are immune instead of ice types, does just copying the coding for hail in pokebattle_battle but switching ice to dark in its coding (and removing the other stuff with the abilities) do that or is there something else I need to do? The other is fog, but the difference is ghost types are immune to the accuracy drop, so how would I do that, since there's no weather that I could modify to do that?
     
  • 824
    Posts
    9
    Years
    Weather affects more than just Pokemon's stats. There's Weather Ball and (I think) Nature Power that change based on the weather. Weather Ball merely changes types, though, so that one's not much of an issue.

    1.) In PBWeather, where all the other weathers are defined, add the following code:
    Code:
        METEORSHOWER = 9
        FOG  = 10
    I made the numbers 9 and 10 because I didn't know if you have the Gen VI Pack, and having black numbers here isn't a problem.

    2.) In PokeBattle_Battler (with the R), if you want to have abilities that trigger these weathers, add the following lines of code below line 1107 (which depending if you have the Gen VI pack should read either "if onactive" or "if !(@battle.isPrimordialWeather?)":
    Code:
            if self.hasWorkingAbility(:FOGGYAURA) && battle.weather!=PBWeather::FOG && @battle.weatherduration!=-1
              @battle.weather=PBWeather::FOG
              if self.hasWorkingItem(:SMOKEBOMB)
                @battle.weatherduration=8
              else
                @battle.weatherduration=5
              end
              @battle.pbDisplayEffect(self,false)
              @battle.pbCommonAnimation("Fog",nil,nil)
              @battle.pbHideEffect(self)
              if EFFECTMESSAGES
                @battle.pbDisplay(_INTL("A dense fog creeped up!"))
              else
                @battle.pbDisplay(_INTL("{1}'s Foggy Aura made it foggy!",pbThis))
              end
              PBDebug.log("[#{pbThis}: Foggy Aura made it foggy]")
            end
            if self.hasWorkingAbility(:ASTEROIDMAGNET) && battle.weather!=PBWeather::METEORSHOWER && @battle.weatherduration!=-1
              @battle.weather=PBWeather::METEORSHOWER
              if self.hasWorkingItem(:METEOR)
                @battle.weatherduration=8
              else
                @battle.weatherduration=5
              end
              @battle.pbDisplayEffect(self,false)
              @battle.pbCommonAnimation("Meteor",nil,nil)
              @battle.pbHideEffect(self)
              if EFFECTMESSAGES
                @battle.pbDisplay(_INTL("It started to rain meteors!"))
              else
                @battle.pbDisplay(_INTL("{1}'s Asteroid Magnet made it rain meteors!",pbThis))
              end
              PBDebug.log("[#{pbThis}: Asteroid Magnet made it rain meteors]")
            end

    3.) in PokeBattle_Move, around line 817 with all the other accuracy modifiers, add the following code:
    Code:
        if @battle.pbWeather==PBWeather::FOG && !attacker.hasType?(:GHOST)
          accuracy/=1.2 # <- change the 1.2 to something else if you want the accuracy to decrease by a different factor.
        end

    4.) In PokeBattle_MoveEffects, around line 3614 where all of Weather Ball's types are defined, add the following code:
    Code:
        type=(getConst(PBTypes,:DARK)  || type) if weather==PBWeather::METEORSHOWER
        type=(getConst(PBTypes,:GHOST) || type) if weather==PBWeather::FOG

    5.) If you want there to be the possibility for overworld fog/meteor showers that carry over into battle, add the following code in PokeBattle_Battle (without the R) around line 2960:
    Code:
        elsif @weather==PBWeather::METEORSHOWER
          pbCommonAnimation("Meteor",nil,nil)
          pbDisplay(_INTL("It is raining meteors."))
        elsif @weather==PBWeather::Fog
          pbCommonAnimation("Fog",nil,nil)
          pbDisplay(_INTL("The fog is thick."))

    6.) In PokeBattle_Battle, around line 3422 where all the end-of-turn weather effects happen, add the following code:
    Code:
    when PBWeather::METEOR
          @weatherduration=@weatherduration-1 if @weatherduration>0
          if @weatherduration==0
            pbDisplay(_INTL("The meteor shower stopped."))
            @weather=0
            PBDebug.log("[Meteor shower weather ended]")
          else
            pbCommonAnimation("Meteor",nil,nil)
    #        pbDisplay(_INTL("Meteor shower continues to fall."))
            if pbWeather==PBWeather::METEORSHOWER
              PBDebug.log("[Meteor shower weather inflicted damage]")
              for i in priority
                next if i.isFainted?
                if !i.pbHasType?(:DARK) &&
                   !i.hasWorkingAbility(:ASTEROIDMAGNET) &&
                   ![0xCA,0xCB].include?(PBMoveData.new(i.effects[PBEffects::TwoTurnAttack]).function) # Dig, Dive
                  @scene.pbDamageAnimation(i,0)
                  i.pbReduceHP((i.totalhp/16).floor)
                  pbDisplay(_INTL("{1} is buffeted by the the meteor shower!",i.pbThis))
                  if i.isFainted?
                    return if !i.pbFaint
                  end
                end
              end
            end
          end
        when PBWeather::FOG
          @weatherduration=@weatherduration-1 if @weatherduration>0
          if @weatherduration==0
            pbDisplay(_INTL("The fog lifted."))
            @weather=0
            PBDebug.log("[Fog weather ended]")
          else
            pbCommonAnimation("Fog",nil,nil)
    #        pbDisplay(_INTL("The fog will not let up!."));
          end
     
  • 21
    Posts
    11
    Years
    • Seen Oct 25, 2021
    Thanks.
    I've got couple of questions though, should these weathers go before or after the primal weathers and how exactly does the accuracy coding for the fog work?
     
  • 824
    Posts
    9
    Years
    Thanks.
    I've got couple of questions though, should these weathers go before or after the primal weathers and how exactly does the accuracy coding for the fog work?

    Not sure what you mean by your first question, my code already prevents fog and meteor showers from triggering if a Primal Weather is up - that's the check to see if the weather duration is negative one.

    If you're asking where you should put it within the code, it doesn't matter as long as you don't put it within the code for another weather, but rather between them. Since you can't have fog and sunlight sametime (at least in game), it doesn't matter which order the codes are coded in.


    As for your second question. The section of code I had you insert the accuracy check into is the check to see if the move will actually hit. This subroutine has three important variables: "accuracy", the user's accuracy, "evasion", the target's evasion, and I think "@accuracy", the move's accuracy. My little bit of code goes "is it foggy? Yes? Is the user Ghost type? No? Divide the user's accuracy by 1.2". 1.2 is for whatever reason a common number to multiply and divide stats by, so I used that in lieu of not knowing how much you wanted accuracy lowered by.
     
  • 21
    Posts
    11
    Years
    • Seen Oct 25, 2021
    Not sure what you mean by your first question, my code already prevents fog and meteor showers from triggering if a Primal Weather is up - that's the check to see if the weather duration is negative one.

    If you're asking where you should put it within the code, it doesn't matter as long as you don't put it within the code for another weather, but rather between them. Since you can't have fog and sunlight sametime (at least in game), it doesn't matter which order the codes are coded in.


    As for your second question. The section of code I had you insert the accuracy check into is the check to see if the move will actually hit. This subroutine has three important variables: "accuracy", the user's accuracy, "evasion", the target's evasion, and I think "@accuracy", the move's accuracy. My little bit of code goes "is it foggy? Yes? Is the user Ghost type? No? Divide the user's accuracy by 1.2". 1.2 is for whatever reason a common number to multiply and divide stats by, so I used that in lieu of not knowing how much you wanted accuracy lowered by.

    Yeah I figured the first out, the bigger problem was the second one because when a pokemon attacks while fog is on an error occurs and after hitting okay on it the battle continues but the attack does nothing, not even text saying it missed, no matter if it's a ghost type or not.
     
  • 824
    Posts
    9
    Years
    Yeah I figured the first out, the bigger problem was the second one because when a pokemon attacks while fog is on an error occurs and after hitting okay on it the battle continues but the attack does nothing, not even text saying it missed, no matter if it's a ghost type or not.

    I got the function wrong. Change hasType? to pbHasType?
     
    Back
    Top