• 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] Weather-Inducing Form Changes

sonicfan7895

Just a dude, I guess
122
Posts
13
Years
Hello!

I'm having a bit of trouble getting a weather-induced form change to work, similar to the likes of Castform and Cherrim.

For this example, since there is only one weather effect that causes a form change, I took from Cherrim's form-changing script and changed the appropriate sections to fit my need.

This is what the script looks like, under my PokeBattle_Battler script:

Code:
    # Lycamb
    if isConst?(self.species,PBSpecies,:LYCAMB)
      if self.hasWorkingAbility(:LYCANTHROPY) && @battle.pbWeather==PBWeather::FULLMOON
        if self.form!=1
          self.form=1; transformed=true
        end
      else
        if self.form!=0
          self.form=0; transformed=false
        end
      end
    end

But whenever I try to initiate the form change with my desired weather effect, I get this error when playtesting:

Code:
---------------------------
Pokemon Zen
---------------------------
Exception: NoMethodError
Message: undefined method `width' for nil:NilClass
PokeBattle_Scene:2866:in `pbChangePokemon'
PokeBattle_Battler:948:in `pbCheckForm'
PokeBattle_Battler:3483:in `__shadow_pbEndTurn'
PokeBattle_Battler:3482:in `each'
PokeBattle_Battler:3482:in `__shadow_pbEndTurn'
Pokemon_ShadowPokemon:539:in `pbEndTurn'
PokeBattle_Battler:3417:in `pbUseMove'
PokeBattle_Battler:3519:in `pbProcessTurn'
PokeBattle_Battler:3518:in `logonerr'
PokeBattle_Battler:3518:in `pbProcessTurn'

Any ideas for a fix? Not in a huge rush, but would like a bit of help. I don't know what I'm doing wrong, considering I took from a script that I know works from Cherrim.

Running Essentials 16.2, as porting all the work we have done to the new versions will most likely take way too much time.

Any help would be greatly appreciated! Thanks in advance!

EDIT: Just now thinking it's because I don't have any sprites in the Battlers folder. Testing if this is the case.

EDIT 2: This was the case. Mods, do your thing and close this down. I feel like an idiot for posting in the first place and not testing it myself first.
 
Last edited:
1,403
Posts
10
Years
  • Seen Apr 18, 2024
Glad you solved it! For anyone reading this in the future, if you see something about "width" or "height" your first thought should probably be "is that an image that's missing?" particularly if there's also a nil in the error message.
 
Last edited:
Back
Top