• Just a reminder that providing specifics on, sharing links to, or naming websites where ROMs can be accessed is against the rules. If your post has any of this information it will be removed.
  • Ever thought it'd be cool to have your art, writing, or challenge runs featured on PokéCommunity? Click here for info - we'd love to spotlight your work!
  • Our weekly protagonist poll is now up! Vote for your favorite Trading Card Game 2 protagonist in the poll by clicking here.
  • 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] Crash on wild encounter after adding disguise

  • 11
    Posts
    6
    Years
    • Seen May 19, 2019
    Hi,
    Im trying to add mimikyu's ability into essentials following the steps listed here (I had to copy the whole comment because im not allowed to use links yet


    Create a PBEffect called Disguise in PBEffects and initialise it in PokeBattle_Battler, def pbInitEffects:
    Code:
    @effects[PBEffects::Disguise] = false
    # Disguise causes the ability-suppressing effect to fade
    # if it was passed on through Baton Pass
    if isConst?(self.ability,PBAbilities,:DISGUISE)
    @effects[PBEffects::GastroAcid] = false
    end
    if isConst?(self.ability,PBAbilities,:ILLUSION) #Illusion
    [email protected](@index)
    party=party.find_all {|item| item && !item.egg? && item.hp>0 }
    if party[party.length-1] != @pokemon
    @effects[PBEffects::Illusion] = party[party.length-1]
    else
    @effects[PBEffects::Illusion] = nil
    end
    else
    @effects[PBEffects::Illusion] = nil
    end #Illusion
    In PokeBattle_Battler, def pbCheckForm:
    Code:
    # Mimikyu
    if self.hasWorkingAbility(:DISGUISE) &&
    isConst?(self.species,PBSpecies,:MIMIKYU) &&
    !self.isFainted?
    if self.form!=1
    self.form=1
    self.type1=getID(PBTypes,:GHOST)
    self.type2=getID(PBTypes,:FAIRY)
    end
    end
    in PokeBattle_Battler, def pbAbilitiesOnSwitchIn:
    Code:
    if onactive
    # weather ability scripts
    if self.hasWorkingAbility(:DISGUISE) && onactive
    @effects[PBEffects::Disguise]=true
    end


    In PokeBattle_Move, def pbReduceHPDamage insert this code:
    Code:
    if opponent.effects[PBEffects::Substitute]>0 && (!attacker || attacker.index!=opponent.index) &&
    !attacker.hasWorkingAbility(:INFILTRATOR) && !isSoundBased?
    PBDebug.log("[#{opponent.pbThis}'s substitute took the damage]")
    damage=opponent.effects[PBEffects::Substitute] if damage>opponent.effects[PBEffects::Substitute]
    opponent.effects[PBEffects::Substitute]-=damage
    opponent.damagestate.substitute=true
    @battle.scene.pbDamageAnimation(opponent,0)
    @battle.pbDisplayPaused(_INTL("The substitute took damage for {1}!",opponent.name))
    if opponent.effects[PBEffects::Substitute]<=0
    opponent.effects[PBEffects::Substitute]=0
    @battle.pbDisplayPaused(_INTL("{1}'s substitute faded!",opponent.name))
    PBDebug.log("[#{opponent.pbThis}'s substitute faded]")
    end
    opponent.damagestate.hplost=damage
    damage=0
    else
    opponent.damagestate.substitute=false
    if opponent.effects[PBEffects::Disguise] && !attacker.hasBypassingAbility()
    @battle.pbDisplayEffect(opponent)
    @battle.pbDisplay(_INTL("Its disguise served it as a decoy!"))
    opponent.effects[PBEffects::Disguise]=false
    opponent.form=1
    opponent.pbCheckForm
    @battle.pbDisplay(_INTL("{1}'s disguise was busted!"))
    damage=0
    end
    Moves that swap, copy, change or suppress abilities will fail and abilities that copy other abilities will not trigger if Disguise is the targeted ability. Mummy will only change Mimikyu's ability if its Disguise is busted.





    However, after doing this I get the error below when entering any encounter.






    [Pok?mon Essentials version 17]
    Exception: NameError
    Message: uninitialized constant PBEffects::Disguise
    PokeBattle_Battler:479:in `pbInitEffects'
    PokeBattle_Battler:199:in `initialize'
    PokeBattle_Battle:333:in `new'
    PokeBattle_Battle:333:in `initialize'
    PokeBattle_Battle:332:in `each'
    PokeBattle_Battle:332:in `initialize'
    PField_Battles:91:in `new'
    PField_Battles:91:in `pbWildBattle'
    PField_Field:387:in `pbBattleOnStepTaken'
    PField_Field:368:in `pbOnStepTaken'


    any help would be appreciated. thanks.
     
    I think you need to add Disguise to your PBEffects scripts. It applies to a battler so I guess add it just before Yawn (make it have Yawn's number and make Yawn 1 bigger)?assuming Yawn is the last one in the single-battler-list (it is in stock Essentials).
     
    I think you need to add Disguise to your PBEffects scripts. It applies to a battler so I guess add it just before Yawn (make it have Yawn's number and make Yawn 1 bigger)?assuming Yawn is the last one in the single-battler-list (it is in stock Essentials).

    I added it before yawn, and got the same error. for refrence, here is the part of the script you were referring to

    @effects[PBEffects::Unburden] = false
    @effects[PBEffects::Uproar] = 0
    @effects[PBEffects::Uturn] = false
    @effects[PBEffects::WaterSport] = false
    @effects[PBEffects::WeightChange] = 0
    @effects[PBEffects::Disguise] = false
    # Disguise causes the ability-suppressing effect to fade
    # if it was passed on through Baton Pass
    if isConst?(self.ability,PBAbilities,:DISGUISE)
    @effects[PBEffects::GastroAcid] = false
    end
    if isConst?(self.ability,PBAbilities,:ILLUSION) #Illusion
    [email protected](@index)
    party=party.find_all {|item| item && !item.egg? && item.hp>0 }
    if party[party.length-1] != @pokemon
    @effects[PBEffects::Illusion] = party[party.length-1]
    else
    @effects[PBEffects::Illusion] = nil
    end
    else
    @effects[PBEffects::Illusion] = nil
    end #Illusion
    @effects[PBEffects::Yawn] = 0

    end
     
    Last edited:
    I think I explained where I was expecting your to edit badly. The part of the scripts I'm referring to starts like this:

    Code:
    begin
      module PBEffects
        ############################################################################
        # These effects apply to a battler
        AquaRing           = 0

    Ends like this:

    Code:
        TotalDamage       = 3
      end
    
    rescue Exception
      if $!.is_a?(SystemExit) || "#{$!.class}"=="Reset"
        raise $!
      end
    end

    And the change I had in mind was this (red=delete, green=add):

    Code:
        WishMaker          = 107
    [color=red]    Yawn               = 108[/color]
    [color=green]    Disguise           = 108[/color]
    [color=green]    Yawn               = 109[/color]
        
        ############################################################################
        # These effects apply to a side

    This is the "PBEffects" script, which is above "PBWeather" and under "PBEnvironment".
     
    Last edited:
    hmmm, my problem:

    Code:
    ---------------------------
    Pokemon Essentials
    ---------------------------
    [Pok?mon Essentials version 17.2]
    
    Exception: NoMethodError
    
    Message: undefined method `hasBypassingAbility' for #<PokeBattle_Battler:0xa287470>
    
    PokeBattle_Move:1227:in `pbReduceHPDamage'
    
    PokeBattle_Move:1342:in `pbEffect'
    
    PokeBattle_MoveEffects:5883:in `pbEffect'
    
    PokeBattle_Battler:3017:in `pbProcessMoveAgainstTarget_ebs'
    
    PokeBattle_Battler:2972:in `each'
    
    PokeBattle_Battler:2972:in `pbProcessMoveAgainstTarget_ebs'
    
    Elite Battle Battle:475:in `pbProcessMoveAgainstTarget'
    
    PokeBattle_Battler:3462:in `pbUseMove_ebs'
    
    PokeBattle_Battler:3442:in `loop'
    
    PokeBattle_Battler:3465:in `pbUseMove_ebs'

    Idk what is this 'hasBypassingAbility'

    im usin v17.2 and ebs 4.3.3
     
    Idk what is this 'hasBypassingAbility'

    im usin v17.2 and ebs 4.3.3

    What do you think it is? The clue is literally in the name. Try hasMoldBreaker instead? But IIRC that's not the last problem you'll have to fix if you try to integrate Disguise with Essentials v17.2.

    If you're lucky NewAgeSteel might notice this thread and be able to tell you what he did.
     
    What do you think it is? The clue is literally in the name. Try hasMoldBreaker instead? But IIRC that's not the last problem you'll have to fix if you try to integrate Disguise with Essentials v17.2.

    If you're lucky NewAgeSteel might notice this thread and be able to tell you what he did.

    oh, i change to hasMoldBreaker and didnt give me a issue.

    Now my sprite form do not change. I mean, when trigger ability, do not change sprite, only in summary screen.

    Ty ty!
     
    oh, i change to hasMoldBreaker and didnt give me a issue.

    Now my sprite form do not change. I mean, when trigger ability, do not change sprite, only in summary screen.

    Ty ty!

    Did you make sure you have the right graphics in place? I'll be happy to help you but it might take a bit of trail and error because I had a lot of adjusting to do to get mine to work as well, and I don't remember all of the parts that were changed, but we can try and work this out together :)
     
    I think I explained where I was expecting your to edit badly. The part of the scripts I'm referring to starts like this:

    Code:
    begin
      module PBEffects
        ############################################################################
        # These effects apply to a battler
        AquaRing           = 0

    Ends like this:

    Code:
        TotalDamage       = 3
      end
    
    rescue Exception
      if $!.is_a?(SystemExit) || "#{$!.class}"=="Reset"
        raise $!
      end
    end

    And the change I had in mind was this (red=delete, green=add):

    Code:
        WishMaker          = 107
    [color=red]    Yawn               = 108[/color]
    [color=green]    Disguise           = 108[/color]
    [color=green]    Yawn               = 109[/color]
        
        ############################################################################
        # These effects apply to a side

    This is the "PBEffects" script, which is above "PBWeather" and under "PBEnvironment".

    sorry for the delayed response, had to leave town for the day. I did what you said, i just have one more error that looks like it should be reletively simple but i cant seem to figure it out


    Exception: ArgumentError
    Message: wrong number of arguments(0 for 1)
    PokeBattle_Move:375:in `hasWorkingAbility'
    PokeBattle_Move:375:in `pbTypeModifier'
    PokeBattle_Battler:2440:in `pbSuccessCheck'
    PokeBattle_Battler:2719:in `pbProcessMoveAgainstTarget'
    PokeBattle_Battler:2715:in `each'
    PokeBattle_Battler:2715:in `pbProcessMoveAgainstTarget'
    PokeBattle_Battler:3193:in `pbUseMove'
    PokeBattle_Battler:3173:in `loop'
    PokeBattle_Battler:3196:in `pbUseMove'
    PokeBattle_Battler:3394:in `pbProcessTurn'

    here's the contents of line 375-378 in pokebattle_move

    if attacker.hasWorkingAbility && isSoundBased?
    atype=getConst(PBTypes,:WATER) || 0
    end


    This error shows only when i try to use an attack in battle
     
    Last edited:
    Like the error says, hasWorkingAbility needs an argument. In this case it's the ability to check for, e.g. hasWorkingAbility(:ABILITYNAME)
     
    I got another error but was able to fix it by removing
    "@battle.pbDisplayEffect(opponent)" and changing hasBypassingAbility to HasMoldBreaker. thanks so much for all your help!
     
    Did you make sure you have the right graphics in place? I'll be happy to help you but it might take a bit of trail and error because I had a lot of adjusting to do to get mine to work as well, and I don't remember all of the parts that were changed, but we can try and work this out together :)

    Sure sure. Graphics>Battlers>Back>and '_1'. (im usin EBS)
    Like i sad, the sprite (front in case) shows in summary screen like '_1' (Disguise Form). Only in battle didnt, keeps normal sprite Mimikyu form.

    The abil trigger but do not change the sprite back, only in summary screen.

    Ty ty!
     
    Back
    Top