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

[Scripting Question] How to have 2 abilities at the same time?

8
Posts
4
Years
    • Seen Sep 24, 2022
    Sorry for my English isn't my native language.

    I want to create a mechanic where pokemon have 2 abilities at the same time. Being possible that this second ability is a hidden ability.

    Example: That Arcanine can use (Intimidate or Flash Fire) and Justified or any other Hidden ability that decides that pokemon has already in poke.setAbility () at the same time. I think that the values 2, 3, 4 and 5 are the hidden abilities.

    And that when seeing the data of my Pokemon both abilities are visible in the Summary Screen.

    I do not know if it is feasible to create an extra page to the summary for the hidden ability and also put the IV's and EV's. I have only seen tutorials on how to insert IV's on the same page where it indicates the stats of the Pokemon, therefore I do not know if it is very laborious to create an extra page.

    Can you help me create this second ability slot for the hidden ability? Thank you so much.
     
    Last edited:
    220
    Posts
    14
    Years
    • Seen Nov 29, 2021
    Here's the graphics and code I use for my summary screen:
    How to have 2 abilities at the same time?

    Code:
        # Write various bits of text
        textpos = [
           [_INTL(""),292,76,2,base,shadow],
           [sprintf("%d/%d",@pokemon.hp,@pokemon.totalhp),501,84,1,Color.new(64,64,64),Color.new(176,176,176)],
           [_INTL("Atk"),231,116,0,base,statshadows[0]],
           [sprintf("%d",@pokemon.attack),355,116,1,Color.new(64,64,64),Color.new(176,176,176)],
           [_INTL("Def"),231,148,0,base,statshadows[1]],
           [sprintf("%d",@pokemon.defense),355,148,1,Color.new(64,64,64),Color.new(176,176,176)],
           [_INTL("Sp. Atk"),365,116,0,base,statshadows[3]],
           [sprintf("%d",@pokemon.spatk),501,116,1,Color.new(64,64,64),Color.new(176,176,176)],
           [_INTL("Sp. Def"),365,148,0,base,statshadows[4]],
           [sprintf("%d",@pokemon.spdef),501,148,1,Color.new(64,64,64),Color.new(176,176,176)],
           [_INTL("Speed"),231,84,0,base,statshadows[2]],
           [sprintf("%d",@pokemon.speed),355,84,1,Color.new(64,64,64),Color.new(176,176,176)],
           [_INTL("Ability"),224,284,0,base,shadow],
           [PBAbilities.getName(@pokemon.ability),362,284,0,Color.new(64,64,64),Color.new(176,176,176)],
           [_INTL("Ability"),224,184,0,base,shadow],
           [PBAbilities.getName(@pokemon.primaryAbility),362,184,0,Color.new(64,64,64),Color.new(176,176,176)],
        ]
        # Draw all text
        pbDrawTextPositions(overlay,textpos)
        # Draw ability description
        abilitydesc = pbGetMessage(MessageTypes::AbilityDescs,@pokemon.ability)
        drawTextEx(overlay,224,316,282,2,abilitydesc,Color.new(64,64,64),Color.new(176,176,176))
        primabilitydesc = pbGetMessage(MessageTypes::AbilityDescs,@pokemon.primaryAbility)
        drawTextEx(overlay,224,216,282,2,primabilitydesc,Color.new(64,64,64),Color.new(176,176,176))
        # Draw HP bar
        if @pokemon.hp>0
          hpzone = 0
          hpzone = 1 if @pokemon.hp<=(@pokemon.totalhp/2).floor
          hpzone = 2 if @pokemon.hp<=(@pokemon.totalhp/4).floor
          imagepos = [
             ["Graphics/Pictures/Summary/overlay_hp",390,68,0,hpzone*6,@pokemon.hp*96/@pokemon.totalhp,6]
          ]
          pbDrawImagePositions(overlay,imagepos)
        end
    Something to note is that primaryAbility is a function I had to create.
    For getting the second ability to function, the majority of the work is done by replacing def hasWorkingAbility with:
    Code:
      def hasWorkingAbility(ability, ignorefainted=false)
        return false if self.isFainted? && !ignorefainted
        return false if @effects[PBEffects::GastroAcid] && ability!=:MULTITYPE && ability!=STANCECHANGE
        if isConst?(@primary,PBAbilities,ability)
          return true
        else
          return isConst?(@ability,PBAbilities,ability)
        end
      end

    Although you're on your own for the compiler and stuff, as I'm still having weird problems with that.
     
    Back
    Top