• 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] Changing sprites based on Switch.

_pheebee

[I]Gosh! What's poppin'?[/i]
528
Posts
5
Years
  • Hello there!

    I presume this would be a Scripting Question. If not let me know, and I'll move to the correct area but:

    I want to make it so if I have a switch activated the pokemon battle sprites change.
    So, for example if switch 0009 is ON, all sprites go from "xxx.png" to "xxx_gb.png" or something of that effect.

    How would one do this?

    EDIT: for 19.1 btw.
     
    Last edited:
    1,682
    Posts
    8
    Years
    • Seen today
    So, our change is in script section Species_Files, in def self.check_graphic_file
    There's a couple of changes to make.

    First, we have to add a new try_gb variable try_gb = ($game_switches && $game_switches[100]) ? "_gb" : "" . with a bit of insurance incase this code runs in places that don't have game switches loaded, like the load screen, since this method is actually dual purpose for icons as well.

    Next, we push it into the checked factors. I actually put it after form and before gender, factors.push([2, try_gb, ""]) if ($game_switches && $game_switches[100]) so we have to renumber gender, shadow and subfolder to be numbers 3, 4 and 5 instead of 2, 3 and 4 respectively.
    Similar change just below it, when 2 then try_gb = value, bump up gender, shadow and subfolder one.
    The reason why I put it between form and gender is because that's how the script prioritizes these factors. Since I don't have a female pikachu gb sprite, if I put it as number 3, generate a female pikachu and turn on the script, it prioritizes the PIKACHU_female sprite over the PIKACHU_gb sprite. Of course, it won't affect a mon with a higher form number than 0, so keep that in mind.

    Finally, in the sprintf, we add a new "%s" in the middle, and after try_form, slap in a try_gb,

    And that's it. The full file name would be PIKACHU_1_gb_female_shadow if you somehow had like, a female shadow alolan pikachu with the gb switch on.
     

    _pheebee

    [I]Gosh! What's poppin'?[/i]
    528
    Posts
    5
    Years
  • So, our change is in script section Species_Files, in def self.check_graphic_file
    There's a couple of changes to make.

    First, we have to add a new try_gb variable try_gb = ($game_switches && $game_switches[100]) ? "_gb" : "" . with a bit of insurance incase this code runs in places that don't have game switches loaded, like the load screen, since this method is actually dual purpose for icons as well.

    Next, we push it into the checked factors. I actually put it after form and before gender, factors.push([2, try_gb, ""]) if ($game_switches && $game_switches[100]) so we have to renumber gender, shadow and subfolder to be numbers 3, 4 and 5 instead of 2, 3 and 4 respectively.
    Similar change just below it, when 2 then try_gb = value, bump up gender, shadow and subfolder one.
    The reason why I put it between form and gender is because that's how the script prioritizes these factors. Since I don't have a female pikachu gb sprite, if I put it as number 3, generate a female pikachu and turn on the script, it prioritizes the PIKACHU_female sprite over the PIKACHU_gb sprite. Of course, it won't affect a mon with a higher form number than 0, so keep that in mind.

    Finally, in the sprintf, we add a new "%s" in the middle, and after try_form, slap in a try_gb,

    And that's it. The full file name would be PIKACHU_1_gb_female_shadow if you somehow had like, a female shadow alolan pikachu with the gb switch on.

    Would this then restore the sprite back to normal if the switch is then turned off?
    I should have stated that in the OP
     
    Back
    Top