• 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!
  • 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
    12
    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?
     
    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.
     
    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:
    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
     
    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