• 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.
  • Dawn, Gloria, Juliana, or Summer - which Pokémon protagonist is your favorite? Let us know by voting in our poll!
  • Our friends from the Johto Times are hosting a favorite Pokémon poll - and we'd love for you to participate! Click here for information on how to vote for your favorites!
  • 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 Battle Sprites via Switches

_pheebee

Gosh! What's poppin'?
  • 526
    Posts
    6
    Years
    I'm not to great with knowledge of how essentials works.
    but, can one change battle sprites based on a switch.

    There's a part of my game where you'll be entering a GSC style area, and I'd love for the battle sprites to change to.
    Possibly have it if a switch is set all battle sprites change from 001.png to 001_gsc.png

    if that makes sense.
     
    I'm not to great with knowledge of how essentials works.
    but, can one change battle sprites based on a switch.

    There's a part of my game where you'll be entering a GSC style area, and I'd love for the battle sprites to change to.
    Possibly have it if a switch is set all battle sprites change from 001.png to 001_gsc.png

    if that makes sense.

    Maybe (broken link removed), from Relic Castle can help you. :D
     
    Ah, you wish to change the pokemon battle sprites. I suppose a place to start is def pbCheckPokemonBitmapFiles
    the important part is here.
    Code:
        bitmapFileName = sprintf("Graphics/Battlers/%s%s%s%s%s%s",
           getConstantName(PBSpecies,species),
           (tgender) ? "f" : "",
           (tshiny) ? "s" : "",
           (back) ? "b" : "",
           (tform!="") ? "_"+tform : "",
           (tshadow) ? "_shadow" : "") rescue nil
        ret = pbResolveBitmap(bitmapFileName)
        return ret if ret
        bitmapFileName = sprintf("Graphics/Battlers/%03d%s%s%s%s%s",
           species,
           (tgender) ? "f" : "",
           (tshiny) ? "s" : "",
           (back) ? "b" : "",
           (tform!="") ? "_"+tform : "",
           (tshadow) ? "_shadow" : "")
        ret = pbResolveBitmap(bitmapFileName)
    We can add another %s to the sprintfs, and another ternary on a game switch ($game_switches[GBC_SPRITE_SWITCH] ? "_gbc" : "")
    but it will make an invisible sprite if the switch isn't on. So we can push another factor into the factors array for our condition, like say
    Code:
    factors.push([6,$game_switches[GBC_SPRITE_SWITCH] ,false]) if $game_switches[GBC_SPRITE_SWITCH]     # gbc
    then we add a new t-variable, tgbc=false.
    now we add a new when
    Code:
    when 6   # gbc
            tgbc = ((i/(2**j))%2==0) ? factors[j][1] : factors[j][2]
    finally, in the sprintf changes, instead of looking at the game switch directly, we use tgbc instead.

    same idea for def pbCheckPokemonIconFiles for the pokemon icons.
     
    Last edited:
    Ah, you wish to change the pokemon battle sprites. I suppose a place to start is def pbCheckPokemonBitmapFiles
    the important part is here.
    Code:
        bitmapFileName = sprintf("Graphics/Battlers/%s%s%s%s%s%s",
           getConstantName(PBSpecies,species),
           (tgender) ? "f" : "",
           (tshiny) ? "s" : "",
           (back) ? "b" : "",
           (tform!="") ? "_"+tform : "",
           (tshadow) ? "_shadow" : "") rescue nil
        ret = pbResolveBitmap(bitmapFileName)
        return ret if ret
        bitmapFileName = sprintf("Graphics/Battlers/%03d%s%s%s%s%s",
           species,
           (tgender) ? "f" : "",
           (tshiny) ? "s" : "",
           (back) ? "b" : "",
           (tform!="") ? "_"+tform : "",
           (tshadow) ? "_shadow" : "")
        ret = pbResolveBitmap(bitmapFileName)
    We can add another %s to the sprintfs, and another ternary on a game switch ($game_switches[GBC_SPRITE_SWITCH] ? "_gbc" : "")
    but it will make an invisible sprite if the switch isn't on. So we can push another factor into the factors array for our condition, like say
    Code:
    factors.push([6,$game_switches[GBC_SPRITE_SWITCH] ,false]) if $game_switches[GBC_SPRITE_SWITCH]     # gbc
    then we add a new t-variable, tgbc=false.
    now we add a new when
    Code:
    when 6   # gbc
            tgbc = ((i/(2**j))%2==0) ? factors[j][1] : factors[j][2]
    finally, in the sprintf changes, instead of looking at the game switch directly, we use tgbc instead.

    same idea for def pbCheckPokemonIconFiles for the pokemon icons.

    so, like, I don't know alot about scripting.
    Where do I find def pbCheckPokemonBitmapFiles ?
     
    so, like, I don't know alot about scripting.
    Where do I find def pbCheckPokemonBitmapFiles ?

    Aha! I get to teach a new handy trick! If you press CTRL + SHIFT + F all at together, it lets you search across all of the script sections at once.
    It's PSystem_FileUtilities though. Do learn this trick though, makes sifting through the code much easier.

    Well, give it a shot, and feel free to ask for help if my instructions were too vague.
     
    Back
    Top