• 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] Double Battles even if Player only has one Pokemon?

34
Posts
4
Years
    • Seen Apr 27, 2024
    Hey there, I basically want to achieve a style of game not unlike Pokemon Colusseum. To do that, I need to somehow modify the script to do this one thing that eludes me: all trainers would be double battles, even if the player only has one avaliable Pokemon. Now, it sounds real simple but I have no idea where to start; Googling has given no results. If anyone has any insight, that would be brilliant!

    Sidenote: this community is endlessly helpful for one starting out, it's the best!
     
    1,403
    Posts
    10
    Years
    • Seen Apr 29, 2024
    It's got to be pretty easy since you can go to a 1v2 from a 2v2 by getting your Pokémon KOed. I guess you should look into the code that checks if the player is in a trainer's line of sight? Seems like the most likely place for the "has enough Pokémon" check to occur.
     
    Last edited:
    34
    Posts
    4
    Years
    • Seen Apr 27, 2024
    I think it might be in this section:

    def pbDoubleBattleAllowed?
    return false if !@fullparty1 && @party1.length>MAXPARTYSIZE
    return false if !@fullparty2 && @party2.length>MAXPARTYSIZE
    _opponent=@opponent
    _player=@player
    # Wild battle
    if !_opponent
    if @party2.length==1
    return false
    elsif @party2.length==2
    return true
    else
    return false
    end
    # Trainer battle
    else
    if _opponent.is_a?(Array)
    if _opponent.length==1
    _opponent=_opponent[0]
    elsif _opponent.length!=2
    return false
    end
    end
    _player=_player
    if _player.is_a?(Array)
    if _player.length==1
    _player=_player[0]
    elsif _player.length!=2
    return false
    end
    end
    if _opponent.is_a?(Array)
    sendout1=pbFindNextUnfainted(@party2,0,pbSecondPartyBegin(1))
    sendout2=pbFindNextUnfainted(@party2,pbSecondPartyBegin(1))
    return false if sendout1<0 || sendout2<0
    else
    sendout1=pbFindNextUnfainted(@party2,0)
    sendout2=pbFindNextUnfainted(@party2,sendout1+1)
    return false if sendout1<0 || sendout2<0
    end
    end
    if _player.is_a?(Array)
    sendout1=pbFindNextUnfainted(@party1,0,pbSecondPartyBegin(0))
    sendout2=pbFindNextUnfainted(@party1,pbSecondPartyBegin(0))
    return false if sendout1<0 || sendout2<0
    else
    sendout1=pbFindNextUnfainted(@party1,0)
    sendout2=pbFindNextUnfainted(@party1,sendout1+1)
    return false if sendout1<0 || sendout2<0
    end
    return true
    end

    But again, I'm unsure what exactly I would have to change
     
    1,403
    Posts
    10
    Years
    • Seen Apr 29, 2024
    Right, so if we return false that means that the double battle isn't allowed. So you just need to find all the check related to the player having too few Pokémon and get rid of them or make them return true (which might cause errors in a different part of the code if that part assumes that there will be at least two Pokémon, but you can tackle that if it happens).
     
    Last edited:
    34
    Posts
    4
    Years
    • Seen Apr 27, 2024
    ---------------------------
    Pokemon Essentials
    ---------------------------
    [Pokémon Essentials version 17.2]

    Exception: RuntimeError

    Message: Opponent trainer must be only one person in single battles

    PokeBattle_Battle:2442:in `pbStartBattleCore'

    PokeBattle_Battle:2345:in `pbStartBattle'

    PField_Battles:373:in `pbDoubleTrainerBattle'

    PField_Battles:372:in `pbSceneStandby'

    PField_Battles:374:in `pbDoubleTrainerBattle'

    PField_Battles:371:in `pbBattleAnimation'

    PField_Battles:371:in `pbDoubleTrainerBattle'

    Debug_Menu:342:in `pbDebugMenuActions'

    Debug_Menu:744:in `pbDebugMenu'

    Debug_Menu:710:in `loop'



    This exception was logged in

    C:\Users\MSI\Saved Games\Pokemon Essentials\errorlog.txt.

    Press Ctrl+C to copy this message to the clipboard.
    ---------------------------

    I got this far,but it seems that there's a lot that would need to be changed aha. Maybe it's a dream suited for a much more skilled coder.
     
    1,403
    Posts
    10
    Years
    • Seen Apr 29, 2024
    Oh I see, it tries to put you into a single battle (presumably because you've only got one Pokémon). You can probably find that logic and change it too, if you like (try searching for that message). If nothing else it's a good way to learn a lot more about coding :D
     

    WolfPP

    Spriter/ Pixel Artist
    1,309
    Posts
    5
    Years
  • I think is better you wait for v18 to make something like that. Maruno are doing a better code to make triple battle and maybe will add for 1 vs 2 (like SOS Battle i.e.).
     
    Back
    Top