• 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.

@databox problems

66
Posts
11
Years
    • Seen Feb 9, 2017
    I'm here with another question.
    I've had many of my questions fixed quite easy, but this one is stopping me from moving forward in a way.
    I've changed the game I'm working on slightly and one of my edits is focussed on how the battle boxes work, I've got 1 half of the problem fixed, but the second half is the problem.

    I suppose this question is mainly aimed at Maruno, but if anyone can help that would be great.

    I know @databox is what the battle boxes are saved to.
    I know where they are located, since there is only one place.
    In PokeBattle_ActualScene def refresh calls this:
    Code:
        self.bitmap.clear
        return if [email protected]
        self.bitmap.blt(0,0,@databox.bitmap,Rect.new(0,0,@databox.width,@databox.height))
    On first look, I guess the first line clears the databox and the third line recalls it... But let's say the next Pokémon called is a shiny and I wanted this databox to look somewhat different, color, shape, whatever the option, how would one effect the next databox that reappears?
     

    Luka S.J.

    Jealous Croatian
    1,270
    Posts
    15
    Years
  • The entire def refresh of the class PokemonDataBox handles all the different graphics and information that get's drawn onto the battle box. In a way, you kinda answered your question. There is just one important thing you have to remember. The entire battle box is handled as one sprite, with one bitmap. The bitmap is initially blank, and then all the other information gets drawn onto it. This means that the order in which the different elements get drawn onto the battle box, determines the priorities of the different layers. You can't use the Z values here like you would with other things.

    Moving on. If you want to change the bitmap of the battle box, you just change the @databox.bitmap parameter. The bitmap.blt method draws another bitmap into the specified bitmap. For details press F1 and search for the method. So in your example, if you want to have a different battle box graphic for a shiny, you'd have something like this:
    Code:
    if @battler.pokemon.isShiny?
      self.bitmap.blt(0,0,BitmapCache.load_bitmap("your bitmap path"),Rect.new(0,0,@databox.width,@databox.height)) #or use @databoxS.bitmap from my edit below
    else
      self.bitmap.blt(0,0,@databox.bitmap,Rect.new(0,0,@databox.width,@databox.height))
    end
    Though keep in mind that the enemy battle box and the player battle box have different bitmaps, and my example code does not take that into consideration. That's all there is to it. @databox is not where the battle boxes are saved to, but rather where the information that determines certain parameters of the battle box is saved. The actual variables where the battle box is saved to is @sprites["battlebox#"] where # corresponds to the Pokemon battle index. @sprites["battlebox#"].refresh re-draws the entire battle box, according to what is defined there.

    [EDIT]
    Actually, in the initialization stage of the class, where you have
    Code:
    @databox=AnimatedBitmap.new("Graphics/Pictures/battlePlayerBox#")
    You can add underneath it
    Code:
    @databoxS=AnimatedBitmap.new("Graphics/Pictures/battlePlayerBox#_S")
    And then rewrite my above snippet to use the @databoxS.bitmap parameter for the bitmap instead. That way you can easily define new battle box bitmaps for all the 4 different categories.
     
    Last edited:
    66
    Posts
    11
    Years
    • Seen Feb 9, 2017
    Ahh I see, I didn't even consider changing @databox.bitmap, to anything.
    I knew def refresh was the only place that it was effected, I just didn't know how to effect it this way... So I've taken what you've mentioned and I've managed to change the player boxes and the opponents boxes in separate ways depending on different ways the battle starts and continues.

    It's funny, because with help I've received via PM and your above post, something that took me almost 3 days to accomplish, took 10 minutes to resolve lol... But that's 3 days of messing around I wish I saved.

    Thanks for an in depth reply Luka, you taught me something new.
     
    163
    Posts
    7
    Years
    • Seen yesterday
    The entire def refresh of the class PokemonDataBox handles all the different graphics and information that get's drawn onto the battle box. In a way, you kinda answered your question. There is just one important thing you have to remember. The entire battle box is handled as one sprite, with one bitmap. The bitmap is initially blank, and then all the other information gets drawn onto it. This means that the order in which the different elements get drawn onto the battle box, determines the priorities of the different layers. You can't use the Z values here like you would with other things.

    Moving on. If you want to change the bitmap of the battle box, you just change the @databox.bitmap parameter. The bitmap.blt method draws another bitmap into the specified bitmap. For details press F1 and search for the method. So in your example, if you want to have a different battle box graphic for a shiny, you'd have something like this:
    Code:
    if @battler.pokemon.isShiny?
      self.bitmap.blt(0,0,BitmapCache.load_bitmap("your bitmap path"),Rect.new(0,0,@databox.width,@databox.height)) #or use @databoxS.bitmap from my edit below
    else
      self.bitmap.blt(0,0,@databox.bitmap,Rect.new(0,0,@databox.width,@databox.height))
    end
    Though keep in mind that the enemy battle box and the player battle box have different bitmaps, and my example code does not take that into consideration. That's all there is to it. @databox is not where the battle boxes are saved to, but rather where the information that determines certain parameters of the battle box is saved. The actual variables where the battle box is saved to is @sprites["battlebox#"] where # corresponds to the Pokemon battle index. @sprites["battlebox#"].refresh re-draws the entire battle box, according to what is defined there.

    [EDIT]
    Actually, in the initialization stage of the class, where you have
    Code:
    @databox=AnimatedBitmap.new("Graphics/Pictures/battlePlayerBox#")
    You can add underneath it
    Code:
    @databoxS=AnimatedBitmap.new("Graphics/Pictures/battlePlayerBox#_S")
    And then rewrite my above snippet to use the @databoxS.bitmap parameter for the bitmap instead. That way you can easily define new battle box bitmaps for all the 4 different categories.

    I take this thread to slightly divert the question, but also based on the manipulation of Databoxes.

    I use the EBS script, but also the Evolution in combat script. When this evolution happens, the evolution screen appears, but I cannot eliminate the databoxes with the indicated codes and then make them reappear to continue the fight.

    02-16.png


    This problem has stopped me a long time and aesthetically does not work: C
     
    Back
    Top