• 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!
  • It's time to vote for your favorite Pokémon Battle Revolution protagonist in our new weekly protagonist poll! Click here to cast your vote and let us know which PBR protagonist you like most.
  • 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] How do i do a Trade with special condition?

  • 80
    Posts
    6
    Years
    • Seen Nov 5, 2023
    I want to do a Trade thats like:
    Any Ice type for a Trubbish
    But wherever i go i not find any data on how to do it?

    So please tell me which spript i need when i want to select any Ice Type to trade it
     
    I think you need to create some def for that. Chrck how pbchoose works and make one for ice type.
     
    There's an example in the Pokemon Fan Club map in the example maps that come with Essentials. It does require using a different method though: pbChooseTradablePokemon (Actually the method in the script is mistyped, so the included example crashes. There's an extra e.)
    This is the one that appears on that map
    Code:
    pbChooseTrad[COLOR="Red"][B][U]e[/U][/B][/COLOR]ablePokemon(1,2,
    proc {|pkmn|
     pkmn.isFemale? &&
     isConst?(pkmn.species,PBSpecies,
        :DRAGONAIR)
    })

    The code takes 4 arguments, but you'll only need the first 3. The first two arguments are the same as pbChoosePokemonForTrade, the party index and party member name variable numbers, but the third is where we get fancy! It's a proc that takes a pokemon object and spits out true or false depending on its requirements. The example proc is a female Dragonair, but you have different requirements, any ice type pokemon. So our proc will look different.
    Code:
    proc {|pkmn| pkmn.hasType?(:ICE)}
    That's it! If it has at least 1 ice type, it'll be allowed to trade.

    The fourth argument is a true/false, for if the selection will allow pokemon that don't match the requirements to be chosen.
     
    Last edited:
    Back
    Top