• 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] [v18] Trainer Battle ("Shiny")

AskipLudo

The Masked Guy
  • 159
    Posts
    8
    Years
    Hello, so not long ago I've made a shiny "variant" but it's rarer than shiny and wanted to make a trainer have this variant but I don't know how to do so:

    I know in trainers.txt
    You can do something like this:

    Pokemon = MACHOP,100
    Gender = male
    Shiny = yes

    But if I want to add my variant I can't do this:

    Pokemon = MACHOP,100
    Gender = male
    MyVariant = yes

    right?
     
    Hello, so not long ago I've made a shiny "variant" but it's rarer than shiny and wanted to make a trainer have this variant but I don't know how to do so:

    I know in trainers.txt
    You can do something like this:



    But if I want to add my variant I can't do this:



    right?

    For the sake of a single battle, you could define your new shiny variant as a form in pokemonforms.txt. Then, you can specify Form = form_number in trainers.txt.
     
    Oh so I can't do as the shiny one

    You wouldn't be able to just add MyVariant = yes without adding this functionality somewhere in the scripts. I think it's possible, but I don't know how to do it. Defining it as a form is the easiest way I can think to do it.
     
    Hello, so not long ago I've made a shiny "variant" but it's rarer than shiny and wanted to make a trainer have this variant but I don't know how to do so:

    I know in trainers.txt
    You can do something like this:



    But if I want to add my variant I can't do this:



    right?

    Your solution requires to rework the Compiler script (and the decompiler) so that it reads and understands the "MyVariant" line. Unless you know what you're doing, and you're ready to solve conflicts with future updates of Essentials, I would strongly recommend you stick to ThatWelshOne's solution ^^
     
    Cause I managed to make it appear as wild pokemon, but with the "Form = form_number" method the icon and animation won't appear

    How did you make it appear as a wild Pokémon? Have you defined this new variant as a new Pokémon entirely?

    If you decide to use forms, you would need to have the graphics set up in the same way as e.g. Alolan Rattata.
     
    Cause I managed to make it appear as wild pokemon, but with the "Form = form_number" method the icon and animation won't appear

    (I haven't tested this, it's just a few tracks for you to try)


    First track. If you plan on making few Pokémons with a shiny variant, you should probably define a shinyVariant attribute in both PokeBattle_Pokemon and PokeBattle_Battler. In the initialize function of both of these classes, set this shinyVariant attribute to false.
    Then, when you define your form in 016_Pokemon/002_Pokemon_Forms.rb, you should probably script something like that:

    Code:
    MultipleForms.register(<:THAT_POKEMON>,{
      "getFormOnCreation" => proc { |pkmn|
      # Control the percentage of having a shiny variant appear, here it's 0.1% 
      pkmn.shinyVariant = rand(1000) < 1 # Assuming shinyVariant is defined with attr_accessor.
      next 1 if pkmn.shinyVariant # Assuming Shiny variant is 1
      next 0 # Otherwise 
      },
    })

    This code needs reworking if you plan on adding a shiny variant to Pokémons with other forms, so be careful.


    Second track. If you plan on making all Pokémons with a shiny variant, you should probably reserve a specific form number so that we know that all shiny variants have this given form number, and when a Pokémon has this form number, it is a shiny variant. If should be a form number high enough so that you are sure it won't conflict with future updates of the Pokédex (Gen 9 might have a cream cake Pokémon with one form per 5-tuple of flavours so be careful lol). Maybe like form = 1000 or such.


    If you follow any of these tracks, go to the script: 012_Battle/005_Battle scene/009_Scene_Animations.rb.
    The only thing to change is the condition for which the shiny animation is shown.

    At the end of the
    Code:
    pbBattleIntroAnimation
    function, find this:

    Spoiler:


    and replace with this:

    Spoiler:


    Be warned that I haven't tested any of this code, I'm just giving you the result of a ten-minute brainstorming ^^
     
    Well the shiny variant is a kinda copy of how wild shiny are made, with shiny flag and other like in this : (broken link removed)

    EDIT: Only the sprite isn't showing
    Spoiler:
     
    Last edited:
    Well the shiny variant is a kinda copy of how wild shiny are made, with shiny flag and other like in this : (broken link removed)
    Ok 🤔
    He doesn't work with forms, my tracks were assuming you defined the shiny variants as forms ^^
    It's a clean way to do it, but if you want trainers to have this shiny variant, you have to work a bit on the compiler, which I, a random internet stranger, do not recommend ^^"

    EDIT: Only the sprite isn't showing
    Spoiler:
    My first guess would be to check pbCheckPokemonBitmapFiles: how does it handle shiny variants?
     
    My first guess would be to check pbCheckPokemonBitmapFiles: how does it handle shiny variants?


    Like this

    bitmapFileName = pbCheckPokemonBitmapFiles([species,back,(pokemon.female?),
    pokemon.shiny?,(pokemon.form rescue 0),pokemon.shadowPokemon?,(pokemon.isRainbow? rescue false)])

    def pbLoadSpeciesBitmap(species,female=false,form=0,shiny=false,shadow=false,back=false,egg=false,rainbow=false)

    Everything was working but I will mess around other scripts I have maybe there is something that mess the comptability

    EDIT: Okay so Dynamax script was doing stuff with this but fixed it
     
    Last edited:
    Back
    Top