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

[Scripting Question] Exclude Pokemon based on Pokedex ID and region

67
Posts
5
Years
    • Seen Jan 9, 2024
    I want to make a game where there are multiple regions to explore, but whenever a new region is unlocked I want to create a restriction that you cannot use Pokemon from a previous region until certain conditions are met. This way the game remains challenging and encourages the player to use new Pokemon. I was hoping to do this by indicating that:

    If you have a Pokemon say with an ID of 1-151 you cannot have it in your party within that region until you have met a condition. And also because you are entering a new region make it that all Pokemon in your party get transported to the PC. Kinda like starting over with a new starter, except you have other Pokemon, they just can't be taken out of the PC until a certain point or only if you're in the previous region.

    Let me know if you have an answer for this or if I should post this somewhere else.

    Thanks.

    Citcat17
     

    Sir_Tman

    Overworked game Dev
    201
    Posts
    8
    Years
  • Have a read around here https://essentialsdocs.fandom.com/wiki/Manipulating_Pokémon#Other_scripts

    Though before you can get help for this you need to refine what it is you need.
    Things you have to consider are:
    - preventing players from bringing their pokemon from old regions back via pc, so you would have to make multiple pc per region.(or have something that prevents them pulling a pokemon out of a pc that isn't in the region their in)

    - Are trainers allowed to have 1 pokemon from their old region or do they get a new one per region? (Keep in mind level balancing)

    - Do you forcefully remove their party or prevent them from traveling unless they deposit them back into the pc?
     
    87
    Posts
    7
    Years
    • Seen Nov 22, 2023
    I think the best way to do this is to disallow the trainer from removing a Pokemon from the PC if the Pokemon's internal ID is less than or equal to 151.
    Of course, this would only activate if a switch is on (which will be turned on when you arrive at the next region); this switch should also be turned off when arriving back at the original region.

    Similarly, the "guard" should check the internal IDs of all the Pokemon in your party to prevent the player from leaving the region with Kanto Pokemon.
    Of course, you can't leave with 0 Pokemon, so perhaps you could receive a Pokemon from another region after defeating the Elite Four.

    I don't believe a method exists to check if a Pokemon's ID is below a given value, so I created one.
    Paste this in PSystem_PokemonUtilities after def pbHasSpecies?(species), so like this (add the red part):
    Code:
    # Returns true if there is a Pokémon of the given species in the player's party.
    def pbHasSpecies?(species)
      if species.is_a?(String) || species.is_a?(Symbol)
        species = getID(PBSpecies,species)
      end
      for pokemon in $Trainer.pokemonParty
        return true if pokemon.species==species
      end
      return false
    end
    
    [COLOR="Red"]# Returns true if there is a Pokémon below or equal to the defined ID
    def pbBelowID?(pkmnID)
      species = getID(PBSpecies,species)
      for pokemon in $Trainer.pokemonParty
        return true if pokemon.species<=pkmnID
      end
      return false
    end[/COLOR]

    Then create a conditional branch, like so - this should be for the "guard."
    Exclude Pokemon based on Pokedex ID and region

    https://imgur.com/Cfu0EoR

    Use this conditional branch for the PC:
    Exclude Pokemon based on Pokedex ID and region

    https://imgur.com/GYbFS9y

    Note that the switch I used was called "JohtoRegionUnlocked."
    The PC will only disallow Kanto Pokemon to be taken out when that switch is on - so be sure to enable that switch upon arriving at the new region and disable it whenever you return to the original region.
    If you intend on doing this for multiple regions, perhaps you should use a variable instead.

    I don't think it's a good idea to have the Pokemon sent back to the PC because the player might not have any other Pokemon in their party.

    If you need more help or don't like this solution, let me know! :)
     
    Last edited:
    67
    Posts
    5
    Years
    • Seen Jan 9, 2024
    Thanks guys, funny enough I think I found something to make it really easy and that is to make an NPC or event prevent one from using Pokemon based on what map they were caught from. Found it randomly. Goes something like this:

    poke.obtainMap<=42

    So the person who posted this said that it will check for maps less than or equal to map ID 42. Anything other than that will stop the player and say that they have to reconfigure their party to only have that regions Pokemon.

    I was thinking that I could place this event right before exiting the lab where you get your new starter/before you leave the first town.

    What do you think? I haven't tested it yet, but do you think it's viable?

    Thanks again.
     
    87
    Posts
    7
    Years
    • Seen Nov 22, 2023
    Can you post the link?
    If you'd like, I can take a look and see if I can answer your question.

    P.S. If you delete a map, the next one you make might be below what you'd want it to be. Which can ruin what you want to do.
     
    Last edited:
    67
    Posts
    5
    Years
    • Seen Jan 9, 2024
    I'll see if I can find it again. I only took a screenshot of it...

    Real quick too if you don't mind can you tell me how to make an event check if you've obtained say 10 Pokémon? I already posted this under scripting questions but I thought I might ask here too..

    Thanks
     
    87
    Posts
    7
    Years
    • Seen Nov 22, 2023
    I've responded to that thread already! :)

    Let me know if you need help with scripting or conditional branches.
     
    67
    Posts
    5
    Years
    • Seen Jan 9, 2024
    Found it. It's in this thread. You have to scroll down though. Comment on this was made by "eboxiv"
    You have to search the thread... I'm not allowed to post links yet.

    The thread is called "Multiple Storage Systems"
     
    87
    Posts
    7
    Years
    • Seen Nov 22, 2023
    I think it might be doable but it's not the best way to do it.
    You'd have to make sure all of your maps are below a certain ID - or, the other way would be to include each and every single map, which is way more work and you could potentially end up forgetting to add a map.

    Have you considered my method?
    I've tested it on v17.2 and it works fine.
     
    67
    Posts
    5
    Years
    • Seen Jan 9, 2024
    Also I'm going to post another scripting help that asks about how to make a whirlpool and rock climb obstacle..
     
    67
    Posts
    5
    Years
    • Seen Jan 9, 2024
    Just had a thought. Will this coding check the region of the Pokémon upon using fly?
     
    87
    Posts
    7
    Years
    • Seen Nov 22, 2023
    Correct me if I'm wrong, but I'm certain that with the change of region, there'll also be a change of map so you can't actually fly from one region to another.
     
    Last edited:
    67
    Posts
    5
    Years
    • Seen Jan 9, 2024
    Hmm I'm not sure... is there a way to define different regions? I was just going to make more maps. Sorry still kinda new at these things. Maybe you can point me to how I can define regions?
     
    67
    Posts
    5
    Years
    • Seen Jan 9, 2024
    Cool thanks, I just happened to be looking at that page recently. I figured that's where my answer was (:
     
    Back
    Top