• 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.

Better AI system

AskipLudo

The Masked Guy
  • 159
    Posts
    7
    Years
    I'm still getting this error:

    Spoiler:
     

    DarrylBD99

    Content Creator and Game Developer
  • 321
    Posts
    4
    Years
    Just a recommendation, you should probably put the beast mode part of the different trainer ai scale.
     
  • 4
    Posts
    3
    Years
    • Seen Feb 25, 2021
    I changed opps = eachOpponent -> opps = []
    battler.eachOpposing {|b| opps.push(b)}

    Then replaced idxbattler with battler.index in the following script line.
    skill = @battle.pbGetOwnerFromBattlerIndex(battler.index).skill || 0

    Still getting the "moves" error though
     

    #Not Important

    All hail the wishmaker
  • 910
    Posts
    4
    Years
    I changed opps = eachOpponent -> opps = []
    battler.eachOpposing {|b| opps.push(b)}

    Then replaced idxbattler with battler.index in the following script line.
    skill = @battle.pbGetOwnerFromBattlerIndex(battler.index).skill || 0

    Still getting the "moves" error though

    I'm still getting this error:

    Spoiler:

    Just a recommendation, you should probably put the beast mode part of the different trainer ai scale.

    Ill take a look at these later and post some solutions. Could you tell me when these errors occur?
     

    AskipLudo

    The Masked Guy
  • 159
    Posts
    7
    Years
    Mine when in battle so the opponent don't do anything, your start the battle everybody send his pokemon, you use a move AND the error appear so the opposite trainer do nothing and it skip his turn
     
  • 4
    Posts
    3
    Years
    • Seen Feb 25, 2021
    Exact same time for me. Your opponent in battle gets an error every time it's their turn to attack.
     

    StCooler

    Mayst thou thy peace discover.
  • 9,304
    Posts
    4
    Years
    • Seen today
    Hey there,

    I'm currently testing/fixing this script, so maybe I can help.

    I think I got a new error :

    Spoiler:


    I was testing and got a random wild battle

    The most important words are wild battle.

    The problem is that the function pbEnemyShouldMegaEvolve?(idxBattler) is trying to ask the owner of the battler if it should mega-evolve. What owner? None, as it is a wild battle.

    My solution consists in adding:

    Code:
      #=============================================================================
      # Decide whether the opponent should Mega Evolve their Pokémon
      #=============================================================================
      def pbEnemyShouldMegaEvolve?(idxBattler)
        return false if @battle.wildBattle? [COLOR="Green"]# Add this line right below the definition. [/COLOR]
        # And then the rest


    I also noted a few errors in the code.

    Spoiler:



    I also have a few remarks.

    Remark 1. I noticed a lot of bugs due to the use of PurifyChamberSet.isSuperEffective(t1, t2). Why use this function instead of PBTypes.superEffective?(t1, t2) ?
    Furthermore, PurifyChamberSet.isSuperEffective(t1, t2) assumes t1 and t2 are battlers, not types!

    Remark 2. I tested this script with trainers with level 100 skill, I didn't notice they switch more...
     

    AskipLudo

    The Masked Guy
  • 159
    Posts
    7
    Years
    Hey there,

    I'm currently testing/fixing this script, so maybe I can help.



    The most important words are wild battle.

    The problem is that the function pbEnemyShouldMegaEvolve?(idxBattler) is trying to ask the owner of the battler if it should mega-evolve. What owner? None, as it is a wild battle.

    Tried it with your fix but wild battle still make error :(
     

    StCooler

    Mayst thou thy peace discover.
  • 9,304
    Posts
    4
    Years
    • Seen today
    Tried it with your fix but wild battle still make error :(

    Is it the same error? Please post a screenshot!

    I think I should post the fixed script that I'm testing. There were several errors throughout the script so you may just have found another bug.
     

    AskipLudo

    The Masked Guy
  • 159
    Posts
    7
    Years
    Is it the same error? Please post a screenshot!

    I think I should post the fixed script that I'm testing. There were several errors throughout the script so you may just have found another bug.

    I'll show you after, but I think it was same error

    EDIT: Here you go :

    Spoiler:
     
    Last edited:

    StCooler

    Mayst thou thy peace discover.
  • 9,304
    Posts
    4
    Years
    • Seen today
    I'll show you after, but I think it was same error

    EDIT: Here you go :

    Spoiler:

    Well, it's the same error, but at the same time it's not the same error XD
    It's the same error in that it's trying to find the skill of the trainer, while it's again a wild battle.

    Go to line 482, it should be:

    Code:
    skill = @battle.pbGetOwnerFromBattlerIndex(idxBattler) || 0

    and delete this line. Don't worry, the skill variable is already defined at the beginning of the pbChooseMoves() function.

    See you at your next bug XD
     
    Last edited:
    Back
    Top