The PokéCommunity Forums Fan Games Game Development Pokémon Essentials
Custom Scripts Question Crash on wild encounter after adding disguise

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
 
Thread Tools
  #1    
Old 4 Weeks Ago (9:31 PM).
Commiku Commiku is offline
     
    Join Date: Sep 2018
    Posts: 8
    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.
    Reply With Quote
      #2    
    Old 4 Weeks Ago (11:25 PM).
    mgriffin's Avatar
    mgriffin mgriffin is offline
       
      Join Date: Apr 2014
      Posts: 117
      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).
      Reply With Quote
        #3    
      Old 3 Weeks Ago (7:07 AM). Edited 3 Weeks Ago by Commiku.
      Commiku Commiku is offline
         
        Join Date: Sep 2018
        Posts: 8
        Quote:
        Originally Posted by mgriffin View Post
        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
        Reply With Quote
          #4    
        Old 3 Weeks Ago (8:43 AM). Edited 3 Weeks Ago by mgriffin.
        mgriffin's Avatar
        mgriffin mgriffin is offline
           
          Join Date: Apr 2014
          Posts: 117
          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
              Yawn               = 108
              Disguise           = 108
              Yawn               = 109
              
              ############################################################################
              # These effects apply to a side
          This is the "PBEffects" script, which is above "PBWeather" and under "PBEnvironment".
          Reply With Quote
            #5    
          Old 3 Weeks Ago (10:43 AM).
          WolfPP's Avatar
          WolfPP WolfPP is offline
             
            Join Date: Aug 2018
            Location: Brazil
            Gender: Male
            Nature: Jolly
            Posts: 121
            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
            Reply With Quote
              #6    
            Old 3 Weeks Ago (11:00 AM).
            mgriffin's Avatar
            mgriffin mgriffin is offline
               
              Join Date: Apr 2014
              Posts: 117
              Quote:
              Originally Posted by WolfPP View Post
              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.
              Reply With Quote
                #7    
              Old 3 Weeks Ago (11:12 AM).
              WolfPP's Avatar
              WolfPP WolfPP is offline
                 
                Join Date: Aug 2018
                Location: Brazil
                Gender: Male
                Nature: Jolly
                Posts: 121
                Quote:
                Originally Posted by mgriffin View Post
                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!
                Reply With Quote
                  #8    
                Old 3 Weeks Ago (1:17 PM).
                NewAgeSteel NewAgeSteel is offline
                   
                  Join Date: Jan 2017
                  Gender: Male
                  Posts: 67
                  Quote:
                  Originally Posted by WolfPP View Post
                  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 :)
                  Reply With Quote
                    #9    
                  Old 3 Weeks Ago (8:22 AM). Edited 3 Weeks Ago by Commiku.
                  Commiku Commiku is offline
                     
                    Join Date: Sep 2018
                    Posts: 8
                    Quote:
                    Originally Posted by mgriffin View Post
                    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
                        Yawn               = 108
                        Disguise           = 108
                        Yawn               = 109
                        
                        ############################################################################
                        # 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
                    Reply With Quote
                      #10    
                    Old 3 Weeks Ago (8:44 AM).
                    mgriffin's Avatar
                    mgriffin mgriffin is offline
                       
                      Join Date: Apr 2014
                      Posts: 117
                      Like the error says, hasWorkingAbility needs an argument. In this case it's the ability to check for, e.g. hasWorkingAbility(:ABILITYNAME)
                      Reply With Quote
                        #11    
                      Old 3 Weeks Ago (9:21 AM).
                      Commiku Commiku is offline
                         
                        Join Date: Sep 2018
                        Posts: 8
                        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!
                        Reply With Quote
                          #12    
                        Old 3 Weeks Ago (5:01 AM).
                        WolfPP's Avatar
                        WolfPP WolfPP is offline
                           
                          Join Date: Aug 2018
                          Location: Brazil
                          Gender: Male
                          Nature: Jolly
                          Posts: 121
                          Quote:
                          Originally Posted by NewAgeSteel View Post
                          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!
                          Reply With Quote
                          Reply

                          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
                          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 12:36 AM.