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

Choosing an item and then...

132
Posts
9
Years
  • So I've used this script in an event: pbChooseItemFromList(_I("Choose an item"),1,:POTION,:REPEL,:POKEBALL)...

    Now what?

    If I want the outcome of choosing a potion to be dissimilar from choosing a repel, how do I do that? I'm guessing make a c-branch and use the global variable "1" somehow. Or pbGet(1)? pbGet(1)==POTION? I'm stumped.
     

    Maruno

    Lead Dev of Pokémon Essentials
    5,286
    Posts
    16
    Years
    • Seen May 3, 2024
    Are you aware that Essentials comes with a set of maps already in it? Maps which contain examples of many things, including two separate examples that use pbChooseItemFromList (Kurt and the fossil reviver). Or did you know that there is an Essentials wiki?
     
    132
    Posts
    9
    Years
  • Are you aware that Essentials comes with a set of maps already in it? Maps which contain examples of many things, including two separate examples that use pbChooseItemFromList (Kurt and the fossil reviver). Or did you know that there is an Essentials wiki?

    Don't be such a sassypants! My fault for not having clarified that I'm not trying to revive a fossil or do anything with apricorns. I simply want to have outcome A if the player chooses a potion, and outcome B if the player chooses a repel. Kurt and the fossil reviver use specific variables, "apricorn being converted" and "fossil being revived," and while the wiki does explain how to allow the player to choose items, it doesn't say, well, anything after that. "Congrats, you chose an item." From looking over Kurt and the fossil reviver and the wiki (again), I learned (again) 1, how to choose an item, 2, how to delete said item, and 3, how to return the name of said item. None of which answers my question. I'll find some other way though.
     

    Maruno

    Lead Dev of Pokémon Essentials
    5,286
    Posts
    16
    Years
    • Seen May 3, 2024
    Wiki said:
    To make the player choose from a specific list of items, use the following script:
    Code:
    pbChooseItemFromList(_I("Choose an item"),1,:POTION,:REPEL,:POKEBALL)
    This method returns the ID of the chosen item, or -1 if the choice was cancelled. The second argument (the number 1 here) is the Global Variable in which the returned value is stored (in addition to returning the value).

    Any number of items can be listed. Only items which the player has at least 1 of will appear in the list. If the player has none of the listed items, then the method will immediately return/store 0 without displaying the message or listing anything.
    I'd like to know which part of this explanation you find so vexing. The example usage here shows that you have text, a number, and a list of items. The wiki clearly tells you what the number is (a Global Variable), and what exactly is stored in it (the chosen item's ID, or -1 if cancelled).

    From there, it's almost trivial to check which item the player chose. Was it a Potion? Use a Conditional Branch with the script pbGet(8)==PBItems::POTION in it. Was it a Repel? Use a Conditional Branch with the script pbGet(8)==PBItems::REPEL in it. And so on. You should know how to make a few Conditional Branches.
     

    Nickalooose

    --------------------
    1,309
    Posts
    16
    Years
    • Seen Dec 28, 2023
    Woah there Woah... Maruno has his ways to reply, be it harsh sometimes, but he gives you the answer nonetheless... Just remember that pbGet(8) is the equivalent to $game_variables[8] or just straight up, variable number 8... Make sure the pbGet(x) is the same number as the x in this pbChooseItemFromList(_I("Choose an item"),x,:POTION,:REPEL,:POKEBALL)
     
    Back
    Top