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

Creating a Contest Pass (secondary Trainer Card)

67
Posts
12
Years
  • Howdy folks,
    I got two questions regarding scripts I need some help with.
    First of all, probably a simple one for a scripter:
    I want to implement a couple of Pokemon Colosseums in my game. However, they differ in difficulty and the player need to have completed the previous Colosseums in order to participate in the next one. For that, I like the player to obtain a Contest Pass or similar, on which this data is saved. First of all, how to check for an item in the back returned True or False? (Kernel.pbCheckItem(PBItem::CONTESTPASS) didn't work. Secondly, how can you programme the progress on an Key item, so it can show the player its progress, plus so you can use it at a front-counter to validize participation.

    Second question regards the VS bar.
    How do you rewrite the script in a way to add different kinds of bar animations? Like the standard one going in a fast left movement but by different trainers (or colosseum) having it like it was in Pokemon Black/White Plasma team leader?

    def show_vs_bar(viewport)
    if $vsBar
    if $vsBar[0]==true and $vsBar[1]!=nil and $vsBar[2]!=nil
    #pbWait(5)

    @border=Sprite.new(viewport)
    @border.bitmap=BitmapCache.load_bitmap("Graphics/VS/border.png")
    @border.y=90
    @border.z=99999
    @border.visible=false

    @left=Sprite.new(viewport)
    @left.bitmap=BitmapCache.load_bitmap("Graphics/VS/blue.png")
    @left.x=-290
    @left.y=104
    @left.z=99999
    @left.visible=false

    @right=Sprite.new(viewport)
    @right.bitmap=BitmapCache.load_bitmap("Graphics/VS/red.png")
    @right.x=512
    @right.y=104
    @right.z=99999
    @right.visible=false

    @light1=Sprite.new(viewport)
    @light1.bitmap=BitmapCache.load_bitmap("Graphics/VS/light.png")
    @light1.x=-580
    @light1.y=104
    @light1.z=99999+1
    @light1.visible=false

    @light2=Sprite.new(viewport)
    @light2.bitmap=BitmapCache.load_bitmap("Graphics/VS/light.png")
    @light2.x=-1160
    @light2.y=104
    @light2.z=99999+1
    @light2.visible=false

    @light3=Sprite.new(viewport)
    @light3.bitmap=BitmapCache.load_bitmap("Graphics/VS/light.png")
    @light3.x=512
    @light3.y=104
    @light3.z=99999+1
    @light3.visible=false

    @light4=Sprite.new(viewport)
    @light4.bitmap=BitmapCache.load_bitmap("Graphics/VS/light.png")
    @light4.x=1092
    @light4.y=104
    @light4.z=99999+1
    @light4.visible=false

    @trainer1=Sprite.new(viewport)
    @trainer1.bitmap=BitmapCache.load_bitmap("Graphics/VS/"+$vsBar[1]+".png")
    @trainer1.x=-256
    @trainer1.y=104
    @trainer1.z=99999+3
    @trainer1.visible=false

    @shadow1=Sprite.new(viewport)
    @shadow1.bitmap=BitmapCache.load_bitmap("Graphics/VS/"+$vsBar[1]+".png")
    @shadow1.x=10
    @shadow1.y=104
    @shadow1.z=99999+2
    @shadow1.color.alpha=256
    @shadow1.opacity=0

    @trainer2=Sprite.new(viewport)
    @trainer2.bitmap=BitmapCache.load_bitmap("Graphics/VS/"+$vsBar[2]+".png")
    @trainer2.x=512
    @trainer2.y=104
    @trainer2.z=99999+3
    @trainer2.visible=false

    @shadow2=Sprite.new(viewport)
    @shadow2.bitmap=BitmapCache.load_bitmap("Graphics/VS/"+$vsBar[2]+".png")
    @shadow2.x=256+10
    @shadow2.y=104
    @shadow2.z=99999+2
    @shadow2.color.alpha=256
    @shadow2.opacity=0

    @explosion=Sprite.new(viewport)
    @explosion.x=128
    @explosion.y=37
    @explosion.z=99999+4

    @VS=Sprite.new(viewport)
    @VS.bitmap=BitmapCache.load_bitmap("Graphics/VS/vs.png")
    @VS.x=181
    @VS.y=150
    @VS.z=99999+5
    @VS.visible=false

    @border.visible=true
    @light1.visible=true
    @light2.visible=true
    @light3.visible=true
    @light4.visible=true
    @left.visible=true
    @right.visible=true

    for i in 1..10
    @left.x=-290+i*29
    @right.x=512-i*29
    light_move
    pbWait(1)
    end

    @VS.visible=true
    @VS.opacity=3

    for i in 1..12
    @explosion.bitmap=BitmapCache.load_bitmap("Graphics/VS/e"+i.to_s+".png")
    @VS.opacity+=i*21
    light_move
    pbWait(2)
    end

    @trainer1.visible=true
    @trainer1.color.alpha=256
    @trainer2.visible=true
    @trainer2.color.alpha=256

    for i in 1..16
    @trainer1.x+=16
    @trainer2.x-=16
    light_move
    pbWait(1)
    end

    20.times do
    light_move
    pbWait(2)
    end

    for i in 1..16
    @trainer1.color.alpha-=16
    @trainer2.color.alpha-=16
    @shadow1.opacity+=16
    @shadow2.opacity+=16
    light_move
    pbWait(1)
    end

    60.times do
    light_move
    pbWait(2)
    end

    for i in 1..10
    @VS.zoom_x=i
    @VS.zoom_y=i
    @VS.x=256-75*i
    @VS.y=225-75*i
    light_move
    pbWait(1)
    end

    pbWait(2)
    @VS.dispose
    @left.dispose
    @right.dispose
    @trainer1.dispose
    @trainer2.dispose
    @light1.dispose
    @light2.dispose
    @light3.dispose
    @light4.dispose
    @border.dispose
    @shadow1.dispose
    @shadow2.dispose
    $vsBar=[false,nil,nil]
    end
    end
    end

    def light_move
    @light1.x+=10
    @light2.x+=10
    @light3.x-=10
    @light4.x-=10
    @light3.x = @light4.x+580 if @light4.x<=10
    @light4.x = @light3.x+580 if @light3.x<=10
    @light1.x= @light2.x if @light2.x>=509
    @light2.x= @light1.x if @light1.x>=509

    end
     

    Nickalooose

    --------------------
    1,309
    Posts
    16
    Years
    • Seen Dec 28, 2023
    Howdy folks,
    I got two questions regarding scripts I need some help with.
    First of all, probably a simple one for a scripter:
    I want to implement a couple of Pokemon Colosseums in my game. However, they differ in difficulty and the player need to have completed the previous Colosseums in order to participate in the next one. For that, I like the player to obtain a Contest Pass or similar, on which this data is saved. First of all, how to check for an item in the back returned True or False? (Kernel.pbCheckItem(PBItem::CONTESTPASS) didn't work. Secondly, how can you programme the progress on an Key item, so it can show the player its progress, plus so you can use it at a front-counter to validize participation.

    Second question regards the VS bar.
    How do you rewrite the script in a way to add different kinds of bar animations? Like the standard one going in a fast left movement but by different trainers (or colosseum) having it like it was in Pokemon Black/White Plasma team leader?

    Checking Items from wiki
    I have no idea what you're trying to do?!

    Coding an item differs depending on what you want it to do... You don't need this item to do anything if you only need it to go into the Colosseum... Just check the player has it... Everything else, like level or round or part, can be done using variables... Just add 1, thus, 0 being the start, 1, being level 2, 2 being level 3, and so on.
     
    67
    Posts
    12
    Years
  • Hi Nickalooose, Maybe I was not very clear in my previous message. I checked all of the essentials wiki but wasn't able to find on how to check for an item. Like in a conditional branch returning a true or false. I assume the script must be something like: Kernel.pbCheckItem(PBItem::CONTESTPASS) but I get an error everytime I try that or similar. So what is the correct script/code to check if a player has the item?
     

    Maruno

    Lead Dev of Pokémon Essentials
    5,286
    Posts
    16
    Years
    • Seen today
    Hi Nickalooose, Maybe I was not very clear in my previous message. I checked all of the essentials wiki but wasn't able to find on how to check for an item. Like in a conditional branch returning a true or false. I assume the script must be something like: Kernel.pbCheckItem(PBItem::CONTESTPASS) but I get an error everytime I try that or similar. So what is the correct script/code to check if a player has the item?
    Did you try reading the article section that Nickalooose linked to (the "Counting items in the Bag" one)? It's a very short section, and it explains exactly what to do.
     
    67
    Posts
    12
    Years
  • I didn't realize Nickalooose sent a link, but I found it. It was a small line I must have overread it. Well continuing upon that comes my next question which is probably a bit harder to realize.
    What I want to implement is that this contest pass has the layout (overall function) similar to that as the Trainer card. So once you select the Contest Pass (which is/will be a Key item) that it shows a screen similar to that of a trainer card; displaying ID, maybe a number, but also the data and 'award badges' earned by completing each Colosseum. So it is a bit like a secondary trainer card only then with a different layout and in Item form.
    Would that be possible?
     

    Nickalooose

    --------------------
    1,309
    Posts
    16
    Years
    • Seen Dec 28, 2023
    You've kind of just answered your own question... Trainer card already does this, so you can always copy that and edit a few things, namely the class and what it shows, everything else will almost be the same, I think, I haven't played around with the Trainer card yet (but I need to), well it must be... Just talking to myself now lol.
     
    67
    Posts
    12
    Years
  • You've kind of just answered your own question... Trainer card already does this, so you can always copy that and edit a few things, namely the class and what it shows, everything else will almost be the same, I think, I haven't played around with the Trainer card yet (but I need to), well it must be... Just talking to myself now lol.

    I have been experimenting with this, duplicated all Trainercard components from PokemonUtilities and added an extra Itemhandler in Itemeffect:
    ItemHandlers::UseFromBag.add(:CONTESTPASS,proc{|item|
    pbContestPass

    Plus another class script named PokemonContestPass similar to the TrainerCard with all functions and alternative graphics.
    However, for some reason I get a strange error as I can only use it once? Namely, when I select the item in from the bag, it opens, shows (the different Trainercard I referred to in the script) once I close, when I press the B button (or Esc or X) it closes stating the item can't be used here. And once I select it again I get an error? Any idea?
     

    Nickalooose

    --------------------
    1,309
    Posts
    16
    Years
    • Seen Dec 28, 2023
    Probably was a good idea to move this here Maruno.
    Anywho, what's the error?
    Why did the new card open, but then say it can't be used here?
    It seems, UseFromBag has a different thing to UseInField, I would check these.
    As for any item being used only once or not, that all refers to PBS files.
     
    67
    Posts
    12
    Years
  • It's quite weird indeed. I tried both UseInField and UseFromBag and the second only works, however, with that message.

    In PokemonItemEffects
    At lines 9-24
    ItemHandlers::UseFromBag.add(:COINCASE,proc{|item|
    Kernel.pbMessage(_INTL("Coins: {1}",$PokemonGlobal.coins))
    next 1 # Continue
    })

    ItemHandlers::UseFromBag.add(:TOWNMAP,proc{|item|
    pbShowMap
    next 1 # Continue
    })

    ItemHandlers::UseFromBag.add(:CONTESTPASS,proc{|item| next 1 # Continue
    })

    ItemHandlers::UseFromBag.add(:BICYCLE,proc{|item|
    next pbBikeCheck ? 2 : 0
    })

    followed by line 728
    ItemHandlers::UseFromBag.add(:CONTESTPASS,proc{|item|
    pbContestPass
    })

    Then at PokemonUtilities a similar TrainerCard script plus a class PokemonContestPass similar to PokemonTrainerCard.

    First time it opens fine, second time it shows this message
    ezimba19963480172500.png


    Where do I go wrong in this?
    The PBS file of ContestPass is the same as TownMap, having No,ID,id,8,0,"description.",2,0,0,
     

    Nickalooose

    --------------------
    1,309
    Posts
    16
    Years
    • Seen Dec 28, 2023
    Try using
    Code:
     not [QUOTE].
    Also, try this instead.
    [CODE]
    ItemHandlers::UseFromBag.add(:CONTESTPASS,proc{|item|
       pbContestPass
       next 1
    })
     
    67
    Posts
    12
    Years
  • I finally got it to work!
    I had to remove the final def in PokemonUtilities
    Code:
      def pbContestPass
        loop do
          Graphics.update
          Input.update
          self.update
          if Input.trigger?(Input::B)
            break
          end
        end 
      end

    However, following up on this is of course; How to add say 'trophies' instead of 'badges'?
    It's a bit the same idea of a Frontier Pass as in the games Emerald and Platinum.
    So the new question will be;

    How to insert trophies instead of badges, only then, using a separate card?

    Code:
    $Trainer.badges[3]=true
    But then:
    Code:
    $Trainer.trophies[3]=true
     

    FL

    Pokémon Island Creator
    2,449
    Posts
    13
    Years
    • Seen today
    I finally got it to work!
    I had to remove the final def in PokemonUtilities
    Code:
      def pbContestPass
        loop do
          Graphics.update
          Input.update
          self.update
          if Input.trigger?(Input::B)
            break
          end
        end 
      end

    However, following up on this is of course; How to add say 'trophies' instead of 'badges'?
    It's a bit the same idea of a Frontier Pass as in the games Emerald and Platinum.
    So the new question will be;

    How to insert trophies instead of badges, only then, using a separate card?

    Code:
    $Trainer.badges[3]=true
    But then:
    Code:
    $Trainer.trophies[3]=true
    The easier way is to handle with switches, like the ones form 71-80. But if you want a Trophy variable in trainer object, in PokeBattle_Trainer try to duplicate all line that mentions "badges" and change the "badges" word for "trophies", except for this part of the code

    Code:
      def numbadges # Number of badges
        ret=0
        for i in [email protected]
          ret+=1 if @badges[i]
        end
        return ret
      end

    There you need to make an entire new def like:

    Code:
      def numtrophies # Number of trophies
        ret=0
        for i in [email protected]
          ret+=1 if @trophies[i]
        end
        return ret
      end
     
    67
    Posts
    12
    Years
  • I have tried just that.
    Duplicated the lines in Battle_Trainer and replaced those with trophies.
    In short, I also duplicated the contestpass script (trainercard replica really) to PokemonUtilities.
    Once I run the script command in the game
    Code:
    $Trainer.trophies[0]=true

    I keep getting this error.
    ezimba19963496096800.png


    Any advice?
     

    FL

    Pokémon Island Creator
    2,449
    Posts
    13
    Years
    • Seen today
    I have tried just that.
    Duplicated the lines in Battle_Trainer and replaced those with trophies.
    In short, I also duplicated the contestpass script (trainercard replica really) to PokemonUtilities.
    Once I run the script command in the game
    Code:
    $Trainer.trophies[0]=true

    I keep getting this error.
    ezimba19963496096800.png


    Any advice?
    Do you duplicate the line 'attr_accessor(:badges)' to 'attr_accessor(:trophies)'?
     
    67
    Posts
    12
    Years
  • Code:
      attr_accessor(:trainertype)
      attr_accessor(:badges)
      attr_accessor(:trophies)
      attr_accessor(:money)
      attr_accessor(:seen)

    Yep! I did!
    And at the end of that script (line 178) I also got
    @formseen=[]
    @formlastseen=[]
    @badges=[]
    @trophies=[]
    @pokedex=false
    @pokegear=false
     

    Nickalooose

    --------------------
    1,309
    Posts
    16
    Years
    • Seen Dec 28, 2023
    add
    Code:
        for i in 0...8
          @trophies[i]=false
        end
    a bit further down... Where 8 = the amount of trophies you want to earn.
     
    67
    Posts
    12
    Years
  • I got all that in it already, too.
    It keeps giving that scripting error in the event itself.
    Whereas I use the same command as for badges
    $Trainer.trophies[0]=true

    A so called 'NoMethodError'
    Message:(eval):1:in 'pbExecuteScript' undefined method '[]=' for nil:NilClass
     

    Maruno

    Lead Dev of Pokémon Essentials
    5,286
    Posts
    16
    Years
    • Seen today
    I was confused for a moment, but then I realised you didn't follow rule 1:

    1. Start a new game!

    The trophies array will be created properly for future trainers (i.e. future "New Game"s), but existing ones won't have it which means if you try to do anything with it, you'll get an error.
     
    67
    Posts
    12
    Years
  • So that was the golden trick to success?! Start a new game. I would never have come to that conclusion :-P

    Anyhow, when I tried though, this damn error rocks up out of nowhere!
    ezimba19963483383200.png


    It's not very clear to me why it comes up, I haven't changed anything in or around pbTrainerName.
    Any ideas?
     

    Maruno

    Lead Dev of Pokémon Essentials
    5,286
    Posts
    16
    Years
    • Seen today
    What's on line 192 of the script section PokeBattle_Trainer?

    If you've done what you say you've done, I can't think why it would cause an error. Maybe you've done something else that you haven't mentioned.
     
    Back
    Top