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

AI vs AI

4
Posts
10
Years
    • Seen Dec 4, 2014
    Hi there!

    Seeing as i have been searching for hours now with no results, i figured i'd just ask directly. What is the best way, if at all possible, to make a battle where both sides are controlled by the AI?
     

    PinkCatDragon

    The 17 year old programer. Now byte off
    388
    Posts
    14
    Years
  • Hmm i do have idea but its a little awkward to explan but basicly you need to find the AI script then make the sencond battler use that insted of being controlled. i look into makeing a script for that. when i have time
     
    4
    Posts
    10
    Years
    • Seen Dec 4, 2014
    Thanks!

    I do have some basic programming experience but none with ruby, and i'm not sure how one would go about changing what controls the player.
     

    PinkCatDragon

    The 17 year old programer. Now byte off
    388
    Posts
    14
    Years
  • Its not full ai but here you go
    Spoiler:


    Replace the old pbOwnedByPlayer?(index) with the above code you should find it in PokeBattle_Battle

    The pokemon will battle each other when you active switch 76
     

    Dylanrockin

    That guy
    276
    Posts
    12
    Years
    • Seen Jun 9, 2016
    Its not full ai but here you go
    Spoiler:


    Replace the old pbOwnedByPlayer?(index) with the above code you should find it in PokeBattle_Battle

    The pokemon will battle each other when you active switch 76

    With as you stated "pbOwnedByPlayer(index)" would I have to replace this wherever it says that in PokeBattle_Battle? Because my game froze when I activated the switch in battle and I am not sure what it is that I am doing wrong.
     
    4
    Posts
    10
    Years
    • Seen Dec 4, 2014
    Dylanrockin you only have to replace it in the place where it's defined.

    So replace:

    def pbOwnedByPlayer?(index)
    code
    more code
    end

    with:

    def pbOwnedByPlayer?(index)
    return false if pbIsOpposing?(index)
    return false if @player.is_a?(Array) && index==2
    return false if $game_switches[76]==true
    end
     

    Maruno

    Lead Dev of Pokémon Essentials
    5,286
    Posts
    16
    Years
    • Seen May 3, 2024
    It really should return true after the three false lines.
     

    PinkCatDragon

    The 17 year old programer. Now byte off
    388
    Posts
    14
    Years
  • Spoiler:


    as stated by Marino i did miss the return true theres a fix above or
    just add "return true" above the end
     
    29
    Posts
    5
    Years
    • Seen Feb 27, 2023
    If I'm allowed to ressurect this thread, is there any way to make this work in 18.1? It was comfy to go through an entire battle with just a key.
     

    StCooler

    Mayst thou thy peace discover.
    9,301
    Posts
    4
    Years
    • Seen May 5, 2024
    If I'm allowed to ressurect this thread, is there any way to make this work in 18.1? It was comfy to go through an entire battle with just a key.

    Yeah, it's the same.
    Write this:
    Code:
      def pbOwnedByPlayer?(idxBattler)
        return false if opposes?(idxBattler)
        return false if $game_switches[89] #Change to whatever free switch you have.
        return pbGetOwnerIndexFromBattlerIndex(idxBattler)==0
      end
     

    AskipLudo

    The Masked Guy
    159
    Posts
    7
    Years
  • I don't know if I can revive this, but I tried it and seemed to work, just the "player" AI doesn't use items, so idk if some script can be implemented to do so
     
    Back
    Top