• 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] Trainer card badges

Hello, this is a nice post but I need help getting my badges to appear on the trainer card. No matter what I do they're just blank boxes on the card
 
Hello, this is a nice post but I need help getting my badges to appear on the trainer card. No matter what I do they're just blank boxes on the card

If you're on v17 or 18 then change this
Code:
imagePositions.push(["Graphics/Pictures/badges",x,y,j*32,i*32,32,32])
to
Code:
imagePositions.push(["Graphics/Pictures/Trainer Card/badges",x,y,j*32,i*32,32,32])
 
Similar idea with Alain, I want my badges to be set up in two different rows, each with different amounts, with the top row having 8 and the bottom having 10. Of course I could do a two-rowed 9/9 card, but I wondered if there'd be a way to do 18 badges differently. I know (almost) nothing when it comes to scripting and would appreciate the assistance.

Here's the badges, card design, and how I'd arrange them as well.

[PokeCommunity.com] Trainer card badges


[PokeCommunity.com] Trainer card badges


[PokeCommunity.com] Trainer card badges
 
I wish to do something similar to the others, but with sixteen badges.

Here is the Trainer Card in-game.
[PokeCommunity.com] Trainer card badges


And here are the badges.
[PokeCommunity.com] Trainer card badges
 
wow talk about a blast from the past.
the code just needs a few more edits
Code:
    x=72 # x coordinate of left most badge slot
    y=243 # y coordinate of top most badge slot
    imagePositions=[]
    for i in 0...3 #change 3 to total number of regions
      for j in 0...8 #change 8 number of badges in a row
        if $Trainer.badges[j+i*8] #change 8 to number of badges in a row
          imagePositions.push(["Graphics/Pictures/badges",x,y,j*32,i*32,32,32]) # These 32's are the dimensions of each badge (not sure if you changed that)
        end
        x+=48 # distance between the top left corners of two badge slots beside each other
      end
      x=72
      y+=38 # distance between the top left corners of two badge slots on top of each other
    end

Same deal in the end, just a few more edits.
Hello, I'm really hoping that you are still around and fine with helping out. I'm currently working on making a game with 18 gym badges. 2 rows of 9 but I'm extremely new to coding. After adding the codes in that you've posted and adjusted them to what i think to be correct, i keep getting a weird error. I'll post all of the relevant images in this post as well as the coding I have input. I greatly appreciate any and all help you can provide.

[PokeCommunity.com] Trainer card badges


[PokeCommunity.com] Trainer card badges[PokeCommunity.com] Trainer card badges[PokeCommunity.com] Trainer card badges
 
Your code doesn't match the correct number of ends. You are missing an end, as well as the method call that actually draws the images.
v21 also changes how the code would work (mostly just that it's not $Trainer anymore).
Go back to a clean version of that script section, and replace everything from pbDrawTextPositions(overlay, textPositions) to pbDrawImagePositions(overlay, imagePositions) with the below
Ruby:
    pbDrawTextPositions(overlay, textPositions)
    x = 32
    y = 262
    imagePositions = []
    2.times do |row| # number of rows
      9.times do |badge| # number of badges in a row
        if $player.badges[badge + (row * 9)] # number of badges in a row
          imagePositions.push(["Graphics/UI/Trainer Card/icon_badges", x, 310, badge * 32, row * 32, 32, 32])
        end
        x += 48
      end
      x = 32
      y += 38 # distance between top of one row to the top of the next
    end
    pbDrawImagePositions(overlay, imagePositions)

[poked for notification]
 
Your code doesn't match the correct number of ends. You are missing an end, as well as the method call that actually draws the images.
v21 also changes how the code would work (mostly just that it's not $Trainer anymore).
Go back to a clean version of that script section, and replace everything from pbDrawTextPositions(overlay, textPositions) to pbDrawImagePositions(overlay, imagePositions) with the below
Ruby:
    pbDrawTextPositions(overlay, textPositions)
    x = 32
    y = 262
    imagePositions = []
    2.times do |row| # number of rows
      9.times do |badge| # number of badges in a row
        if $player.badges[badge + (row * 9)] # number of badges in a row
          imagePositions.push(["Graphics/UI/Trainer Card/icon_badges", x, 310, badge * 32, row * 32, 32, 32])
        end
        x += 48
      end
      x = 32
      y += 38 # distance between top of one row to the top of the next
    end
    pbDrawImagePositions(overlay, imagePositions)
Thank
Your code doesn't match the correct number of ends. You are missing an end, as well as the method call that actually draws the images.
v21 also changes how the code would work (mostly just that it's not $Trainer anymore).
Go back to a clean version of that script section, and replace everything from pbDrawTextPositions(overlay, textPositions) to pbDrawImagePositions(overlay, imagePositions) with the below
Ruby:
    pbDrawTextPositions(overlay, textPositions)
    x = 32
    y = 262
    imagePositions = []
    2.times do |row| # number of rows
      9.times do |badge| # number of badges in a row
        if $player.badges[badge + (row * 9)] # number of badges in a row
          imagePositions.push(["Graphics/UI/Trainer Card/icon_badges", x, 310, badge * 32, row * 32, 32, 32])
        end
        x += 48
      end
      x = 32
      y += 38 # distance between top of one row to the top of the next
    end
    pbDrawImagePositions(overlay, imagePositions)
I really appreciate the assistance! that seemed to fix letting me back into the game and being able to test, but I'm now seeing this when I click into the trainer card location of the player options.
 

Attachments

  • [PokeCommunity.com] Trainer card badges
    Screenshot 2024-06-25 202304.png
    23.6 KB · Views: 5
  • [PokeCommunity.com] Trainer card badges
    Screenshot 2024-06-25 204421.png
    33.5 KB · Views: 6
your code somehow has an extra pbDrawImagePositions (the one on line 65 is the issue)
Compare your highlighted code (lines 65 to 79) with my code block.
Okay, so i fixed those problems and there's 1 thing left, for some reason the badges are layering on top of one another
 

Attachments

  • [PokeCommunity.com] Trainer card badges
    Screenshot 2024-06-25 230220.png
    19 KB · Views: 7
Back
Top