• 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.
  • Our friends from the Johto Times are hosting a favorite Pokémon poll - and we'd love for you to participate! Click here for information on how to vote for your favorites!
  • Serena, Kris, Dawn, Red - which Pokémon protagonist is your favorite? Let us know by voting in our grand final favorite protagonist poll!
  • PokéCommunity supports the Stop Killing Games movement. If you're a resident of the UK or EU, consider signing one of the petitions to stop publishers from destroying games. Click here for more information!
  • 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
  • 525
    Posts
    16
    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
     
    Thank you very much for this,this will be very handy indeed.
     
    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