Adventure Game Studio

AGS Support => Beginners' Technical Questions => Topic started by: Cpt Ezz on Mon 30/03/2009 06:37:47

Title: Banks and the like
Post by: Cpt Ezz on Mon 30/03/2009 06:37:47
I have looked for the answer but i can't find it
How would i make a "bank", so to speak, so i can deposit things, then if i want to view and then take them out into my inventory. could i make a NPC but the sprite is an atm or what???
Title: Re: Banks and the like
Post by: monkey0506 on Mon 30/03/2009 06:40:34
Yes.

All Characters can have inventory, so a Character would be perfect for this actually.

You could quite easily set up a GUI with two inventory windows, load the player's into one and the "ATM"'s inventory into the other. Throw some arrows in the middle and you're good to go.
Title: Re: Banks and the like
Post by: Cpt Ezz on Mon 30/03/2009 06:42:34
cool
but how could i view the persons inventory then chose what to take out??
Title: Re: Banks and the like
Post by: OneDollar on Mon 30/03/2009 22:00:40
When you add an inventory GUI object to a GUI you can set its CharacterID property. This lets you choose which character's inventory it shows. As for taking stuff out, you'd have to do some clever scripting. Either...

1) Set the 'Handle inventory clicks in script' option in the general settings to true and edit the on_mouse_click function in the Global Script, adding conditions for when button == eLeftInv and eRightInv (left and right clicking on a GUI inventory). Code your own interactions so that your main inventory acts as it would if you let AGS handle the interactions for you. Now add a conditional that checks which GUI is being clicked on, and if its the Bank's GUI write a different script that adds the inventory item that was clicked on to the player's inventory and removes it from the bank's inventory.

2) Add a 'deposit/withdraw' button to your GUI then in the function for it's OnClick event check to see what inventory item is active, figure out if the player already owns it and transfer it from one character to the other depending on who's item it is.

Both options require a decent knowledge of AGS scripting (though the second is the easier of the two).
Title: Re: Banks and the like
Post by: Cpt Ezz on Fri 03/04/2009 06:18:39
thank you very much onedollar
Title: Re: Banks and the like
Post by: SSH on Fri 03/04/2009 13:01:32
Make sure you don't let you bank get expose to the sub-prime market.
Title: Re: Banks and the like
Post by: monkey0506 on Thu 09/04/2009 16:39:55
Odds are your bank will probably have to declare bankruptcy and merge with JPMorgan Chase. They'll pick up the tab (https://www.chase.com/index.jsp?pg_name=ccpmapp/shared/marketing/page/tab_en_rules). :P