• 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.
  • 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!
  • Scottie, Todd, Serena, Kris - which Pokémon protagonist is your favorite? Let us know by voting in our poll!
  • 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.

Loot item/money from Pokemon

  • 7
    Posts
    8
    Years
    • Seen May 8, 2017
    I've been playing with RPG Maker XP for about a week, so I'm pretty noob. Gotten a real headache trying to figure this one out..

    What I want to do is:

    After you defeat a Pokemon (the ones who walk around that you create from the event page), you will receive an item or cash, preferably at random.

    I did manage to create an event that gives an item after the battle, but it still gave the item when I was defeated. It needs to be able to see if I won the battle or lost the battle. If you lose, you get nothing, of course.

    Appreciate anyone trying to help!
     
    Basically nothing. So far I made an event, chosen a Pokemon sprite and made it walk around randomly.
    Then I added the line "pbWildBattle(:PIKACHU,42)" to make it go into battle when I interact with the event.

    Then I added the line "Kernel.pbReceiveItem(PBItems::POTION)"

    After that I have tried several things to try make it so you only get the potion if you win the battle.
     
    Basically nothing. So far I made an event, chosen a Pokemon sprite and made it walk around randomly.
    Then I added the line "pbWildBattle(:PIKACHU,42)" to make it go into battle when I interact with the event.

    Then I added the line "Kernel.pbReceiveItem(PBItems::POTION)"

    After that I have tried several things to try make it so you only get the potion if you win the battle.

    Here is a thread with some information about how the battle result is stored. You can use this to determine whether a battle is won or lost. You then need to generate a random number between 1 and yournumber (pbRandom(yournumber)) which starts at 0 and excludes the last number. You need to then give the player a random amount of money (or set if this is what you want) when it's equal to 0 or 1, for example (this would be a 20% chance when doing "pbRandom(10)"). If it's not, you need to iterate through all existing items in the PBS. I'm not sure if this works, but you can at least try:
    Code:
    Kernel.pbReceiveItem(pbRandom(PBItems.maxValue))
     
    Here[/URL] is a thread with some information about how the battle result is stored. You can use this to determine whether a battle is won or lost. You then need to generate a random number between 1 and yournumber (pbRandom(yournumber)) which starts at 0 and excludes the last number. You need to then give the player a random amount of money (or set if this is what you want) when it's equal to 0 or 1, for example (this would be a 20% chance when doing "pbRandom(10)"). If it's not, you need to iterate through all existing items in the PBS. I'm not sure if this works, but you can at least try:
    Code:
    Kernel.pbReceiveItem(pbRandom(PBItems.maxValue))
    Thanks, but I cannot grasp this, I really do try, but I think I'll need an example on how to set it up.
     
    I still haven't got an answer to this. Ugh, really wouldn't think it would be this hard to figure out lol.
     
    Back
    Top