• 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!
  • Our weekly protagonist poll is now up! Vote for your favorite Trading Card Game 2 protagonist in the poll by clicking here.
  • 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.

Multiple Forms for Shadow Pokémon

FlipelyFlip

Arr teh Pirate
  • 44
    Posts
    13
    Years
    Heyey,

    I have a little question.
    I'm trying to make the shadow pokémon have extra forms not this violet color on them. I have some sprites and figured a bit out how to do it.

    my changes:

    I put the "def isShadow?" methode above the multiple forms (to prevent errors).

    then I added this:

    Code:
    alias __mf_isShadow isShadow?
    under this:

    Code:
    alias __mf_EVyield EVyield
    Now I added this one into the script:

    Code:
      def isShadow?
        v=MultipleForms.call("isShadow?",self)
        return v if v!=nil
        return self.__mf_isShadow
      end
    above the "def initialize(*args)".

    and under
    Code:
    "getMoveList"=>proc{|pokemon|
       next if pokemon.form==0
       movelist=[]
       case pokemon.form
         when 1 ; movelist=[[1,:TACKLE],[10,:PROTECT],[15,:BUGBITE],[20,:HIDDENPOWER],
                            [23,:CONFUSION],[26,:ROCKBLAST],[29,:HARDEN],[32,:PSYBEAM],
                            [35,:CAPTIVATE],[38,:FLAIL],[41,:ATTRACT],[44,:PSYCHIC],
                            [47,:FISSURE]]
         when 2 ; movelist=[[1,:TACKLE],[10,:PROTECT],[15,:BUGBITE],[20,:HIDDENPOWER],
                            [23,:CONFUSION],[26,:MIRRORSHOT],[29,:METALSOUND],
                            [32,:PSYBEAM],[35,:CAPTIVATE],[38,:FLAIL],[41,:ATTRACT],
                            [44,:PSYCHIC],[47,:IRONHEAD]]
       end
       for i in movelist
         i[1]=getConst(PBMoves,i[1])
       end
       next movelist
    },
    I added:

    Code:
    "isShadow?"=>proc{|pokemon|
          next "Shadow"
    }
    })
    But when I start game and want to fill my boxes on the pc, following error is showing up:

    Message: nil can't be coerced into Fixnum
    PokemonShadowPokemon *removed fade in :399:in `-'
    PokemonShadowPokemon *removed fade in :399:in `exp='
    PokeBattle_Pokemon:122:in `level='
    PokeBattle_Pokemon:690:in `__mf_initialize'
    PokemonMultipleForms *Shadow form:90:in `initialize'
    PokemonDebug:394:in `new'
    PokemonDebug:394:in `pbDebugMenu'
    PokemonDebug:393:in `each'
    PokemonDebug:393:in `pbDebugMenu'
    PokemonDebug:285:in `loop'
    And when I change a received Pokémon to a shadow pokémon, nothing happens, except the coloring it to a shadow pokémon.

    Can someone help me please ._.

    ~flipy
     
    So all you want to do is use your own sprites for Shadow Pokémon, rather than the original sprites tinted purple?

    If so, you're going the wrong way about it. All you need to do is edit def pbLoadPokemonBitmapSpecies so that it also checks the shadowness of the Pokémon. Something like this:

    Code:
      if pokemon.egg?
        bitmapFileName=pbResolveBitmap(sprintf("Graphics/Battlers/%03degg",species))
        bitmapFileName=pbResolveBitmap(sprintf("Graphics/Battlers/egg")) if !bitmapFileName
      else
        [COLOR=Red]bitmapFileName=pbResolveBitmap(sprintf("Graphics/Battlers/%03d%s%s%s_%d_%d",species,
           pokemon.gender==1 ? "f" : "",
           pokemon.isShiny? ? "s" : "",
           back ? "b" : "",(pokemon.form rescue 0),
           (pokemon.isShadow? rescue false) ? "shadow" : ""))[/COLOR]
        bitmapFileName=pbResolveBitmap(sprintf("Graphics/Battlers/%03d%s%s%s_%d",species,
           pokemon.gender==1 ? "f" : "",
           pokemon.isShiny? ? "s" : "",
           back ? "b" : "",(pokemon.form rescue 0))) [COLOR=Red]if !bitmapFileName[/COLOR]
       [COLOR=Red] bitmapFileName=pbResolveBitmap(sprintf("Graphics/Battlers/%03d%s%s_%d_%d",species,
           pokemon.isShiny? ? "s" : "",
           back ? "b" : "",(pokemon.form rescue 0),
           (pokemon.isShadow? rescue false) ? "shadow" : "")) [/COLOR][COLOR=Red]if !bitmapFileName[/COLOR]
        bitmapFileName=pbResolveBitmap(sprintf("Graphics/Battlers/%03d%s%s_%d",species,
           pokemon.isShiny? ? "s" : "",
           back ? "b" : "",(pokemon.form rescue 0))) if !bitmapFileName
        [COLOR=Red]bitmapFileName=pbResolveBitmap(sprintf("Graphics/Battlers/%03d%s%s%s_%d",species,
           pokemon.gender==1 ? "f" : "",
           pokemon.isShiny? ? "s" : "",
           back ? "b" : "",
           (pokemon.isShadow? rescue false) ? "shadow" : "")) if !bitmapFileName[/COLOR]
        bitmapFileName=pbResolveBitmap(sprintf("Graphics/Battlers/%03d%s%s%s",species,
           pokemon.gender==1 ? "f" : "",
           pokemon.isShiny? ? "s" : "",
           back ? "b" : "")) if !bitmapFileName
        [COLOR=Red]bitmapFileName=pbResolveBitmap(sprintf("Graphics/Battlers/%03d%s%s_%d",species,
           pokemon.isShiny? ? "s" : "",
           back ? "b" : "",
           (pokemon.isShadow? rescue false) ? "shadow" : "")) if !bitmapFileName[/COLOR]
        bitmapFileName=pbResolveBitmap(sprintf("Graphics/Battlers/%03d%s%s",species,
           pokemon.isShiny? ? "s" : "",
           back ? "b" : "")) if !bitmapFileName
        # Alter bitmap if supported
        alterBitmap=(MultipleForms.getFunction(species,"alterBitmap") rescue nil)
      end
    Add in the red parts. Any Shadow sprite should have "_shadow" at the end of its name.

    The next part is to stop the game from colouring in sprites for Shadow Pokémon. Search for any instance of the phrase (192,0,255,128) and remove the code that includes it (it should be obvious what that means).
     
    It could be simplified to just one extra bit of code if you were careful when naming the sprite files. Of course, that assumes people pay attention to what they're doing, which is a dangerous assumption.

    If you have a better way of doing that code, please let us know.
     
    heyey,

    I did what you told me maruno, and I got an error, than I worked a bit on it and thought I could only change the value to (0,0,0,0). But I'm still getting the same error.

    Exception: ArgumentError
    Message: invalid value for Integer: ""
    PokemonUtilities *edited Trainer/Shadow:1421:in `sprintf'
    PokemonUtilities *edited Trainer/Shadow:1421:in `pbLoadPokemonBitmapSpecies'
    PokemonUtilities *edited Trainer/Shadow:1411:in `pbLoadPokemonBitmap'
    PokemonSprite *remove shadow*:53:in `setPokemonBitmap'
    PokemonSummary *remove shadow:83:in `pbStartScene'
    PokemonSummary *remove shadow:991:in `pbStartScreen'
    PokemonParty:914:in `pbSummary'
    PokemonParty:1379:in `pbPokemonScreen'
    PokemonParty:1288:in `loop'
    PokemonParty:1749:in `pbPokemonScreen'

    I have removed the script parts I wrote above (if it's needed to know, but if I let it in, it's still giving me this error)

    ~flipy
     
    okay, now it's working halfway.
    maybe I'm too dumb to let the shadow-sprite apear ~.~
    I tried nearly every possible naming-constelation to maybe get it to work, but still the standard sprite is used.
    do you have any other ideas why it's not showing up, 'cause I did everything you told me to do /:

    EDIT:
    I was really that dumb as I thought ~.~
    named my file 34_shadow instead of 034_shadow xD
    thanks again for your help maruno (:
     
    Last edited:
    Change the
    Code:
    bitmapFileName=pbResolveBitmap(sprintf("Graphics/Battlers/%03d%s%s%s_%d_%d",species,
           pokemon.gender==1 ? "f" : "",
           pokemon.isShiny? ? "s" : "",
           back ? "b" : "",(pokemon.form rescue 0),
           (pokemon.isShadow? rescue false) ? "shadow" : ""))
        bitmapFileName=pbResolveBitmap(sprintf("Graphics/Battlers/%03d%s%s%s_%d",species,
           pokemon.gender==1 ? "f" : "",
           pokemon.isShiny? ? "s" : "",
           back ? "b" : "",(pokemon.form rescue 0))) if !bitmapFileName
        bitmapFileName=pbResolveBitmap(sprintf("Graphics/Battlers/%03d%s%s_%d_%d",species,
           pokemon.isShiny? ? "s" : "",
           back ? "b" : "",(pokemon.form rescue 0),
           (pokemon.isShadow? rescue false) ? "shadow" : "")) if !bitmapFileName
        bitmapFileName=pbResolveBitmap(sprintf("Graphics/Battlers/%03d%s%s_%d",species,
           pokemon.isShiny? ? "s" : "",
           back ? "b" : "",(pokemon.form rescue 0))) if !bitmapFileName
        bitmapFileName=pbResolveBitmap(sprintf("Graphics/Battlers/%03d%s%s%s_%d",species,
           pokemon.gender==1 ? "f" : "",
           pokemon.isShiny? ? "s" : "",
           back ? "b" : "",
           (pokemon.isShadow? rescue false) ? "shadow" : "")) if !bitmapFileName
        bitmapFileName=pbResolveBitmap(sprintf("Graphics/Battlers/%03d%s%s%s",species,
           pokemon.gender==1 ? "f" : "",
           pokemon.isShiny? ? "s" : "",
           back ? "b" : "")) if !bitmapFileName
        bitmapFileName=pbResolveBitmap(sprintf("Graphics/Battlers/%03d%s%s_%d",species,
           pokemon.isShiny? ? "s" : "",
           back ? "b" : "",
           (pokemon.isShadow? rescue false) ? "shadow" : "")) if !bitmapFileName
        bitmapFileName=pbResolveBitmap(sprintf("Graphics/Battlers/%03d%s%s",species,
           pokemon.isShiny? ? "s" : "",
           back ? "b" : "")) if !bitmapFileName

    to
    Code:
    loader=[]
    loader[0]=pokemon.isShiny?
    loader[1]=(pokemon.form!=nil rescue false) # need more testing
    loader[2]=pokemon.gender==1 
    loader[3]=(pokemon.isShadow? rescue false)
    bitmapFileName=tryLoadSprite(loader)

    And put in the class

    Code:
    # The loader try to load with all conditions. If it won't load, the loader try to
    # load with all conditions except the last and continues trying util it finishes 
    # all the conditions.
    def tryLoadSprite(loader)
      bitmapFileName=pbResolveBitmap(sprintf("Graphics/Battlers/%03d%s%s%s%s%s",species,
           loader[2] ? "f" : "", loader[0] ? "s" : "",
           back ? "b" : "",(loader[1] ? ("_"+(pokemon.form rescue 0).to_s) : ""),
           loader[3] ? "_shadow" : ""))
      return bitmapFileName if bitmapFileName
      index=loader.rindex(true)
      if(index)
        loader[index]=false
        bitmapFileName=tryLoadSprite(loader)
      end
      return bitmapFileName
    end

    Untested. This code also load the default sprite if the shiny one can't be found. This code has a better performance and less code duplication.
     
    Wow, recursive.

    I had a go at something similar, and came up with this (replacement code):
    Code:
      else
        [COLOR=Red]bitmapFileName=pbCheckPokemonBitmapFiles([species,back,
                                                  (pokemon.gender==1),
                                                  pokemon.isShiny?,
                                                  (pokemon.form rescue 0),
                                                  (pokemon.isShadow? rescue false)])[/COLOR]
        # Alter bitmap if supported
        alterBitmap=(MultipleForms.getFunction(species,"alterBitmap") rescue nil)
    ...with the new method:
    Code:
    def pbCheckPokemonBitmapFiles(params)
      species=params[0]
      back=params[1]
      for i in 0...2**(params.length-2)
        tgender=(i%2==0) ? params[2] : false
        tshiny=((i/2)%2==0) ? params[3] : false
        tform=((i/4)%2==0) ? params[4].to_s : ""
        tshadow=((i/8)%2==0) ? params[5] : false
        bitmapFileName=pbResolveBitmap(sprintf("Graphics/Battlers/%03d%s%s%s%s%s",
           species,
           tgender ? "f" : "",
           tshiny ? "s" : "",
           back ? "b" : "",
           (tform!="" ? "_"+tform : ""),
           tshadow ? "_shadow" : ""))
        return bitmapFileName if bitmapFileName
      end
      return nil
    end
    I've done the same for the icons, so they can now also depend on gender, shininess and Shadowness. Both work fully, so far as I can tell.

    Now all that's left is to stop the game from colouring in Shadow Pokémon's sprites purple if they're using a Shadow version of the sprite already.
     
    Back
    Top