• 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!
  • 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] Manipulating a Pokémon's movesets IN BATTLE

  • 68
    Posts
    6
    Years
    • Seen Sep 19, 2023
    In my game, after the player receives their first Lv 5 Pokemon, a wild Pokémon at Lv 20 comes and attacks them.

    Obviously this Pokémon's moveset will have matured a lot and it will kill your starter Pokémon in one hit, but I don't want that to happen. I've decided that I'm only gonna have the Pokemon use stupid moves in battle, like Leer and stuff, but I don't want to go to the PBS files to literally change the learnset. I think there is a script that changes their moveset just that once before the battle. Also, if possible, I'd like to change the Pokémon's moveset back to normal.

    I think I've seen how to do this somewhere, but the steps were hard to follow, especially as a new scripter. So if anyone can help, that'd be great, thanks.
     
    I think the simplest solution would just be to make the battle a trainer battle. I did the following and it worked pretty well for me:
    • Define a new trainer type in trainertypes.txt like this: "202,BLANK,The wild,0,Battle wild".
    • Define the battle in trainers.txt with the name of the trainer being the name of the "wild" Pokemon
    • Don't put any image file for this trainer class (or put one that would make sense for the battle)
    • For the event, only put in the trainer type and trainer name (don't add anything that would display a message)

    There are a few problems with this, though:
    • The "wild" Pokemon is displayed as coming out of a Poke Ball
    • You are unable to catch this Pokemon

    Everything else should work similarly to a wild battle in game.
     
    Go to 'PField_EncounterModifiers' script and paste this below 'SHINY_WILD_POKEMON_SWITCH' script, like (this is what I did. You have to create a game switch for it):
    Code:
    # Make all wild Pokémon shiny while a certain Switch is ON (see Settings).
    Events.onWildPokemonCreate+=proc {|sender,e|
       pokemon=e[0]
       if $game_switches[SHINY_WILD_POKEMON_SWITCH]
         pokemon.makeShiny
       end
    }
    
    # Used in the form>0
    Events.onWildPokemonCreate+=proc {|sender,e|
       pokemon=e[0]
       if $game_switches[VS_FORM]
         #pokemon.hp=((pokemon.totalhp/2)-5).ceil
         #pokemon.setAbility(2)
         pokemon.iv=[31,0,31,0,0,31]
         pokemon.ev=[252,200,252,0,0,252]
         pokemon.form=1
         pokemon.setNature(:JOLLY)
         pokemon.item=getConst(PBItems,:SITRUSBERRY)
         pokemon.pbLearnMove(:SURGINGSTRIKES)
         pokemon.pbLearnMove(:BULKUP)
         #for i in 0...4
           #pokemon.moves[i]=PBMove.new(getID(PBMoves,:OBLIVIONWING)) #if isConst?(pokemon.species,PBSpecies,:METAPOD)
         #end
         if isConst?(pokemon.species,PBSpecies,:KYUREM)
           pokemon.form=1
           pokemon.form=2 if $game_switches[FATEFUL_ENCOUNTER_SWITCH]
         #elsif isConst?(pokemon.species,PBSpecies,:KYOGRE)
          # pokemon.form=1
          # pokemon.item=getConst(PBItems,:BLUEORB)
         elsif isConst?(pokemon.species,PBSpecies,:ABSOL)
           pokemon.form=1
           #pokemon.item=getConst(PBItems,:ULTRANECROZIUMZ2)
         #else
         end
         pokemon.calcStats
       end
    }

    But for your case, I think this one could be better:
    Code:
    Events.onWildPokemonCreate+=proc {|sender,e|
       pokemon=e[0]
       if $game_switches[XXX] # Number of switch
         pokemon.pbLearnMove(:LEER)
         pokemon.pbLearnMove(:COIL)
         pokemon.pbLearnMove(:BULKUP)
         pokemon.pbLearnMove(:DISABLE)
         pokemon.calcStats
       end
    }

    Remember to turn the switch off after battle.
     
    Silverlime, thanks so much.. I could use that for another situation, but I want the player to decide if they want to catch the Pokemon. WolfPP thanks again! You've been a wonderful help!
     
    I have another problem. When I just put, pokemon.pbLearnMove(:LEER), it fills the rest of the moves with default moves. When I tried to fill all of the pokemon moves with Leer and Growl, it seemed to ignore it and let him use default moves. I'm making the battle for Fearow, so it would be weird if he were to know Coil and Disable and Bulk Up, and really he only learns Leer and Growl. Is there anything to delete the rest of the moves and make him just know Leer?
     
    I have another problem. When I just put, pokemon.pbLearnMove(:LEER), it fills the rest of the moves with default moves. When I tried to fill all of the pokemon moves with Leer and Growl, it seemed to ignore it and let him use default moves. I'm making the battle for Fearow, so it would be weird if he were to know Coil and Disable and Bulk Up, and really he only learns Leer and Growl. Is there anything to delete the rest of the moves and make him just know Leer?

    Not sure if this would work, but I guess it's worth a try. I believe even if a Pokemon has a blank move slot, this is still considered a move with an ID of 0, so if you put "pokemon.pbLearnMove(0)" for each empty move slot, maybe it would work?
     
    Back
    Top