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

Simple bank system

zingzags

PokemonGDX creator
536
Posts
15
Years
  • In your settings add this
    BALANCE=X where "X" is the game variable which holds the data which is used for the bank.
    Just call pbDeposit, or pbWithdraw in an event.
    Enjoy

    Code:
    class Bank
    
    def pbDeposit
    params=ChooseNumberParams.new
    params.setRange(1,$Trainer.money)
    params.setInitialValue($Trainer.money)
    params.setCancelValue(0)
    qty=Kernel.pbMessageChooseNumber(_INTL("Teller: How much would you like to deposit?"),params)
    newmoney=$Trainer.money-qty
    store=$Trainer.money-newmoney
    $game_variables[BALANCE]=$game_variables[BALANCE]+store
    $Trainer.money=newmoney
    end
    
    def pbWithdraw
    params=ChooseNumberParams.new
    params.setRange(1,$game_variables[BALANCE])
    params.setInitialValue($game_variables[BALANCE])
    params.setCancelValue(0)
    qty=Kernel.pbMessageChooseNumber(_INTL("Teller: How much would you like to withdraw?"),params)
    newmoney=$Trainer.money+qty
    remove=$game_variables[BALANCE]-qty
    $game_variables[BALANCE]=remove
    $Trainer.money=newmoney
    end
    
    end
    
    class BankScreen
     def initialize(scene)
      @scene = scene
     end
     def pbStartScreen
       @scene.pbDeposit
     end
     def pbStartScreen2
       @scene.pbWithdraw
     end
    end
    Please use credits
     
    423
    Posts
    13
    Years
    • Seen Aug 31, 2023
    lol looks like a similar script i made for money storage with the players mother

    def withdrawmommoney
    params=ChooseNumberParams.new
    params.setRange(0,$game_variables[30])
    params.setInitialValue(1)
    params.setCancelValue(0)
    qty=Kernel.pbMessageChooseNumber(
    _INTL("How much to withdraw."),params
    )
    if qty>0
    $Trainer.money+=qty
    $game_variables[30]-=qty
    Kernel.pbMessage(_INTL("${1} was added.",qty))
    else
    Kernel.pbMessage(_INTL("no money was added."))
    end
    end

    def depositmommoney
    params=ChooseNumberParams.new
    $game_variables[31]=$Trainer.money
    params.setRange(0,$game_variables[31])
    params.setInitialValue(1)
    params.setCancelValue(0)
    qty=Kernel.pbMessageChooseNumber(
    _INTL("How much to deposit."),params
    )
    if qty>0
    $Trainer.money-=qty
    $game_variables[30]+=qty
    Kernel.pbMessage(_INTL("${1} was stored.",qty))
    else
    Kernel.pbMessage(_INTL("no money was stored."))
    end
    end

    def mommoney
    Kernel.pbMessage(_INTL("You have ${1}",$game_variables[30]))
    withdrawmommoney
    depositmommoney
    end
     
    Back
    Top