The PokéCommunity Forums  

Go Back   The PokéCommunity Forums > Creative Discussions > Game Development > Pokémon Essentials
Sign Up Rules/FAQ Live Battle Blogs Mark Forums Read

Notices

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.


Reply
Click here to go to the first staff post in this thread.  
Thread Tools
  #1    
Old July 24th, 2013, 08:45 PM
lauerolus's Avatar
lauerolus
 
Join Date: Mar 2013
Gender: Male
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

Spoiler:
Code:
---------------------------
Pokemon Rebalanced: Pastel Red
---------------------------
Exception: NoMethodError

Message: undefined method `ballon****counter=' for #<PokeBattle_Battler:0xb3deba0>

PokeBattle_Battler:773:in `pbAbilitiesOnSwitchIn'

PokeBattle_Battle:1739:in `pbOnActiveAll'

PokeBattle_Battle:1738:in `each'

PokeBattle_Battle:1738:in `pbOnActiveAll'

PokeBattle_Battle:2294:in `pbStartBattleCore'

PokeBattle_Battle:2133:in `pbStartBattle'

PokemonField:1016:in `pbWildBattle'

PokemonField:1015:in `pbSceneStandby'

PokemonField:1017:in `pbWildBattle'

PokemonField:1014:in `pbBattleAnimation'



This exception was logged in 

C:\Users\Laureola\Saved Games/Pokemon Rebalanced_ Pastel Red/errorlog.txt.

Press Ctrl+C to copy this message to the clipboard.
---------------------------
OK   
---------------------------



and the code that causes it

Spoiler:
Code:
    if isConst?(ability,PBAbilities,:BALLOONS) && onactive
      self.ballon****counter = 0
      @battle.pbDisplay(_INTL("{1}'s balloons lifted it high up!",pbThis))
    end



As you can see, I try to set the hit counter for the Pikachu that just switched in to 0 and run into an undefined method error. Thank you for any help given!
Reply With Quote
  #2    
Old July 25th, 2013, 04:38 AM
Maruno's Avatar
Maruno
Lead Dev of Pokémon Essentials
 
Join Date: Jan 2008
Location: England
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.
__________________
Reply With Quote
  #3    
Old July 25th, 2013, 05:49 AM
lauerolus's Avatar
lauerolus
 
Join Date: Mar 2013
Gender: Male
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.
Spoiler:


In PBEffects, added at the end of the list
Code:
BalloonsCounter   = 165
Inside PokeBatle_Move, adding to the Air Balloon check
Code:
      if isConst?(opponent.item,PBItems,:AIRBALLOON) || isConst?(opponent.ability,PBAbilities,:BALLOONS)
         if isConst?(opponent.item,PBItems,:AIRBALLOON)
          opponent.pokemon.itemRecycle=opponent.item
          opponent.pokemon.itemInitial=0 if opponent.pokemon.itemInitial==opponent.item
          opponent.item=0
          @battle.pbDisplay(_INTL("{1}'s Air Balloon burst!",opponent.pbThis))
         else
          [email protected](_INTL("Hello, this is before bcncrement",opponent.pbThis))
          opponent.effects[PBEffects::BalloonsCounter] += 1
          [email protected](_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))
            opponent.ability=getConst(PBAbilities,:POPPED)
            @battle.pbDisplay(_INTL("{1} was grounded!",opponent.pbThis))
           end
        
         end
      
      end
Anywhere in PokeBattle_Battle where an Air Balloon check is
Code:
isConst?(pkmn.item,PBItems,:BALLOONS) ||
Added to def pbAbilitiesOnSwitchIn(onactive), to enable the abiliy
Code:
    if isConst?(ability,PBAbilities,:BALLOONS) && onactive
      @effects[PBEffects::BalloonsCounter] = 0
      @battle.pbDisplay(_INTL("{1}'s balloons lifted it high up!",pbThis))
    end
    if isConst?(ability,PBAbilities,:POPPED) && onactive
      @effects[PBEffects::BalloonsCounter] = 0
      self.setAbility(165)
      @battle.pbDisplay(_INTL("{1}'s balloons lifted it high up!",pbThis))
    end






Last edited by lauerolus; July 25th, 2013 at 01:08 PM.
Reply With Quote
Reply
Quick Reply

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
Minimum Characters Per Post: 25



All times are UTC -8. The time now is 06:40 PM.


Style by Nymphadora, artwork by Sa-Dui.
Like our Facebook Page Follow us on Twitter © 2002 - 2014 The PokéCommunity™, pokecommunity.com.
Pokémon characters and images belong to The Pokémon Company International and Nintendo. This website is in no way affiliated with or endorsed by Nintendo, Creatures, GAMEFREAK, The Pokémon Company or The Pokémon Company International. We just love Pokémon.
All forum styles, their images (unless noted otherwise) and site designs are © 2002 - 2014 The PokéCommunity / PokéCommunity.com.
PokéCommunity™ is a trademark of The PokéCommunity. All rights reserved. Sponsor advertisements do not imply our endorsement of that product or service. User generated content remains the property of its creator.