• 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.
  • There is an important update regarding account security and 2FA. Please click here for more information.
  • ❤️ It's that time of the year again - Happy Valentine's Day! Luvdisc is back to help spread the luv again. Interested in sending a message of appreciation to some special users on the site, and earning a brand-new badge in the process? Then 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.
  • Imgur has blocked certain regions from viewing any images uploaded to their site. If you use Imgur, please consider replacing any image links/embeds you may have on PokéCommunity so everyone can see your images. Click here to learn more.

Simple bank system

zingzags

PokemonGDX creator
  • 535
    Posts
    17
    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