• 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] Surrender Script [help/question]

1,682
Posts
8
Years
    • Seen today
    ---------------------------
    Pokemon Essentials
    ---------------------------
    [Pokémon Essentials version 17.2]

    Exception: NoMethodError

    Message: undefined method `include' for [56, 57, 58]:Array

    PokeBattle_Battle:1606:in `pbRun_ebs'

    EliteBattle_0:287:in `pbRun'

    PokeBattle_Battle:2696:in `pbCommandPhase_ebs'

    PokeBattle_Battle:2640:in `loop'

    PokeBattle_Battle:2730:in `pbCommandPhase_ebs'

    PokeBattle_Battle:2629:in `each'

    PokeBattle_Battle:2629:in `pbCommandPhase_ebs'

    EliteBattle_0:294:in `pbCommandPhase'

    EliteBattle_0:224:in `pbStartBattleCore'

    EliteBattle_0:223:in `logonerr'



    .. I should really try to get a grasp on Ruby, so I can even understand what's going on when this kinda things happen :v

    My fault, my fault.
    Change
    Code:
     !banrun.include(pbGetOwner(1).trainertype)
    to
    Code:
     !banrun.include[b]?[/b](pbGetOwner(1).trainertype)
    I tested and fixed it but forgot to update the code in the post at the same time.
     
    32
    Posts
    6
    Years
    • Seen Sep 9, 2019
    My fault, my fault.
    Change
    Code:
     !banrun.include(pbGetOwner(1).trainertype)
    to
    Code:
     !banrun.include[b]?[/b](pbGetOwner(1).trainertype)
    I tested and fixed it but forgot to update the code in the post at the same time.

    that's quite alright, one thing tho;
    if you go back on the decision to surrender to a regular trainer i gives you the same response as if you were trying to surrender to team rocket " You can't forfeit to these guys!"

    .. would adding another else fix that? or would it have to be another elsif for when you trying to escape from regular trainers?
     
    1,682
    Posts
    8
    Years
    • Seen today
    Sorry, I guess I should have tested in more depth.
    change this
    Code:
        if @opponent
          banrun=[getID(PBTrainers,:TEAMROCKET_M),
                  getID(PBTrainers,:TEAMROCKET_F),
                  getID(PBTrainers,:ROCKETBOSS)]
          if $DEBUG && Input.press?(Input::CTRL)
            if pbDisplayConfirm(_INTL("Treat this battle as a win?"))
              @decision=1
              return 1
            elsif pbDisplayConfirm(_INTL("Treat this battle as a loss?"))
              @decision=2
              return 1
            end
          elsif !banrun.include?(pbGetOwner(1).trainertype) && 
              pbDisplayConfirm(_INTL("Would you like to forfeit the match and quit now?"))
            pbSEPlay("Battle flee")
            pbDisplay(_INTL("{1} forfeited the match!",self.pbPlayer.name))
            @decision=3
            return 1
          else
            pbDisplayPaused(_INTL("No! You can't forfeit to these guys!"))
          end
          return 0
        end
    to this
    Code:
        if @opponent
          banrun=[getID(PBTrainers,:TEAMROCKET_M),
                  getID(PBTrainers,:TEAMROCKET_F),
                  getID(PBTrainers,:ROCKETBOSS)]
          if $DEBUG && Input.press?(Input::CTRL)
            if pbDisplayConfirm(_INTL("Treat this battle as a win?"))
              @decision=1
              return 1
            elsif pbDisplayConfirm(_INTL("Treat this battle as a loss?"))
              @decision=2
              return 1
            end
          elsif !banrun.include?(pbGetOwner(1).trainertype)
            if pbDisplayConfirm(_INTL("Would you like to forfeit the match and quit now?"))
              pbSEPlay("Battle flee")
              pbDisplay(_INTL("{1} forfeited the match!",self.pbPlayer.name))
              @decision=3
              return 1
            else
              return 0
            end
          else
            pbDisplayPaused(_INTL("No! You can't forfeit to these guys!"))
          end
          return 0
        end
     
    32
    Posts
    6
    Years
    • Seen Sep 9, 2019
    Sorry, I guess I should have tested in more depth.
    change this
    Code:

    thanks i'll be sure to try it as soon as i can!
    thanks again, here have a little something for your time
    tumblr_p3sn4tyxtV1rpuwpro1_raw.png


    sorry for the bad quality, im currently dealing with art block XD
     
    Last edited:
    Back
    Top