• 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] Multiple forms and movesets

226
Posts
8
Years
    • Seen Jul 19, 2023
    I am trying to define several movesets for species based on a criteria of differentiation (for example, between a shiny and a non-shiny).
    Is there a way to make something like this work:

    Code:
    MultipleForms.register(:SANDSHREW,{"getMoveList"=>proc{|pokemon|
      movelist=[[1,:DRAGONHAMMER],[1,:SEEDBOMB],[1,:BARRAGE],[1,:HYPNOSIS],
                [1,:CONFUSION],[17,:PSYSHOCK],[27,:EGGBOMB],[37,:WOODHAMMER],
                [47,:LEAFSTORM]]
      for i in movelist
        i[1]=getConst(PBMoves,i[1])
      end
      next movelist [COLOR="Red"]if pokemon.isShiny?[/COLOR]
    }

    When I give the player 2 Sandshrews, one of them being shiny and not the other:

    Code:
    $Trainer.party=[]
    pkmn=PokeBattle_Pokemon.new(:SANDSHREW,46)
    pkmn.makeShiny
    $Trainer.party.push(pkmn)
    pkmn2=PokeBattle_Pokemon.new(:SANDSHREW,46)
    $Trainer.party.push(pkmn2)

    ... BOTH Sandshrews always acquire the same moveset!

    I've tried small variations such as this one:
    Code:
    "getMoveList"=>proc{|pokemon|
      [COLOR="Red"]next if !pokemon.isShiny?[/COLOR]
      movelist=[[1,:DRAGONHAMMER],[1,:SEEDBOMB],[1,:BARRAGE],[1,:HYPNOSIS],
                [1,:CONFUSION],[17,:PSYSHOCK],[27,:EGGBOMB],[37,:WOODHAMMER],
                [47,:LEAFSTORM]]
      for i in movelist
        i[1]=getConst(PBMoves,i[1])
      end
      next movelist
      movelist=[]
    },

    I always got the same results. Either the 2 Sandshrews, the shiny and the non-shiny one, learn this moveset, or they don't.

    This part of code is used in various Delta/Alolan custom scripts and seem to never work properly.

    Does someone know a way to make this work (other than updating to v17?)
     

    Maruno

    Lead Dev of Pokémon Essentials
    5,286
    Posts
    16
    Years
    • Seen May 3, 2024
    The Pok?mon are given their moves when they're created, which happens before you can make one of them shiny.

    After making your first Pok?mon shiny, write pkmn.resetMoves.
     
    Back
    Top