• 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

  • 49
    Posts
    9
    Years
    • Seen Jan 17, 2017
    I need help on my trainer card, I want my card to have 24 bagdes of 3 region, 8 of each. I have an example of how I want it. I do not understand script. thank you
     

    Attachments

    • [PokeCommunity.com] Trainer card badges
      sprites_trainer_ash_ketchum_satoshi_pokemon_anime__by_kensuyjin33-d7jw5x9.png
      72.5 KB · Views: 279
    Last edited by a moderator:
    This was so much harder because I don't know what your final trainer card will look like, so either post that up too and I'll edit the script or you edit it yourself when you have the graphics.
    Line 67, PScreen_TrainerCard. Change
    Code:
        x=72
        region=pbGetCurrentRegion(0) # Get the current region
        imagePositions=[]
        for i in 0...8
          if $Trainer.badges[i+region*8]
            imagePositions.push(["Graphics/Pictures/badges",x,310,i*32,region*32,32,32])
          end
          x+=48
        end
    to
    Code:
        x=72 # change to x coordinate of left most badge slot
        y=250 # change to 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
            if $Trainer.badges[j+i*8]
              imagePositions.push(["Graphics/Pictures/badges",x,y,j*32,i*32,32,32])
            end
            x+=48 # Change to the distance between the top left corners of two badge slots beside each other
          end
          x=72
          y+=40 # Change to the distance between the top left corners of two badge slots on top of each other
        end
    Final result
    [PokeCommunity.com] Trainer card badges
     
    My card will have 512 x 452.
    He will definitely stay.
     

    Attachments

    • [PokeCommunity.com] Trainer card badges
      trainercardf.PNG
      11.4 KB · Views: 174
    Your image is bigger than the screen then, but that's not my issue.
    This should work, based off your image, but I'm not at my computer, so I don't know for a fact.

    Vendily, you were right, my image was great, I slowed down, it's almost perfect.View attachment 80664
    It won't look perfect because you don't have a perfect 2x size, and the space between rows is different. (39 px for the top two and 37 px for the bottom two.)
    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
            if $Trainer.badges[j+i*8]
              imagePositions.push(["Graphics/Pictures/badges",x,y,j*32,i*32,32,32])
            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
     
    Last edited:
    [PokeCommunity.com] Trainer card badgesThe words on the card are getting like this, how do I make it perfect? The size of the card is now correct right?
     
    Line 52 section PScreen_TrainerCard
    change this:
    Code:
        textPositions=[
           [_INTL("Name"),34,64,0,baseColor,shadowColor],
           [_INTL("{1}",$Trainer.name),302,64,1,baseColor,shadowColor],
           [_INTL("ID No."),332,64,0,baseColor,shadowColor],
           [_INTL("{1}",pubid),468,64,1,baseColor,shadowColor],
           [_INTL("Money"),34,112,0,baseColor,shadowColor],
           [_INTL("${1}",$Trainer.money),302,112,1,baseColor,shadowColor],
           [_INTL("Pokédex"),34,160,0,baseColor,shadowColor],
           [_ISPRINTF("{1:d}/{2:d}",$Trainer.pokedexOwned,$Trainer.pokedexSeen),302,160,1,baseColor,shadowColor],
           [_INTL("Time"),34,208,0,baseColor,shadowColor],
           [time,302,208,1,baseColor,shadowColor],
           [_INTL("Started"),34,256,0,baseColor,shadowColor],
           [starttime,302,256,1,baseColor,shadowColor]
        ]
    to this
    Code:
    textPositions=[
           [_INTL("Name"),34,51,0,baseColor,shadowColor],
           [_INTL("{1}",$Trainer.name),302,51,1,baseColor,shadowColor],
           [_INTL("ID No."),332,51,0,baseColor,shadowColor],
           [_INTL("{1}",pubid),468,51,1,baseColor,shadowColor],
           [_INTL("Money"),34,98,0,baseColor,shadowColor],
           [_INTL("${1}",$Trainer.money),302,98,1,baseColor,shadowColor],
           [_INTL("Pokédex"),34,148,0,baseColor,shadowColor],
           [_ISPRINTF("{1:d}/{2:d}",$Trainer.pokedexOwned,$Trainer.pokedexSeen),302,148,1,baseColor,shadowColor],
           [_INTL("Time"),34,194,0,baseColor,shadowColor],
           [time,302,194,1,baseColor,shadowColor],
        ]
    line 24, change:
    Code:
        @sprites["trainer"]=IconSprite.new(336,112,@viewport)
    to:
    Code:
        @sprites["trainer"]=IconSprite.new(336,98,@viewport)


    If you cant read the black text (I barely can), go to line 50 and change
    Code:
        baseColor=Color.new(72,72,72)
        shadowColor=Color.new(160,160,160)
    to:
    Code:
        baseColor=Color.new(248,248,248)
        shadowColor=Color.new(72,80,88)
    Play with the colours till you get a pair you like.

    images
     
    View attachment 80685Vendily, When I put the 24 bagdes, it was like this.

    You need to use the badge code I posted earlier. Around line 67.
    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
            if $Trainer.badges[j+i*8]
              imagePositions.push(["Graphics/Pictures/badges",x,y,j*32,i*32,32,32])
            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
    I assumed you still had it.
     
    There is a problem, after I put this script on line 67, it is giving this error.[PokeCommunity.com] Trainer card badges I do not know, maybe it was because of this being in the previous image script to be bigger? And the script is no longer on line 67, that's on line 65, that changed after you've placed the last one. What can I do?[PokeCommunity.com] Trainer card badges

    Vendily Complicating me a bit, here are some pictures of my project, it becomes easier for you, and pass me the whole script[PokeCommunity.com] Trainer card badges

    [PokeCommunity.com] Trainer card badges
     
    Last edited by a moderator:
    Your error means you missed an end somewhere.
    To save us from further headaches, since I an certain the code is fine, take this pastebin of the entire section.
    https://pastebin.com/raw/MtnFMbDT
    Just replace the entire section with this, since It looks like your code is untouched other than my edits.
    Looks good from my end, if that's worth anything.
    [PokeCommunity.com] Trainer card badges

    Just check the transparency on those badges, some of those areas were supposed to be invisible, I assume.
     
    Hello Vendily,

    I have been trying to something similar to this but with two rows of 9 badges. I have tried everything on here multiple times and I just can't get it to work. I'm still kind of new to the scripting so I'm not sure if I'm missing something or not. I know you probably have done this a few times and I'm sorry if this is a bother. But any help or tips you could give me would be much appreciated. Here is what I'm working with.

    Very respectfully



    [PokeCommunity.com] Trainer card badges


    [PokeCommunity.com] Trainer card badges
     
    Last edited:
    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.
     
    Thank you so much for your reply. So I try that one and nothing is showing up on the card. I believed I change the numbers that were necessary.

    x=32 # x coordinate of left most badge slot
    y=262 # y coordinate of top most badge slot
    imagePositions=[]
    for i in 0...2 #change 3 to total number of regions
    for j in 0...9 #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=32
    y+=38 # distance between the top left corners of two badge slots on top of each other
    end
    I think this is what is supposed to be but not sure.
     
    Yeah, I did that, sorry I sent this one after I was trying to play around with it. But yeah I went through it again just to make sure I didn't make the mistake and yes I debug all the badges, still nothing. I can get one row of 9 badges to show up no problem. It's just adding a second row that's killing me lol.
     
    Hi! This post is absolutely gold, but I have this dilemma: I want to have 20 medals on the Trainer Card, but with this order per row ... 8, 4 and 8. Why is this order so strange? Because my fangame aims to adapt the anime of pokémon, first from Kanto to Johto, and well, the Orange Islands that are in between have only 4 medals. Vandily, could you help me please? Thanks in advance
     
    Hi! This post is absolutely gold, but I have this dilemma: I want to have 20 medals on the Trainer Card, but with this order per row ... 8, 4 and 8. Why is this order so strange? Because my fangame aims to adapt the anime of pokémon, first from Kanto to Johto, and well, the Orange Islands that are in between have only 4 medals. Vandily, could you help me please? Thanks in advance

    Um, Do you have an example picture? Mostly because I'm not sure exactly how you want it to look, and I don't want to make a shortcut that doesn't work for you, or an edit that's unnecessary.
     
    Back
    Top