The PokéCommunity Forums  

Go Back   The PokéCommunity Forums > Creative Discussions > Game Development > Scripts & Tutorials
Sign Up Rules/FAQ Live Battle Blogs Mark Forums Read

Notices

Scripts & Tutorials This forum is for scripts and code, as well as all kinds of tutorials, software, tools and so forth. Remember to give credit!
The thread revival limit does not apply here.


Advertise here

Reply
 
Thread Tools
  #1    
Old July 18th, 2012, 07:38 PM
zingzags's Avatar
zingzags
Creator or Pokemon Serenity
 
Join Date: Jan 2009
Location: Boston
Age: 20
Nature: Adamant

Advertise here
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
__________________
Pokemon Serenity is my fangame name.
name decided 12/15/09
Currently helping:
Pokemon ebony
and
Xenotime:
Reply With Quote
  #2    
Old July 18th, 2012, 08:03 PM
shadowriver
Beginning Trainer
 
Join Date: Sep 2007
Gender:
Thank you very much for this,this will be very handy indeed.
__________________
V8 Essentials with Ultimate BW Pack and pokemon follow ready to go.
(I had nothing to do with its creation just put it together for genarl use) http://www.mediafire.com/?rtrco39udskdb81
Credits go to
p-Sign
Clowcardruler
Maruno
Venom12
FL .
Help-14
zingzag
rick1234
Reply With Quote
  #3    
Old July 19th, 2012, 01:59 AM
p.claydon
 
Join Date: Jan 2011
Gender:
lol looks like a similar script i made for money storage with the players mother

Quote:
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
Reply With Quote
  #4    
Old July 19th, 2012, 07:09 AM
zingzags's Avatar
zingzags
Creator or Pokemon Serenity
 
Join Date: Jan 2009
Location: Boston
Age: 20
Nature: Adamant
Quote:
Originally Posted by p.claydon View Post
lol looks like a similar script i made for money storage with the players mother
Its the same math really.
__________________
Pokemon Serenity is my fangame name.
name decided 12/15/09
Currently helping:
Pokemon ebony
and
Xenotime:
Reply With Quote
Reply
Quick Reply

Sponsored Links


Advertise here
Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Minimum Characters Per Post: 25



All times are UTC -8. The time now is 09:10 AM.


Style by Nymphadora, artwork by Sa-Dui.
Like our Facebook Page Follow us on Twitter © 2002 - 2014 The PokéCommunity™, pokecommunity.com.
Pokémon characters and images belong to The Pokémon Company International and Nintendo. This website is in no way affiliated with or endorsed by Nintendo, Creatures, GAMEFREAK, The Pokémon Company or The Pokémon Company International. We just love Pokémon.
All forum styles, their images (unless noted otherwise) and site designs are © 2002 - 2014 The PokéCommunity / PokéCommunity.com.
PokéCommunity™ is a trademark of The PokéCommunity. All rights reserved. Sponsor advertisements do not imply our endorsement of that product or service. User generated content remains the property of its creator.