• Just a reminder that providing specifics on, sharing links to, or naming websites where ROMs can be accessed is against the rules. If your post has any of this information it will be removed.
  • Our friends from the Johto Times are hosting a favorite Pokémon poll - and we'd love for you to participate! Click here for information on how to vote for your favorites!
  • Scottie, Todd, Serena, Kris - which Pokémon protagonist is your favorite? Let us know by voting in our poll!
  • 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.

Battle Result Question

  • 66
    Posts
    12
    Years
    • Seen Nov 12, 2023
    Hey,

    after every Battle the games stores the result, right? (1-win, 2-loss, 3-escaped, 4-caught, 5-draw)

    How can I show the in a text/variable/conditional branch? (e.g. The Rival laughts about you because your last Pokémon escaped)
     
    By default, the game doesn't store the outcome of the most recent wild encounter nor the most recent trainer battle. It only stores when you define it needs to do so beforehand.
    (See https://pokemonessentials.wikia.com/wiki/Event_encounters)

    You'd have to modify the scripts if you want the game to always keep track of the most recent battle outcome in a global variable if you want the game to save results of random, non-scripted wild encounters.
    My guess would be manually saving different values to whichever variable you'd like to use in the PokeBattle_Battle script section.
     
    Wild battles DO store the outcome.

    For example if I need to know if this certain pokémon was captured or not:

    pbWildBattle(PBSpecies::MANECTRIC,45,37,true,false)
    #will store the battle outcome to variable 37
    Conditional branch: if Variable 37 == 4 #the pkm was captured
    Conditional branch: if Variable 37 == 2 #the player won the battle
    Conditional branch: if Variable 37 == 3 #Player or wild Pokémon ran from battle, or player forfeited the match

    Just have a look at how the method pbwildbattle works:

    def pbWildBattle(species,level,variable=nil,canescape=true,canlose=false)

    Of course it doesn't work for every wild battle, just the scripted ones, but if in your game your rival is close enough to comment on the battle outcome I believe this is a scripted event.
     
    Back
    Top