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

[Custom Feature Question] Evolving with Linking Cord while holding an Item

36
Posts
4
Years
    • Seen yesterday
    Hi!

    I'm working on a fangame, and I'm trying to remove (or semi-push aside) the need for evolving Pokémon through trading, the same way the Linking Cord did it in Legends Arceus. And while this isn't a problem to do in most cases, since most Pokémon only has one Trade Evolution (like how Poliwhirl becomes Poliwrath with a Water Stone, but if traded while holding a King's Rock, it will become Politoed), I now realize that I've run into a problem for the last few that do have more than one (i.e. Clamperl evolving into either Gorebyss or Huntail while trading while holding specific items)

    I have no plans to really include Clamperl, so I could just ignore and make it the one exception.

    However, the completionist inside me demands that I do all of them right.


    So can I set up an evolution method that would make a Pokémon capable of evolving when using a Linking Cord, but ONLY while also holding a specific item?

    Is this possible, and if so, how would I go about that?
     
    1,682
    Posts
    8
    Years
    • Seen May 16, 2024
    So the annoying thing is you can only check one thing at a time with the parameter.
    You didn't post your current code. Or what version you're on. I have a v20 sandbox project already set up, so you're getting v20 code.

    Here's a new LinkingCord evo type for consistency between the no item and held item variants
    Code:
    GameData::Evolution.register({
      :id            => :LinkingCord,
      :use_item_proc => proc { |pkmn, parameter, item|
        next item == :LINKINGCORD
      }
    })
    GameData::Evolution.register({
      :id            => :LinkingCordHeldItem,
      :parameter     => :Item,
      :use_item_proc => proc { |pkmn, parameter, item|
        next item == :LINKINGCORD && pkmn.item == parameter
      },
      :after_evolution_proc => proc { |pkmn, new_species, parameter, evo_species|
        next false if evo_species != new_species || !pkmn.hasItem?(parameter)
        pkmn.item = nil   # Item is now consumed
        next true
      }
    })
     
    Back
    Top