• 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?".
  • Staff applications for our PokéCommunity Daily and Social Media team are now open! Interested in joining staff? Then click here for more info!
  • 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.

Making a gift Pokémon an exact copy of an NPC's Pokémon

mewlover22

Pokemon Creator
  • 457
    Posts
    16
    Years
    I want the player to get an exact copy of a trainers pokemon when certain conditions are met but i can't get it to work right i want it to show it came from the trainer and have the same move set and item the trainers had. I read up on the wiki but im a bit confused as to how to do it i have and script with the pokemon given but the player owns it.

    Here's the script.
    p=PokeBattle_Pokemon.new(:BLAZIKEN,88,$Trainer)
    p.item=PBItems::BLAZIKENITE
    p.setGender(0) # Male
    p.makeNotShiny
    p.calcStats
    pbAutoLearnMove(p,SLASH)
    pbAutoLearnMove(p,:BRAVEBIRD)
    pbAutoLearnMove(p,SKYUPPERCUT)
    pbAutoLearnMove(p,:FLAREBLITZ)

    Kernel.pbAddPokemon(p)

    I know i need to use pbAddForeignPokemon but how do i make the above fit in with that script so it has all the same stuff as the trainers pokemon?
     
    Is the Trainer important? I mean, you dont need to use $Trainer. You can add the Pokémon, then edit it's OT and unless it's the Rival's you can set it to whatever you want.
     
    So i have it add a pokemon then use the other stuff i have set up how do i make it so that it shows it came from the other trainer.
     
    Did you try looking at the example maps, in which there are events which do exactly this? Look in the Fan Club in Lerucean Town.
     
    Inside your project's folder, there's a .exe file called "extendtext". Run it while you're on the script window.
     
    okay now i'm getting a error right as im about to get the pokemon here is my script i have set up.
    p=PokeBattle_Pokemon.new(:BLAZIKEN,88,$Trainer)
    p.item=PBItems::BLAZIKENITE
    p.setGender(0) # Male
    poke.ot="May"
    poke.trainerID=$Trainer.getForeignID
    p.calcStats
    pbAutoLearnMove(p,SLASH)
    pbAutoLearnMove(p,:BRAVEBIRD)
    pbAutoLearnMove(p,SKYUPPERCUT)
    pbAutoLearnMove(p,:FLAREBLITZ)

    Kernel.pbAddPokemon(p)

    Do i need to fix this?
     
    pbAutoLearnMove is deprecated; use the replacement method. You missed out some colons in front of some move names. Use p.setItem and p.makeMale.

    Note that pbAddPokemon will let the player nickname the Pokémon, which you may not want if you're making it the same as an NPC's Pokémon.
     
    The error is caused by not having the colons. The other things I said are just advice.
     
    well i have it set up and i got this error.

    ---------------------------
    Pokemon Sun
    ---------------------------
    Exception: RuntimeError

    Message: Script error within event 9, map 186 (Pokemon League):

    Exception: NameError

    Message: (eval):4:in `pbExecuteScript'undefined local variable or method `poke' for #<Interpreter:0x8cf16a0>

    ***Full script:

    p=PokeBattle_Pokemon.new(:BLAZIKEN,88,$Trainer)
    p.item=PBItems::BLAZIKENITE
    p.setGender(0) # Male
    poke.ot="May"
    poke.trainerID=$Trainer.getForeignID
    p.calcStats
    pbAutoLearnMove(p,sLASH)
    pbAutoLearnMove(p,:BRAVEBIRD)
    pbAutoLearnMove(p,SKYUPPERCUT)
    pbAutoLearnMove(p,:FLAREBLITZ)

    Kernel.pbAddPokemon(p)


    Interpreter:243:in `pbExecuteScript'

    Interpreter:1600:in `eval'

    Interpreter:243:in `pbExecuteScript'

    Interpreter:1600:in `command_355'

    Interpreter:494:in `execute_command'

    Interpreter:193:in `update'

    Interpreter:106:in `loop'

    Interpreter:198:in `update'

    Scene_Map:103:in `update'

    Scene_Map:101:in `loop'



    Interpreter:276:in `pbExecuteScript'

    Interpreter:1600:in `command_355'

    Interpreter:494:in `execute_command'

    Interpreter:193:in `update'

    Interpreter:106:in `loop'

    Interpreter:198:in `update'

    Scene_Map:103:in `update'

    Scene_Map:101:in `loop'

    Scene_Map:114:in `update'

    Scene_Map:68:in `main'



    This exception was logged in

    C:\Users\Chris\Saved Games/Pokemon Sun/errorlog.txt.

    Press Ctrl+C to copy this message to the clipboard.
    ---------------------------
    OK
    ---------------------------

    Any ideas on what part is messing with it or do i need to use the other method of adding pokemon to the party if so how do i modify the moves?
     
    Code:
    p=PokeBattle_Pokemon.new(:BLAZIKEN,88,$Trainer)
    p.item=PBItems::BLAZIKENITE
    p.setGender(0) # Male
    [COLOR=Red]poke[/COLOR].ot="May"
    [COLOR=Red]poke[/COLOR].trainerID=$Trainer.getForeignID
    p.calcStats
    pbAutoLearnMove(p,[COLOR=Red]sLASH[/COLOR])
    pbAutoLearnMove(p,:BRAVEBIRD)
    pbAutoLearnMove(p,[COLOR=Red]SKYUPPERCUT[/COLOR])
    pbAutoLearnMove(p,:FLAREBLITZ)
    
    Kernel.pbAddPokemon(p)
    It looks like you haven't taken any of my advice. Fix the red parts to make it literally work.
     
    Back
    Top