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

Finding A Pokemon

Nickalooose

--------------------
  • 1,309
    Posts
    17
    Years
    • Seen Dec 28, 2023
    Hello, I've been away for a while, but I'm somewhat back and working on my game.

    However, something has got me in a stump,

    How would I find a Pokémon that I own, whether it's in the box, my team, daycare... Well to cut this short, anywhere, as long as I own it... I'm trying to find a Pokémon to do things with.

    So let's say I need a Golem to help some NPC named Henry, climb a mountain, but Golem is stuck in the PC (in theory, the PC is the lab, right?), so I can say, "yes, borrow my Golem, Henry.". Then Golem comes out of nowhere and viola, there he is, even though he's not in my team... But, that's not my full problem, I want this Golem to have all my Golems traits, stats, EXP, attacks, abilities, etc.

    So if I were to team up with Henry, the double battles would show Golem exactly how I levelled him.

    But that's not all... Say Henry climbs this mountain and there is a girl name Rachel, who can ironically, teach rock types, specific moves (who'da thought.), Can I still access Golem?

    But that's not all... Writing this seems long compared to what I need lol... Let's say, as an illusion to this guy borrowing Golem, I wanted to grant Golem with extra experience, as if Henry used him in battle, can I access this?

    In theory, Golem would still be in my box, so I assume there is a way to access him there, and the battles (if I were to double battle with Henry), would just create a duplicate of Golem from there, right?

    All in all, I just want to access Pokémon, where ever they be hiding.

    Thanks for any replies, sorry it was such a long message :S
     
    Is there something preventing you from accessing storage/Day Care which means you have to magically teleport a Pokémon from there to Henry?

    It sounds like you're thinking too hard about it. Just restrict it to searching the player's party, and preferably let the player choose the Pokémon themselves rather than have it automatically taken away (not asking the player before mucking with their Pokémon is just rude).
     
    I'm trying to edit a Pokémon that I don't have in my team... In theory... I just kinda hoped there was a script to check a Pokémon owned, like as you say say, for the party, but for the other things... I know I could probably force that specific Pokémon from the box to my team, edit it, then force it back, but that seems a little long winded, and could potentially become complicated.

    A little more information might help you, I only want ONE, of every Pokémon to be owned... So I won't be having a 6 man team of Golem, I will only own the 1.

    @Saving Raven, you are right, but I'm trying to avoid the whole swapping of Pokémon situation.
     
    I've written a simple function that will search for a certain species in PC boxes and return an array of all pokemon
    of that species. Someone please confirm, but I think that modifying this returned pokemon (giving it exp.,moves,etc)
    will "modify" it in the box, since the function returns references to the pokemon, and not copies.

    Code:
    def findPokemon(species)
      ret = []
      for box in $PokemonStorage.boxes
        for pokemon in box.pokemon
          if pokemon && pokemon.species == species
            ret.push(pokemon)
          end
        end
      end
      return ret
    end

    Does this help?
     
    OMG! Yes it does, so to question this:

    If I had 2 MUK for example and I wanted to only teach one of them TOXIC, can I do that?
     
    OMG! Yes it does, so to question this:

    If I had 2 MUK for example and I wanted to only teach one of them TOXIC, can I do that?

    Yeah, since the function returns an array, you'll have to choose in the beginning which Muk you want to pick from the
    box. So when your event asks you for a Muk, you'll get an array (if there's more than 1 in the boxes), and then you can
    select one of them with another method for selecting pokemon. If it's not important which Muk will get chosen, you
    can select a random one from the array, but in any case, only 1 will learn moves.
     
    Well, so far, it's not giving me anything back, so, I added a message line, and the message repeats over and over... I'll keep looking, do you have any insight?
     
    Well, so far, it's not giving me anything back, so, I added a message line, and the message repeats over and over... I'll keep looking, do you have any insight?

    Message line in the for loop? I think it goes over all box slots, so there will be a lot of messages. Print only the result
    of the function. I've tested it with 1 charmander and 1 pidgey in the pc, and I set up an event like this.

    Code:
    poke = findPokemon(PBSpecies::PIDGEY)
    p(poke)

    And it returned an array with one pidgey. Try it like that
     
    I see what you're saying, I've looked over the code and I don't see any way for it to count how many Pokémon it finds, or at least I'm not seeing it, I printed everything in your code to see what it's doing and Pokémon and ret are returning a PokéBattle_Pokemon, object, using "p" to print what it's doing is all well, but my problem unfortunately, is still the same, I can now find the Pokémon I am looking for and I can find out what Pokémon I'm looking at in what specific box number, but, this code finds that Pokémon, then gives up looking, despite there being more, I added lot's to see if it works and it always picks up the first Pokémon, which in this case, is box 1.

    So I'm not quite sure how I can choose from an array, when it only picks up 1 Pokémon?

    I'm starting to understand and your code is helping me lot's, I just need these little tweaks and it's perfect.
     
    Hmm, okay, I've tested it with two Pidgeys now : ) both in the first box, and it returns both in the array.
    It doesn't give up after the first, that's the whole idea. It runs through all the pokemon
    and pushes the correct ones in the array that will be returned in the end.

    I've added one more line to the event to make the print better.

    Code:
    poke = findPokemon(PBSpecies::PIDGEY)
    [B]poke.map!{|p| p.name}[/B]
    p(poke)

    This will make the array contain only names of the pokemon. Make sure you have more than one of
    those species in the boxes. Other things really should work, try giving it one more test.

    And, poke.length will tell you how many pokemon there are in the returned array.
     
    Okay, thanks, I'll try this now... I don't know why it only recorded 1... Especially as I owned 5 at the time lol, the wonders of pbAddPokemonSilent haha, I'll try some more and see what I get :)
     
    I'm thinking....conceptualy, if you need to modify just a pokemon, let's just say a special pokemon, counldn't you just make a script, that give you that pokemon, and give him a switch, so that every time you want to modify him, you force the switch on.
     
    Yeah, I'm trying to do something like that, it's the locating that Pokémon part I'm having the problems with lol
     
    well, why do you need it? If you have a script that stores golem stat (and other things) like variables, you will able to change them wherever he is.
    and move him....hopefully. lol
     
    I'll repeat my earlier question:

    Is there something preventing you from accessing storage/Day Care which means you have to magically teleport a Pokémon from there to Henry?
    Why go to all the effort of figuring out how to extract Pokémon from some arbitrary storage box, when you could instead just hand over a Pokémon from your party? Would it be impossible to change your party between finding out Henry wants a Golem and the point when you hand it over?

    It sounds like you're overthinking this scenario of yours.
     
    My question is legit, I assure you.
    Because I don't want to give Henry any Pokémon in my team, if I don't have him/them in my team, if I do, then happy days, but what I'm trying to do, is essentially, make Pokémon in the box editable.

    Nothing is preventing me from using the storage/daycare, but I don't want to call the storage screen, I wanted to find this Pokémon as if Henry asked me "Do you have Golem? I need 2 to complete my task... Can I use them?" Then call Prof. Oak, your rival, I dunno, then poof, my 2 Golem that were in the box, comes running into the screen and are happy to help.

    However, with Stochastic's help, I can now locate them, just need to figure out how to edit them.

    Yes @Darunda, since I can locate my hiding Pokémon, I need to now figure out how to save their stats (individually of course) to a set of arrays, so if I wanted 1 of my 2 Golems to learn something special whilst Henry owns them, I can manipulate them any way I please, for example:

    Golem 1 and Golem 2, helps, Golem 1 carrys Henry, where Golem 2 clears the path.

    Here in this example, I am holding neither of these Golem, but Golem 2 could potentially learn DIG, and Golem 1 can potentially gain a strength increase (Attack and Speed, or something) plus earn them selves some experience.


    SOLVED: Thanks to Stochastics for help on this problem.
     
    Last edited:
    Back
    Top