Banks and the like

Started by Cpt Ezz, Mon 30/03/2009 06:37:47

Previous topic - Next topic

Cpt Ezz

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???

monkey0506

#1
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.

Cpt Ezz

cool
but how could i view the persons inventory then chose what to take out??

OneDollar

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

Cpt Ezz

thank you very much onedollar

SSH

Make sure you don't let you bank get expose to the sub-prime market.
12

monkey0506

Odds are your bank will probably have to declare bankruptcy and merge with JPMorgan Chase. They'll pick up the tab. :P

SMF spam blocked by CleanTalk