Pokémon Essentials All questions and discussion about Pokémon Essentials, the Pokémon game kit for RPG Maker XP, go in here. Also contains links to the latest downloads and the Essentials Wiki.

Ad Content
Reply
 
Thread Tools
  #1   Link to this post, but load the entire thread.  
Old 6 Days Ago (10:43 AM).
EminanE's Avatar
EminanE EminanE is offline
     
    Join Date: Dec 2017
    Posts: 34
    Hi, i found the script for the Ability capsule, im not good at all at scripting and i wanted to know how can i make it so that when used it can switch to the Hidden ability as well.
    Please somebody help me.

    Spoiler:
    ItemHandlers::UseOnPokemon.add(:ABILITYCAPSULE,proc{|item,pokemon,scene|
    abils=pokemon.getAbilityList
    abil1=0; abil2=0
    for i in abils
    abil1=i[0] if i[1]==0
    abil2=i[0] if i[1]==1
    end
    if abil1<=0 || abil2<=0 || pokemon.hasHiddenAbility?
    scene.pbDisplay(_INTL("It won't have any effect."))
    next false
    end
    newabil=(pokemon.abilityIndex+1)%2
    newabilname=PBAbilities.getName((newabil==0) ? abil1 : abil2)
    if scene.pbConfirm(_INTL("Would you like to change {1}'s Ability to {2}?",
    pokemon.name,newabilname))
    pokemon.setAbility(newabil)
    scene.pbRefresh
    scene.pbDisplay(_INTL("{1}'s Ability changed to {2}!",pokemon.name,
    PBAbilities.getName(pokemon.ability)))
    next true
    end
    next false
    })
    Reply With Quote
      #2   Link to this post, but load the entire thread.  
    Old 6 Days Ago (11:00 AM). Edited 6 Days Ago by WolfPP.
    WolfPP's Avatar
    WolfPP WolfPP is offline
    Discord: Wolf#1235
       
      Join Date: Aug 2018
      Location: Brazil
      Gender: Male
      Nature: Jolly
      Posts: 244
      Quote:
      Originally Posted by EminanE View Post
      Hi, i found the script for the Ability capsule, im not good at all at scripting and i wanted to know how can i make it so that when used it can switch to the Hidden ability as well.
      Please somebody help me.

      Spoiler:
      ItemHandlers::UseOnPokemon.add(:ABILITYCAPSULE,proc{|item,pokemon,scene|
      abils=pokemon.getAbilityList
      abil1=0; abil2=0
      for i in abils
      abil1=i[0] if i[1]==0
      abil2=i[0] if i[1]==1
      end
      if abil1<=0 || abil2<=0 || pokemon.hasHiddenAbility?
      scene.pbDisplay(_INTL("It won't have any effect."))
      next false
      end
      newabil=(pokemon.abilityIndex+1)%2
      newabilname=PBAbilities.getName((newabil==0) ? abil1 : abil2)
      if scene.pbConfirm(_INTL("Would you like to change {1}'s Ability to {2}?",
      pokemon.name,newabilname))
      pokemon.setAbility(newabil)
      scene.pbRefresh
      scene.pbDisplay(_INTL("{1}'s Ability changed to {2}!",pokemon.name,
      PBAbilities.getName(pokemon.ability)))
      next true
      end
      next false
      })
      Ok. abil1 is your normal ability and abil2 will be your hidden ability (always ability(2) will be your hidden ability).
      So, try this:
      Spoiler:

      Code:
      ItemHandlers::UseOnPokemon.add(:ABILITYCAPSULE,proc{|item,pokemon,scene|
         abils=pokemon.getAbilityList
         abil1=0; abil2=0
         for i in abils
           abil1=i[0] if i[1]==0 # First normal ability is 0 or 1
           abil2=i[0] if i[1]==2 # Hidden Ability always will be 2 until 5
         end
         if abil2<=0 # If pokemon havent hidden ability
           scene.pbDisplay(_INTL("It won't have any effect."))
           next false
         end
         newabil=(pokemon.abilityIndex+1)%2
         newabilname=PBAbilities.getName((newabil==0) ? abil1 : abil2)
         if scene.pbConfirm(_INTL("Would you like to change {1}'s Ability to {2}?",
            pokemon.name,newabilname))
           pokemon.setAbility(newabil)
           scene.pbRefresh
           scene.pbDisplay(_INTL("{1}'s Ability changed to {2}!",pokemon.name,
              PBAbilities.getName(pokemon.ability)))
           next true
         end
         next false
      })
      Reply With Quote
        #3   Link to this post, but load the entire thread.  
      Old 6 Days Ago (11:19 AM). Edited 6 Days Ago by EminanE.
      EminanE's Avatar
      EminanE EminanE is offline
         
        Join Date: Dec 2017
        Posts: 34
        Quote:
        Originally Posted by WolfPP View Post
        Ok. abil1 is your normal ability and abil2 will be your hidden ability (always ability(2) will be your hidden ability).
        So, try this:
        Spoiler:

        Code:
        ItemHandlers::UseOnPokemon.add(:ABILITYCAPSULE,proc{|item,pokemon,scene|
           abils=pokemon.getAbilityList
           abil1=0; abil2=0
           for i in abils
             abil1=i[0] if i[1]==0 # First normal ability is 0 or 1
             abil2=i[0] if i[1]==2 # Hidden Ability always will be 2 until 5
           end
           if abil2<=0 # If pokemon havent hidden ability
             scene.pbDisplay(_INTL("It won't have any effect."))
             next false
           end
           newabil=(pokemon.abilityIndex+1)%2
           newabilname=PBAbilities.getName((newabil==0) ? abil1 : abil2)
           if scene.pbConfirm(_INTL("Would you like to change {1}'s Ability to {2}?",
              pokemon.name,newabilname))
             pokemon.setAbility(newabil)
             scene.pbRefresh
             scene.pbDisplay(_INTL("{1}'s Ability changed to {2}!",pokemon.name,
                PBAbilities.getName(pokemon.ability)))
             next true
           end
           next false
        })
        Thank you for your help. Will in this case only be possible to get Ability 1 or Hidden ability? Or can i use it to get 1, 2 and hidden?
        I wonder if there is a way that when you use an ability capsule the game unlocks the debug ability selection menu just for that capsule use...
        Reply With Quote
          #4   Link to this post, but load the entire thread.  
        Old 6 Days Ago (1:13 PM). Edited 6 Days Ago by WolfPP.
        WolfPP's Avatar
        WolfPP WolfPP is offline
        Discord: Wolf#1235
           
          Join Date: Aug 2018
          Location: Brazil
          Gender: Male
          Nature: Jolly
          Posts: 244
          Quote:
          Originally Posted by EminanE View Post
          Thank you for your help. Will in this case only be possible to get Ability 1 or Hidden ability? Or can i use it to get 1, 2 and hidden?
          I wonder if there is a way that when you use an ability capsule the game unlocks the debug ability selection menu just for that capsule use...
          Ok, let's go:

          Spoiler:

          Code:
          ItemHandlers::UseOnPokemon.add(:ABILITYCAPSULE,proc{|item,pokemon,scene|
            abils=pokemon.getAbilityList
            abil1=0; abil2=0; abil3=0
            for i in abils
              abil1=i[0] if i[1]==0
              abil2=i[0] if i[1]==1
              abil3=i[0] if i[1]==2
            end   
            choices = []
            choices.push("Change Ability")
            choices.push("Change to Hidden Ability")
            choices.push("Cancel")
            cmd = Kernel.pbMessage(_INTL("What would you like to do?"), choices, choices.length - 1)
            if choices[cmd]=="Change Ability"
              if abil1<=0 || abil2<=0 #|| pokemon.hasHiddenAbility?
                 scene.pbDisplay(_INTL("It won't have any effect."))
                 next false
               end
               newabil=(pokemon.abilityIndex+1)%2
               newabilname=PBAbilities.getName((newabil==0) ? abil1 : abil2)
               if scene.pbConfirm(_INTL("Would you like to change {1}'s Ability to {2}?",
                  pokemon.name,newabilname))
                 pokemon.setAbility(newabil)
                 scene.pbRefresh
                 scene.pbDisplay(_INTL("{1}'s Ability changed to {2}!",pokemon.name,
                    PBAbilities.getName(pokemon.ability)))
                 next true
               end
            elsif choices[cmd]=="Change to Hidden Ability"
              if abil3<=0
                scene.pbDisplay(_INTL("It won't have any effect."))
                next false
              end
              newabil= pokemon.setAbility(2)#(pokemon.abilityIndex+1)%2
              newabilname=PBAbilities.getName((newabil==0) ? abil1 : abil3)
              if scene.pbConfirm(_INTL("Would you like to change {1}'s Ability to {2}?",
                pokemon.name,newabilname))
                pokemon.setAbility(newabil)
                scene.pbRefresh
                scene.pbDisplay(_INTL("{1}'s Ability changed to {2}!",pokemon.name,
                    PBAbilities.getName(pokemon.ability)))
                next true
              end
            end
          })


          This item will change normal abilities between them OR give hidden ability to pokemon (if its have one).
          Reply With Quote
            #5   Link to this post, but load the entire thread.  
          Old 6 Days Ago (2:32 PM).
          EminanE's Avatar
          EminanE EminanE is offline
             
            Join Date: Dec 2017
            Posts: 34
            Quote:
            Originally Posted by WolfPP View Post
            Ok, let's go:

            Spoiler:

            Code:
            ItemHandlers::UseOnPokemon.add(:ABILITYCAPSULE,proc{|item,pokemon,scene|
              abils=pokemon.getAbilityList
              abil1=0; abil2=0; abil3=0
              for i in abils
                abil1=i[0] if i[1]==0
                abil2=i[0] if i[1]==1
                abil3=i[0] if i[1]==2
              end   
              choices = []
              choices.push("Change Ability")
              choices.push("Change to Hidden Ability")
              choices.push("Cancel")
              cmd = Kernel.pbMessage(_INTL("What would you like to do?"), choices, choices.length - 1)
              if choices[cmd]=="Change Ability"
                if abil1<=0 || abil2<=0 #|| pokemon.hasHiddenAbility?
                   scene.pbDisplay(_INTL("It won't have any effect."))
                   next false
                 end
                 newabil=(pokemon.abilityIndex+1)%2
                 newabilname=PBAbilities.getName((newabil==0) ? abil1 : abil2)
                 if scene.pbConfirm(_INTL("Would you like to change {1}'s Ability to {2}?",
                    pokemon.name,newabilname))
                   pokemon.setAbility(newabil)
                   scene.pbRefresh
                   scene.pbDisplay(_INTL("{1}'s Ability changed to {2}!",pokemon.name,
                      PBAbilities.getName(pokemon.ability)))
                   next true
                 end
              elsif choices[cmd]=="Change to Hidden Ability"
                if abil3<=0
                  scene.pbDisplay(_INTL("It won't have any effect."))
                  next false
                end
                newabil= pokemon.setAbility(2)#(pokemon.abilityIndex+1)%2
                newabilname=PBAbilities.getName((newabil==0) ? abil1 : abil3)
                if scene.pbConfirm(_INTL("Would you like to change {1}'s Ability to {2}?",
                  pokemon.name,newabilname))
                  pokemon.setAbility(newabil)
                  scene.pbRefresh
                  scene.pbDisplay(_INTL("{1}'s Ability changed to {2}!",pokemon.name,
                      PBAbilities.getName(pokemon.ability)))
                  next true
                end
              end
            })


            This item will change normal abilities between them OR give hidden ability to pokemon (if its have one).
            Oh man thank you very much, I tried it and it works perfectly from what I've seen :D.
            I am very grateful.
            Reply With Quote
            Reply

            Quick Reply

            Join the conversation!

            Create an account to post a reply in this thread, participate in other discussions, and more!

            Create a PokéCommunity Account
            Ad Content
            Thread Tools

            Posting Rules
            You may not post new threads
            You may not post replies
            You may not post attachments
            You may not edit your posts

            BB code is On
            Smilies are On
            [IMG] code is On
            HTML code is Off

            Forum Jump


            All times are GMT -8. The time now is 10:33 PM.