• 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 script?

4
Posts
5
Years
    • Seen Feb 9, 2019
    Does anyone know how to edit the default battle script to turn the player into an ai during battle?
    Or otherwise does anyone have a script they can share or know how to create this type of script?
     
    1,682
    Posts
    8
    Years
    • Seen yesterday
    There is a variable @controlPlayer that toggles that for ya. But it's only used once, so we've got some work to do to make an easy toggle for it.
    So in the def initialize method, you could add a @controlPlayer = $game_switches[xxx] with all of the other variables to toggle the player control by game switch xxx. If it's off, the player plays, while on, the ai plays.
    The game would use the skill level you defined for the player's trainer type, so pick an appropriate level.
     
    4
    Posts
    5
    Years
    • Seen Feb 9, 2019
    Um, im not to experience with scripts so if you dont mind, u mind giving me an example?
     
    4
    Posts
    5
    Years
    • Seen Feb 9, 2019
    There is a variable @controlPlayer that toggles that for ya. But it's only used once, so we've got some work to do to make an easy toggle for it.
    So in the def initialize method, you could add a @controlPlayer = $game_switches[xxx] with all of the other variables to toggle the player control by game switch xxx. If it's off, the player plays, while on, the ai plays.
    The game would use the skill level you defined for the player's trainer type, so pick an appropriate level.

    Hey which script is @controlPlayer located in ?
     
    4
    Posts
    5
    Years
    • Seen Feb 9, 2019
    ok i found out where it is, and modified it to look like this

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

    It works, but the problem is when a pokemon is knocked out it and it tries to switch pokemon its freezes with this error

    Exception: NoMethodError

    Message: undefined method `ability' for nil:NilClass

    PokeBattle_Battle:1552:in `pbSwitch'

    PokeBattle_Battle:1545:in `each'

    PokeBattle_Battle:1545:in `pbSwitch'

    PokeBattle_Battle:4117:in `__clauses__pbEndOfRoundPhase'

    PokeBattle_Clauses:42:in `pbEndOfRoundPhase'

    PokeBattle_Battle:2792:in `pbStartBattleCore'

    PokeBattle_Battle:2791:in `logonerr'

    PokeBattle_Battle:2791:in `pbStartBattleCore'

    PokeBattle_Battle:2775:in `loop'

    PokeBattle_Battle:2796:in `pbStartBattleCore'
     
    Last edited:
    Back
    Top