• Do not use Discord to host any images you post, these links expire quickly! You can learn how to add images to your posts here.

Help with Form Changes

delusionsofgrandr

Novice
Member
Joined
Aug 10, 2024
Posts
25
Hi! I'm trying to create a regional form of Mimikyu, but I'm running into some issues getting Disguise to work as intended. I've gotten as far as getting Disguise to take the blow in the place of initial damage, but instead of changing to the new regional busted form, Mimikyu goes back to the Alolan busted form, then reverts to the Alolan disguise after the battle. Could I get some advice on how I can implement this? I've tried looking at the code for Zen Mode Darmanitan, but it just isn't clicking.
 

Atlat

Novice
Member
Joined
Jan 8, 2023
Posts
31
This is going solely off of what I remember right now, but it sounds like Mimikyu's form change is directly setting Mimikyu to form 1 (Alola busted form). If the way you set it up is: Form 0 = Mimikyu, 1 = Busted, 2 = Regional Mimikyu, 3 = Busted Regional, then you need to change how the form change happens so that instead of =0 and =1, it's +=1 on getting hit and -=1 on leaving battle.
 

delusionsofgrandr

Novice
Member
Joined
Aug 10, 2024
Posts
25
This is going solely off of what I remember right now, but it sounds like Mimikyu's form change is directly setting Mimikyu to form 1 (Alola busted form). If the way you set it up is: Form 0 = Mimikyu, 1 = Busted, 2 = Regional Mimikyu, 3 = Busted Regional, then you need to change how the form change happens so that instead of =0 and =1, it's +=1 on getting hit and -=1 on leaving battle.
Omg thank you, I’ll give this a shot when I’m next on my computer 🥹

EDIT You're a genius, thank you!

EDIT EDIT: I thought I had fixed it, but now I'm stuck with both Mimikyu forms changing to my new regional busted form, and getting stuck that way instead of going back to their proper disguised form... Is anyone free to critique my coding?


Trying to insert just "@form + 1" triggered an error when I entered battle and Mimikyu took damage, so I tried this workaround, and it seemed to work, but now regular Alolan Mimikyu is changing to the new regional busted form too.
Ruby:
Expand Collapse Copy
if target.damageState.disguise
      @battle.pbShowAbilitySplash(target)
      if Battle::Scene::USE_ABILITY_SPLASH
        @battle.pbDisplay(_INTL("Its disguise served it as a decoy!"))
      else
        @battle.pbDisplay(_INTL("{1}'s disguise served it as a decoy!", target.pbThis))
      end
      @battle.pbHideAbilitySplash(target)
        target.pbChangeForm((@form == 0 ? 1 : 3), _INTL("{1}'s disguise was busted!", target.pbThis))
        target.pbReduceHP(target.totalhp / 8, false) if Settings::MECHANICS_GENERATION >= 8

This is the error message I get when I insert "@form + 1":
[Pokémon Essentials version 21.1]
[v21.1 Hotfixes 1.0.0]
[v21.1 Hotfixes 1.0.9]

Exception: NoMethodError
Message: undefined method `+' for nil:NilClass

Backtrace:
Move_Usage:343:in `pbEndureKOMessage'
Battler_UseMove:691:in `block in pbProcessMoveHit'
Battler_UseMove:689:in `each'
Battler_UseMove:689:in `pbProcessMoveHit'
Battler_UseMove:409:in `block in pbUseMove'
Battler_UseMove:407:in `times'
Battler_UseMove:407:in `pbUseMove'
[Deluxe Battle Kit] [001] Animation Utilities.rb:265:in `block in pbProcessTurn'
PBDebug:6:in `logonerr'
[Deluxe Battle Kit] [001] Animation Utilities.rb:265:in `pbProcessTurn'

Nothing works here no matter what I try.

Code for Mimikyu's form resetting after battle:
Expand Collapse Copy
MultipleForms.register(:MIMIKYU, { #disguised is 0 and 2, busted is 1 and 3)
  "getFormOnLeavingBattle" => proc { |pkmn, battle, usedInBattle, endBattle|
      next pkmn.form - 1
  }
})
 
Last edited:
Back
Top