• 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.
  • Ever thought it'd be cool to have your art, writing, or challenge runs featured on PokéCommunity? Click here for info - we'd love to spotlight your work!
  • Our weekly protagonist poll is now up! Vote for your favorite Trading Card Game 2 protagonist in the poll by clicking here.
  • 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.

[Eventing Question] Give a random quantity of an item chosen randomly from a pool of items

  • 68
    Posts
    6
    Years
    • Seen Aug 25, 2023
    Hi!

    Well, I was trying to implement some sort of materials gathering and item crafting for my game and I wanted, for example: when you break a rock you can get some ores, stones and that. But i wanted it to be random and no lineal, an example for the example xd: You break one rock and you get 2 Copper ores, 1 Iron Ore, 1 Silver ore. You break another rock and you get 1 Copper, 3 iron, 1 silver, you break another and you get 2 copper, 1 iron and 2 silver... And so on.

    Firstly i started with conditional branch and they worked pretty well, but that way was son long, hard, awful and annoying that i gave up... Then i was searching in google and I found this: https://www.pokecommunity.com/threads/415258

    That post is pretty close for what i want but, it always gives just one item and for a quantity of one, i mean: If i break a rock i get 1 copper or 1 silver, or 1 iron, but never 2 copper, or 3 copper. So, i was wondering if is possible to make something like what was made in that post, but making it gives a random quantity of a random pool of items.

    Thanks!
     
    Shouldn't be too hard to event in essentials, though it may require some funky variable definitions regarding how you set it up. I dunno about the randomization of the item, which may be a bit more complex. I tried to run thepbKernalRecieveIem(:ITEM,amount) with a new randomized game variable within the event and have it spit the variable out in the array, but it didn't work...

    so I fear there is a really chunky method but it works and may take forever to fully program.

    [PokeCommunity.com] Give a random quantity of an item chosen randomly from a pool of items


    I've defined two game variables 98 and 99. I've defined 98 to be the item assciated with each number called by var 98 and the number for each will be 99. You need to include that many number of GetItemScript for literally every possibility... So if you have three items and three different amounts that's 9 different get-item scripts you'll need to include in your event!
     
    Hey LuisMRL, I moved your post to the Pokemon Essentials forum, because it's a question about Essentials based off the linked thread you reference.

    By the way Kernel.pbReceiveItem takes 2 arguments. The first, from the thread is the random item, the second is the random amount you give. Using rand(qty)+1 gives you 1 to qty items.

    ...that's much simpler. didn't know you could just plop a rand in the script argument
     
    Back
    Top