• 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.
  • Dawn, Gloria, Juliana, or Summer - which Pokémon protagonist is your favorite? Let us know by voting in our poll!
  • 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!
  • 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.

[Script] Trainerbattle command

  • 20
    Posts
    6
    Years
    • Seen Jul 16, 2019
    Hello folks im trying to use the trainerbattle command in a specific way,
    I will spare you the Details its just 3 consecutive Battles out of a pool of 5 possible Trainers.

    Im thinking that LASTRESULT should behave like a variable, because it is.
    Is it possible to store the Value of a Trainerbattle in this Variables and execute
    a Trainerbattle with it?

    what im doing is using the command random to give me a number between 1-5
    Code:
    #org @roll1
    random 0x4
    compare LASTRESULT 0x0
    if 0x1 goto @1
    compare LASTRESULT 0x1
    if 0x1 goto @2
    compare LASTRESULT 0x2
    if 0x1 goto @3
    compare LASTRESULT 0x3
    if 0x1 goto @4
    compare LASTRESULT 0x4
    if 0x1 goto @5
    then I let the number decide wich trainerbattle the script should execute.

    What Im trying here is to store the Values of my trainerbattles in LASTRESULT. I think my Problem is this exactly, Im thinking that LASTRESULT cant Point to Trainerflags,
    Code:
    #org @1
    setvar LASTRESULT 0x00A
    goto @applybattle1
    #org @2
    setvar LASTRESULT 0x00B
    goto @applybattle1
    #org @3
    setvar LASTRESULT 0x00C
    goto @applybattle1
    #org @4
    setvar LASTRESULT 0x00D
    goto @applybattle1
    #org @5
    setvar LASTRESULT 0x00E
    goto @applybattle1


    This is the part where I try to apply a Trainerbattle to the Value stored in LASTRESULT
    Whenever I start a Battle I get a glitched out Trainer without Pokemon
    Code:
    #org @applybattle1
    trainerbattle 0x2 LASTRESULT 0x0 @Challenge @Win @roll2
    
    #org @applybattle2
    trainerbattle 0x2 LASTRESULT 0x0 @Challenge @Win @roll3
    
    #org @applybattle3
    trainerbattle 0x2 LASTRESULT 0x0 @Challenge @Win @finish
     
    Back
    Top