• 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 Battle Sprites via Switches

_pheebee

[I]Gosh! What's poppin'?[/i]
528
Posts
5
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.
     

    WolfPP

    Spriter/ Pixel Artist
    1,309
    Posts
    5
    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.

    Maybe this, from Relic Castle can help you. :D
     
    1,682
    Posts
    8
    Years
    • Seen today
    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:

    _pheebee

    [I]Gosh! What's poppin'?[/i]
    528
    Posts
    5
    Years
  • 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 ?
     
    1,682
    Posts
    8
    Years
    • Seen today
    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.
     

    _pheebee

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


    How did I not know of this function!!?
     

    Pokeminer20

    PDM20, Coder of Chaos!
    412
    Posts
    10
    Years
  • how would I go about merging this with Shadow Pokemon's type change aspect? and if at all possible changing/multiplying base stats with this
     
    Last edited:
    Back
    Top