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

Battle Result Question

  • 68
    Posts
    11
    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)
     
  • 25
    Posts
    7
    Years
    • Seen Apr 20, 2017
    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.
     

    Telemetius

    Tele*
  • 267
    Posts
    9
    Years
    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