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

Adding new functions to the Trainer's PC?

  • 115
    Posts
    9
    Years
    • Seen Nov 17, 2023
    I'm trying to implement an additional function for the Trainer PC that allows the player to do their banking. While the game doesn't crash when I run it, only the item storage works, and selecting "Banking" or "Mailbox" doesn't do anything. Here is the code I changed in the PokemonStorage script:
    Spoiler:

    This is what allows the player to withdraw and deposit their money from the bank. I also added in a check for whether or not the player has opened up a bank account yet, which is determined by switch 101. If they don't have a bank account, it won't let them access the banking menus.

    I also squeezed in the "Banking" option in the pbTrainerPCMenu here:
    Spoiler:

    Long story short, I did something wrong here, but I'm not exactly sure what. Did anyone else here ever try adding in their own PC functions besides the default item storage and mailbox?
     
  • 91
    Posts
    14
    Years
    • Seen Sep 5, 2015
    Uhmmm, just to give an idea on how you do it. Perhaps you can make the mailbox through eventing? When talking to the PC, first you have two choices: Use the Storage System or check your mail, and then you put all your branches.
     

    Maruno

    Lead Dev of Pokémon Essentials
  • 5,286
    Posts
    16
    Years
    • Seen May 3, 2024
    You just have an error with your code. It's easier to spot if the code is indented properly, like so:
    Code:
    def pbTrainerPCMenu
      loop do
        command=Kernel.pbMessage(_INTL("What do you want to do?"),[
           _INTL("Item Storage"),
           _INTL("Banking"),
           _INTL("Mailbox"),
           _INTL("Turn Off")
        ],-1)
        [COLOR=Green]if command==0[/COLOR]
          pbPCItemStorage
          [COLOR=Red]if command==1
            pbPCBanking
          elsif command==2
            pbPCMailbox
          else
            break
          end[/COLOR]
        [COLOR=Green]end[/COLOR]
      end
    end
    Note my use of the
    Code:
     tags, rather than [spoiler] tags. [code] is for code. Makes sense when you think about it.
    
    The red part of this code is actually within the "[COLOR=Green]if command==0"[/COLOR] part, and as such can only be accessed when command equals 0. This chunk of code needs to be moved slightly, in a way I'm sure you can figure out for yourself.
     
  • 115
    Posts
    9
    Years
    • Seen Nov 17, 2023
    Edit: Scratch that. I was still having issues. I'll try making the changes you told me to make.
     
    Last edited:
  • 115
    Posts
    9
    Years
    • Seen Nov 17, 2023
    Update: I figured it out. A big thank you to both Maruno and lolandbeer for helping me out. :) I'll post the revised code on here for anyone else who might want to do something similar in the future.


    Code:
    def pbTrainerPCMenu
      loop do
        command=Kernel.pbMessage(_INTL("What do you want to do?"),[
           _INTL("Item Storage"),
           _INTL("Banking"),
           _INTL("Mailbox"),
           _INTL("Turn Off")
        ],-1)
        if command==0
          pbPCItemStorage
        elsif command==1
          pbPCBanking
        elsif command==2
          pbPCMailbox
        else
          break
        end
      end
    end
     
    Back
    Top