• 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] Define shiny as form

  • 3
    Posts
    5
    Years
    • Seen Aug 24, 2021
    Hi there,

    I hope I'm not asking a too stupid question :), as I'm not having much PE scripting experience yet.

    I would like to define shiny Pokémon as forms for giving them new stat, other types and a different moveset, but I can't seem to figure out, where and how to put the form change.

    I first tried:
    Code:
    MultipleForms.register(:BULBASAUR,{
      "getFormOnCreation" => proc { |pkmn|
        if pkmn.shiny?
          next 1
        else
          next 0
        end
      }
    })

    in Pokemon_Forms but that doesn't seem to work.

    Do you have any tips or suggestions, I don't mind if it is a lot of writing work, to put them all there manually^^.

    Thanks in advance,
    Kadisra
     
    First we need to know which version of essentials you are using. to keep thing simple we can force the pokemons type to become a certain form by modifying the code relating to shiny pokemon. since you use .shiny? instead of .isShiny? I assume you are using either v18 or v19, so in v19 let's locate this:
    Code:
      def form=(value)
        oldForm = @form
        @form = value
        @ability = nil
        MultipleForms.call("onSetForm", self, value, oldForm)
        calc_stats
        $Trainer.pokedex.register(self) if $Trainer
      end
    and modify it so that all shiny pokemon become it's own form.
    Code:
      def form=(value)
        oldForm = @form
        @form = value
        @ability = nil
        MultipleForms.call("onSetForm", self, value, oldForm)
        [B]@form+=1000 if @shiny[/B]
        calc_stats
        $Trainer.pokedex.register(self) if $Trainer
      end
    in bold you see I'm not setting any specific number, but forcing the form to jump from it's current value to 1000 numbers ahead. this is to avoid conflicts with other scripts and potentially other forms (Ex MEOWTH-1, MEOWTH-2 ect)
    using this knowledge you can add say MEOWTH-1002 and using MEOWTH-2 as the base you can make Shiny Galarian Meowth a Fire/Fighting type if you jive with that. you can further condition the bold line to limit it. how you progress from here depends on what you want to achieve. best wishes!
     
    Hi Pokeminer20,

    first, thank you very much for your help.
    Yes, I'm using a recent version of PE and it seems it doesn't work yet.

    I've done the following:
    Code:
      def setForm(value)
        oldForm = @form
        @form = value
        yield if block_given?
        MultipleForms.call("onSetForm",self,value,oldForm)
        @form+=1000 if @shiny
        self.calcStats
        pbSeenForm(self)
      end

    But the Pokémon doesn't have the attributes I defined in the form, here a sample PBS entry:
    Code:
    [BULBASAUR,1000]
    FormName = Shiny
    Type1 = GRASS
    Type2 = DARK
    BaseStats = 45,53,50,45,70,68
    Abilities = OVERGROW,CHLOROPHYLL
    Moves = 1,TACKLE,3,GROWL,7,LEECHSEED,9,VINEWHIP,13,POISONPOWDER,13,SLEEPPOWDER,15,TAKEDOWN,19,RAZORLEAF,21,SWEETSCENT,25,GROWTH,27,DOUBLEEDGE,31,WORRYSEED,33,SYNTHESIS,37,SEEDBOMB
    Color = Black

    Do you know, what can be the problem?

    Thanks and regards,
    Kadisra
     
    How are you creating your shiny? Through debug? I ask this because you're probably having a timing issue here. You're assigning the form on the key 'getFormOnCreation'. If the mon is not considered shiny at its creation time, your form code will not apply. Better use a continuous form check to go for the shiny, something like Giratina and its held item.
     
    Hi Pokeminer20,
    Do you know, what can be the problem?
    Thanks and regards,
    Kadisra

    as Luka stated above, our modification to the form must happen when the mon is created. using his giratina example, I think our code should look like this:
    Code:
    MultipleForms.register(:GIRATINA,{
      "getForm" => proc { |pkmn|
        if pkmn.shiny?
          next 1000
        end
        next 0
      }
    })
    The downside is we'd need to specify each pokemon that this alt shiny form applies to, and would requite a lot of additions to the FormHandlers script. we can make that list as short as possible and without much issue if we splice our setform call into the def where "getForm" comes from. I found the def here in the script simple named "Pokemon" above "Pokemon_MegaEvolution":
    Code:
      def form
        return @forced_form if !@forced_form.nil?
        return @form if $game_temp.in_battle
        calc_form = MultipleForms.call("getForm", self)
        self.form = calc_form if calc_form != nil && calc_form != @form
        return @form
      end
    so lets mod this by adding this line of code to it
    Code:
      def form
        return @forced_form if !@forced_form.nil?
        return @form if $game_temp.in_battle
        calc_form = MultipleForms.call("getForm", self)
        self.form = calc_form if calc_form != nil && calc_form != @form
    [B]    self.form += 1000 if self.shiny?[/B]
        return @form
      end

    I hope this helps
     
    Hi,

    thank you both for your help, I have found the right place for creating the form! It seems you don't have to edit it in the
    Code:
    Pokemon_Forms
    but the
    Code:
    PokeBattle_Pokemon
    script under the shiny section.

    I have it now so
    Code:
      # Makes this Pokémon shiny.
      def makeShiny
        @form+=1000
        @shinyflag = true
      end

    And this works! Thanks for your support!

    Kind regards,
    Kadisra
     
    Back
    Top