- 115
- Posts
- 10
- 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:
def pbPCBanking
loop do
command=Kernel.pbShowCommandsWithHelp(nil,
[_INTL("Deposit Money"),
_INTL("Withdraw Money"),
_INTL("Exit")],
[_INTL("Deposit your Money."),
_INTL("Withdraw your Money."),
_INTL("Go back to the previous menu.")],-1
)
if command==0 # Deposit Money
if $game_switches[101]
pbDepositBank
else
#("You don't have a bank account.")
end
elsif command==1 # Withdraw Money
if $game_switches[101]
pbWithdrawBank
else
#("You don't have a bank account.")
end
else
break
end
end
end
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:
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
if command==1
pbPCBanking
elsif command==2
pbPCMailbox
else
break
end
end
end
end
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?
Spoiler:
def pbPCBanking
loop do
command=Kernel.pbShowCommandsWithHelp(nil,
[_INTL("Deposit Money"),
_INTL("Withdraw Money"),
_INTL("Exit")],
[_INTL("Deposit your Money."),
_INTL("Withdraw your Money."),
_INTL("Go back to the previous menu.")],-1
)
if command==0 # Deposit Money
if $game_switches[101]
pbDepositBank
else
#("You don't have a bank account.")
end
elsif command==1 # Withdraw Money
if $game_switches[101]
pbWithdrawBank
else
#("You don't have a bank account.")
end
else
break
end
end
end
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:
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
if command==1
pbPCBanking
elsif command==2
pbPCMailbox
else
break
end
end
end
end
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?