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.

Thread Tools
Old July 24th, 2013 (8:45 PM).
Wootius's Avatar
Wootius Wootius is offline
    Join Date: Mar 2013
    Gender: Male
    Posts: 306
    A hopefully simple question. I have an ability, BALLOONS(Balloons!!) on a alternate form of Pikachu that currently mimics the effect of the Air balloon item. Switching forms works fine. However, I want it to take three hits to ground this Pikachu after which its abillity will change to GROUNDED until swapped back in and out.

    So I added added an accessor, attr_accessor(:ballons=hit=counter) with equal signs due to censorship, to the PokeBattle_Pokemon to count these hits. However, when I try to set this to any value I get a undefined method error.

    Here's the error in full

    Pokemon Rebalanced: Pastel Red
    Exception: NoMethodError

    Message: undefined method `ballon****counter=' for #&&
    Reply With Quote

    Relevant Advertising!

    Old July 25th, 2013 (4:38 AM).
    Maruno's Avatar
    Maruno Maruno is offline
    Lead Dev of Pokémon Essentials
      Join Date: Jan 2008
      Location: England
      Posts: 5,189
      A Pokémon in the party is an instance of PokeBattle_Pokemon. A Pokémon that's out in battle is an instance of PokeBattle_Battler. The two are separate (but related) things. The reason is that, in battle, a Pokémon's features can change (most notably by using Transform), yet those changes are only supposed to be temporary and not affect the actual Pokémon.

      So you put the attr_accessor(:balloonshitcounter) in the wrong place. Your best bet is to instead add another value into PBEffects, and then the counter can by accessed with battler.effects[PBEffects::BalloonsCounter] (or @effects[PBEffects::BalloonsCounter] if you're in PokeBattle_Battler).

      Then in PokeBattle_Battler, def pbInitEffects, set it to the default value of 0. Stick this at the end of the method.

      A little further down is def pbAbilitiesOnSwitchIn. I'm guessing this is where you put your code, and that's the right place for it. However, you should set the value to 3 here rather than 0. It's going to count how many balloons the Pokémon has left, and each pop will reduce the number by 1.

      As for the popping itself, I assume it works the same way as the Air Balloon item does. So add code in all the same places as it which do (roughly) the same things.
      Go to the Pokémon Essentials Wiki

      | Downloads | Tutorials | Fangames |
      | All Animations Project |

      Follow me on Twitter: @maruno42

      Reply With Quote
      Old July 25th, 2013 (5:49 AM). Edited July 25th, 2013 by Wootius.
      Wootius's Avatar
      Wootius Wootius is offline
        Join Date: Mar 2013
        Gender: Male
        Posts: 306
        Thank you, Maruno. I know enough about programming to know that I don't know enough. It's 100% working now, including losing then resetting the ability by switch out then back in. The only thing "wrong" is the listed ability doesn't change on the Status screen when I change the ability, due to that info being from PokeBattle_Pokemon I assume. Does Mummy do the same thing? Mummy Doesn't update on the Status screen while under its effects either. I may try and "fix" this.

        You're awesome.

        In looking to help others with this/something similar I'll add the code here. Using this will give you a Pokemon with an ability
        that mimics Air Balloon for 3 hits after which it changes abilities to one without an effect until the next time it's switched out/in.

        In PBEffects, added at the end of the list
        BalloonsCounter   = 165
        Inside PokeBatle_Move, adding to the Air Balloon check
              if isConst?(opponent.item,PBItems,:AIRBALLOON) || isConst?(opponent.ability,PBAbilities,:BALLOONS)
                 if isConst?(opponent.item,PBItems,:AIRBALLOON)
                  opponent.pokemon.itemInitial=0 if opponent.pokemon.itemInitial==opponent.item
                  @battle.pbDisplay(_INTL("{1}'s Air Balloon burst!",opponent.pbThis))
                  #@battle.pbDisplay(_INTL("Hello, this is before bcncrement",opponent.pbThis))
                  opponent.effects[PBEffects::BalloonsCounter] += 1
                  #@battle.pbDisplay(_INTL("dsdsa ",opponent.pbThis))
                  @battle.pbDisplay(_INTL("One of {1}'s balloons burst!",opponent.pbThis))
                   if(opponent.effects[PBEffects::BalloonsCounter] >=3)
                    @battle.pbDisplay(_INTL("{1}'s balloons are gone!",opponent.pbThis))
                    @battle.pbDisplay(_INTL("{1} was grounded!",opponent.pbThis))
        Anywhere in PokeBattle_Battle where an Air Balloon check is
        isConst?(pkmn.item,PBItems,:BALLOONS) ||
        Added to def pbAbilitiesOnSwitchIn(onactive), to enable the abiliy
            if isConst?(ability,PBAbilities,:BALLOONS) && onactive
              @effects[PBEffects::BalloonsCounter] = 0
              @battle.pbDisplay(_INTL("{1}'s balloons lifted it high up!",pbThis))
            if isConst?(ability,PBAbilities,:POPPED) && onactive
              @effects[PBEffects::BalloonsCounter] = 0
              @battle.pbDisplay(_INTL("{1}'s balloons lifted it high up!",pbThis))

        Reply With Quote

        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

        Sponsored Links
        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:40 AM.