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

Wonder Trade (offline) v1.2

Black Eternity

Lord of Eternity
57
Posts
11
Years
    • Seen Jun 30, 2016
    To copy this script without any errors, go to Thread Tools and select, Show Printable Version.

    Spoiler:


    v1.2 Changelog 11/13/14
    Replaced mej71 hardobtain with his own rareness check
    Added parameter for rareness

    v1.1 Changelog
    Fixed typos
    Hard Obtain function added by mej71
    Small bug fixes by mej71
     
    Last edited:
    18
    Posts
    9
    Years
    • Seen Aug 28, 2016
    It is currently bugging up for me :(
    i . gyazo . com/bee70bcb035be5f810e258000d562570 is a picture of my event.

    Spoiler:
     
    1,224
    Posts
    10
    Years
  • It is currently bugging up for me :(
    i . gyazo . com/bee70bcb035be5f810e258000d562570 is a picture of my event.

    Spoiler:

    *pbWonderTrade

    capitalization is important
     
    1,224
    Posts
    10
    Years
  • Spoiler:


    Quick note, your example
    Code:
    pbWonderTrade(40,[:SQUIRTLE,:CHARMANDER,[COLOR="Red"];[/COLOR]BULBASAUR],[:MEWTWO,[COLOR="red"];[/COLOR]MEW,[COLOR="red"];[/COLOR]DEOXYS])
    is incorrect. The red highlighted parts should be colons instead of semicolons. It will return a syntax error when used, and if it were to somehow pass that it would still error out because getID(PBSpecies,;MEWTWO) is incorrect syntax.

    Another suggestion has nothing to do with your script, and is just a preference of mine, but something I noticed while using it. In the trade scene (PokemonTrading , lines 153), def pbTrade should be changed to this

    Code:
    def pbTrade
        pbBGMStop()
        pbPlayCry(@pokemon)
        speciesname1=PBSpecies.getName(@pokemon.species)
        speciesname2=PBSpecies.getName(@pokemon2.species)
        Kernel.pbMessageDisplay(@sprites["msgwindow"],
           _ISPRINTF("{1:s}\r\nID: {2:05d}   OT: {3:s}\\wtnp[0]",
           @pokemon.name,@pokemon.publicID,@pokemon.ot))
        Kernel.pbMessageWaitForInput(@sprites["msgwindow"],100,true)
        pbPlayDecisionSE()
        pbScene1
        Kernel.pbMessageDisplay(@sprites["msgwindow"],
           _INTL("For {1}'s {2},\r\n{3} sends {4}.\1",@trader1,speciesname1,@trader2,speciesname2))
        Kernel.pbMessageDisplay(@sprites["msgwindow"],
           _INTL("{1} bids farewell to {2} [COLOR="red"]the {3}[/COLOR].",@trader2,[COLOR="red"]@pokemon2.name,speciesname2[/COLOR]))
        pbScene2
        Kernel.pbMessageDisplay(@sprites["msgwindow"],
           _ISPRINTF("{1:s}\r\nID: {2:05d}   OT: {3:s}\1",
           @pokemon2.name,@pokemon2.publicID,@pokemon2.ot))
        Kernel.pbMessageDisplay(@sprites["msgwindow"],
           _INTL("Take good care of {1}.",[COLOR="red"]@pokemon2.name[/COLOR]))
      end

    Changed parts are in red. This is purely a preference, but it makes trades seem more personal for the other trainer.

    This is a nice script btw.
     

    Black Eternity

    Lord of Eternity
    57
    Posts
    11
    Years
    • Seen Jun 30, 2016
    Hi mej71, thank you for noticing the small typos I have made,
    I will correct them.

    And I do enjoy your suggestion for pbTrade.

    If you have any more suggestions for the script please let me
    know as I am always open to constructive criticism.
    Thanks for testing it out.

    I plan on adding more features in the near future, but those will wait until I sort out all
    possible bugs in the basic version.
     
    Last edited:
    1,224
    Posts
    10
    Years
  • Hi mej71, thank you for noticing the small typos I have made,
    I will correct them.

    And I do enjoy your suggestion for pbTrade.

    If you have any more suggestions for the script please let me
    know as I am always open to constructive criticism.
    Thanks for testing it out.

    I plan on adding more features in the near future, but those will wait until I sort out all
    possible bugs in the basic version.

    I added a small feature which allows you to hardcode pokemon that should be more difficult to obtain but possible. Without blacklisting any pokemon, there is about a 7% chance you will get a legendary. With this you can reduce that chance to 1% (you can reduce it farther with some minor tweaking) if you want anything to be obtainable, but not too easy. Highlighted additions in red

    Spoiler:

    You'll also notice I moved the except+=[] line (highlighted blue). Where it was, if you were to hardcode any exception pokemon it wouldn't have any effect, because it was occurring after you picked your pokemon.

    Edit: Highlighted in green is something to make the exception of what you're trading work (disallowing your player to pick his Charmander or whatever).
     
    Last edited:

    Black Eternity

    Lord of Eternity
    57
    Posts
    11
    Years
    • Seen Jun 30, 2016
    I added a small feature which allows you to hardcode pokemon that should be more difficult to obtain but possible. Without blacklisting any pokemon, there is about a 7% chance you will get a legendary. With this you can reduce that chance to 1% (you can reduce it farther with some minor tweaking) if you want anything to be obtainable, but not too easy. Highlighted additions in red

    Spoiler:

    You'll also notice I moved the except+=[] line (highlighted blue). Where it was, if you were to hardcode any exception pokemon it wouldn't have any effect, because it was occurring after you picked your pokemon.

    Edit: Highlighted in green is something to make the exception of what you're trading work (disallowing your player to pick his Charmander or whatever).

    Good catch, didnt pay attention to except=[] location.
    And nice addition to hardobtain, I added your updates to the OP.
    Thanks
     

    Maruno

    Lead Dev of Pokémon Essentials
    5,286
    Posts
    16
    Years
    • Seen yesterday
    Couldn't you have used the capture rates to decide how common each species is? And then just implement a blacklist for the Pokémon you don't want at all to be in there?
     

    Zeak6464

    Zeak #3205 - Discord
    1,101
    Posts
    11
    Years
  • So the only time i get an error is when i used it in PokeGear.

    After i received a pokemon it throws out an error at me ...
     

    Zeak6464

    Zeak #3205 - Discord
    1,101
    Posts
    11
    Years
  • Which error do you get? We can't help you without more information =P

    sYvDj.jpg
     

    Black Eternity

    Lord of Eternity
    57
    Posts
    11
    Years
    • Seen Jun 30, 2016
    This error is not pertaining to the WonderTrade script, it looks more like there is an
    issue with however you are calling the a scene with PokeGear.

    I have been testing this extensively over the past couple days.
    I call the function by using a simple mouse click in my own "PokeGear"

    It should also be noted, that WonderTrade is not its own "scene"
    you can call this code using any event by just "pbWonderTrade(1,[],[],15)"
    or any other parameters you desire.

    Code:
    if $mouse.pbMouseLeftClick?(@sprites["wonder"])
    	pbWonderTrade(40,[],[])
    end
     

    Zeak6464

    Zeak #3205 - Discord
    1,101
    Posts
    11
    Years
  • Yeah i fixed it
    i had "Scene =" so i just removed that and it worked in the PokeGear
     
    12
    Posts
    9
    Years
  • I just get an error when i start the game

    Script "wondertrade" line 260:SyntaxError occurred.

    when i delete this line i get the same at the line 284

    any ideas?
     

    Black Eternity

    Lord of Eternity
    57
    Posts
    11
    Years
    • Seen Jun 30, 2016
    I just get an error when i start the game

    Script "wondertrade" line 260:SyntaxError occurred.

    when i delete this line i get the same at the line 284

    any ideas?

    Make sure you copy the script from printable.
    Click "Thread Tools" > "Show Printable Version"
    If that does not solve any error, post back and let me know.
     

    Bowlstir

    Media Arts and Game Development
    199
    Posts
    16
    Years
  • Thanks, it works perfectly.

    The only thing I had to do was to change the calling script. (Capitalized the 'T' in Trade)
     
    1
    Posts
    9
    Years
    • Seen Oct 21, 2014
    Hello Hello,
    thanks for this script. Its working fine for me.

    But ive 2-3 Questions...

    First:
    Is it possible to open the save screen inside the script so it cannot get abused?
    I tried it before and after but still there is a way to bug it out to just reset the game and get a different pokemon.

    Second:
    [FONT=&quot]pbWonderTrade(40,[],[],1)

    The 2nd [] define the Pokemon you are not able to get. Got this.

    But my Script is now like 1 million words long because i added all Pokemon names from 152 till end. Is there an easier way? Like somewhere in the Script itself to give an Option about the range of Pokemon to give? For example: 1-151
    [FONT=&quot]I know i can hardcode them but i would like to have it different from script to script[/FONT]


    Third:

    I am not sure if this is possible because i didnt found a "WORKING" way for this but may we can choose the levelrange?

    Like you give a level 50 Pokemon... ok got this point... but you get always a same level pokemon back. Why not make it like a range? 50-60 or 1-100.

    I am not sure if i can manipulate the Pokemon before the trade but i will defintly try it.


    Hope for a nice answer.
    Sincerely[/FONT]
     
    Last edited:

    Black Eternity

    Lord of Eternity
    57
    Posts
    11
    Years
    • Seen Jun 30, 2016
    1. Go to Pokemon Trading and make the following changes:
    Copy Red Highlights and delete, Paste to Blue highlighted spot.
    Add Green Highlighted.
    Code:
    def pbStartTrade(pokemonIndex,newpoke,nickname,trainerName,trainerGender=0)
      myPokemon=$Trainer.party[pokemonIndex]
      opponent=PokeBattle_Trainer.new(trainerName,trainerGender)
      opponent.setForeignID($Trainer)
      yourPokemon=nil
      if newpoke.is_a?(PokeBattle_Pokemon)
        newpoke.trainerID=opponent.id
        newpoke.ot=opponent.name
        newpoke.otgender=opponent.gender
        newpoke.language=opponent.language
        yourPokemon=newpoke
      else
        yourPokemon=PokeBattle_Pokemon.new(newpoke,myPokemon.level,opponent)
      end
      [COLOR="Blue"]$Trainer.party[pokemonIndex]=yourPokemon[/COLOR]
      yourPokemon.name=nickname
      yourPokemon.resetMoves
      yourPokemon.obtainMode=2 # traded
      $Trainer.seen[yourPokemon.species]=true
      $Trainer.owned[yourPokemon.species]=true
      pbSeenForm(yourPokemon)
      [COLOR="Green"]pbSave[/COLOR]
      pbFadeOutInWithMusic(99999){
        evo=PokemonTradeScene.new
        evo.pbStartScreen(myPokemon,yourPokemon,$Trainer.name,opponent.name)
        evo.pbTrade
        evo.pbEndScreen
      }
      [COLOR="Red"]$Trainer.party[pokemonIndex]=yourPokemon[/COLOR]
    end

    2. add another conditional to the loop process. I have used.
    This allows only Gen 2 pokemon.
    Code:
    if species<=151 || species>=252
            species=0
    end
    This does not allow 1ST or 3RD Gen pokemon.
    Code:
    if (species<=151) || (species>=252 && species<=386)
            species=0
    end

    3. You would need to modify the Trade script.
    Specifically here:
    Code:
    if newpoke.is_a?(PokeBattle_Pokemon)
        newpoke.trainerID=opponent.id
        newpoke.ot=opponent.name
        newpoke.otgender=opponent.gender
        newpoke.language=opponent.language
        yourPokemon=newpoke
      else
        yourPokemon=PokeBattle_Pokemon.new(newpoke,[COLOR="SeaGreen"]myPokemon.level[/COLOR],opponent)
      end
     
    Last edited:
    1,224
    Posts
    10
    Years
  • I replaced the loop to include Maruno's suggestion of using rareness for the species
    Code:
    while (species==0) # Loop Start
            species=rand(PBSpecies.maxValue)+1
            # Redo the loop if the species is an exception.
            species=0 if except2.include?(species)
            # species=0 if (except.include?(species) && except2.include?(species))
            # use this above line instead if you wish to neither receive pokemon that YOU
            # cannot trade.
            [COLOR="Red"]dexdata=pbOpenDexData
            pbDexDataOffset(dexdata,species,16)
            rareness=dexdata.fgetb # Get rareness from dexdata file
            dexdata.close 
            species=0 if rand(255)>=rareness[/COLOR]
          end

    I took out all the stuff I added before, this is much cleaner.
     
    Back
    Top