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

Ability effects when switching out?

Enigmatic Emolga

abandoned account, pls delete if seen
30
Posts
11
Years
  • So I re-watched the most recent OR/AS trailer (the one that shows off Desolate Land and Primordial Sea) and immediately started to experiment with things (including adding two weather types for each of these abilities, but I digress). So I managed to get all the effects of the abilities in, expect the feature where the harsh sunlight/heavy rain stops when Groudon/Kyogre are switched out, respectively. I looked through Essentials to see if I could see any abilities that had an effect when switching out, but I couldn't find any. Does anyone know how I could add such an effect to Essentials?
     
    95
    Posts
    9
    Years
    • Seen Jun 18, 2016
    Take a look at regenerator's code:

    Code:
    if @hp>0 && @pokemon && isConst?(self.ability,PBAbilities,:REGENERATOR)
          self.pbRecoverHP((totalhp/3).floor,true)
        end

    You just need to put your code inside the def pbInitialize in PokeBattle_Battler. Then just set the weather to 0 and it should work.
     

    Enigmatic Emolga

    abandoned account, pls delete if seen
    30
    Posts
    11
    Years
  • So something like this, then?

    Code:
    if !isConst?(self.ability,PBAbilities,:DESOLATELAND)
          @battle.weather=PBWeather::NONE
          @battle.weatherduration=-1
          @battle.pbDisplay(_INTL("The harsh sunlight faded!"))
        end

    ('NONE' is just something I used as a no weather thing. I'm still quite a noob at all this... -_-)

    EDIT: Whenever I use that code, I get an error, but when I drop the '!', nothing happens.

    Error:
    Spoiler:
     
    Last edited:
    95
    Posts
    9
    Years
    • Seen Jun 18, 2016
    I think there isn't a "none" weather in-battle, so you may need to create it (I have never created new weathers, so I don't exactly know how they work, but it should be something like this):

    Go to the script section PBWeather and create a new one like this:

    Code:
    NONE      = X

    Where X is the next weather number you haven't used.

    Now, your code should be this:

    Code:
    if isConst?(self.ability,PBAbilities,:DESOLATELAND)
          @battle.weather=PBWeather::NONE
          @battle.weatherduration=-1 # I'm not exactly sure about this line and how this works.
          @battle.pbDisplay(_INTL("The harsh sunlight faded!"))
        end
     

    Enigmatic Emolga

    abandoned account, pls delete if seen
    30
    Posts
    11
    Years
  • Ah, that works. Thanks again! And yes, I'd created the 'NONE' weather beforehand.
    (Also the weather duration is -1 because that basically means it stays for an infinite period of time, unless it's changed of course.)
     
    Back
    Top