• 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] How do i do a Trade with special condition?

80
Posts
4
Years
  • Age 24
  • 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
 

WolfPP

Spriter/ Pixel Artist
1,309
Posts
5
Years
I think you need to create some def for that. Chrck how pbchoose works and make one for ice type.
 
1,677
Posts
8
Years
  • Age 23
  • Seen today
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