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

How can you make an item reward random?

13
Posts
8
Years
    • Seen Dec 23, 2015
    Hi guys, as you knwo from my toher posts I'm pretty new to pokemon essentials and I was wondering if there's a way to make a reward random generated (or random froma list), I mean, for example, a guy asked me to bring him a potion, then when I give it to him it can give me a pokeball, or a berryjuice, or something else random. Is there a way to make a reward random generated or randomly picked from a preselected list? I have been trying with variables and switches but my programming skills seems to be as good as a jellyfish ones. Thanks in advance guys :D.
     
    13
    Posts
    8
    Years
    • Seen Dec 23, 2015
    Excuse my ignorance... but... what? lol, I cannot understand a single line of what you said. By the way, thanks a lot man!
     
    824
    Posts
    8
    Years
  • Excuse my ignorance... but... what? lol, I cannot understand a single line of what you said. By the way, thanks a lot man!

    The first line, you place all the possible rewards into an array. Those are "symbol characters" that are the items' internal names.
    The second line randomly chooses from the array. This is like picking a name from a hat.
    The last line converts from a symbol to a number, because items are actually stored as numbers.
     
    13
    Posts
    8
    Years
    • Seen Dec 23, 2015
    The first line, you place all the possible rewards into an array. Those are "symbol characters" that are the items' internal names.
    The second line randomly chooses from the array. This is like picking a name from a hat.
    The last line converts from a symbol to a number, because items are actually stored as numbers.

    I see... Thanks a lot man, really! thanks for taking a bit of your time on cleanse my stupideness lol.
     
    53
    Posts
    8
    Years
  • There is an alternative, which requires a little more "effort", just for the record:

    You let the event generate a random number with any variable you like (you could make a "RNG Variable" or whatever). And then you make a conditional branch for every item, you want to be generated.

    Example:
    Spoiler:


    Works just as fine. Only needs a little more writing.
    Just wanted to mention it. For the record.

    PS: If this is for an NPC to give you a random item, change "Kernel.pbItemBall" to "Kernel.pbReceiveItem".

    PPS: You can easily do this with Pokémon as well or even both. And you can also let the NPC say something different for every item/Pokémon you receive.
    Just exchange Kernel.pbItemBall(PBItems::INTERNALITEMNAME) with pbAddPokemon(PBSpecies::INTERNALPOKEMONNAME,POKEMONLEVEL) and add a textbox :)
     
    Last edited:
    13
    Posts
    8
    Years
    • Seen Dec 23, 2015
    There is an alternative, which requires a little more "effort", just for the record:

    You let the event generate a random number with any variable you like (you could make a "RNG Variable" or whatever). And then you make a conditional branch for every item, you want to be generated.

    Example:
    Spoiler:


    Works just as fine. Only needs a little more writing.
    Just wanted to mention it. For the record.

    PS: If this is for an NPC to give you a random item, change "Kernel.pbItemBall" to "Kernel.pbReceiveItem".

    PPS: You can easily do this with Pokémon as well or even both. And you can also let the NPC say something different for every item/Pokémon you receive.
    Just exchange Kernel.pbItemBall(PBItems::INTERNALITEMNAME) with pbAddPokemon(PBSpecies::INTERNALPOKEMONNAME,POKEMONLEVEL) and add a textbox :)

    WOW!! Amazing reply man, while both methods works I'm doing this one for sure. Thanks guys, really, you helped me a lot! :D
     
    Back
    Top