Adventure Game Studio

AGS Support => Beginners' Technical Questions => Topic started by: Babar on Tue 03/08/2004 23:40:44

Title: Multiple Inventories
Post by: Babar on Tue 03/08/2004 23:40:44
Is it possible for 1 character to have more than 1 inventory? I ask because I wanted to have a character that can do magic, and the simplest way I found was to have it as another inventory (somewhat like Quest for Glory). Also, AGS claims to be able to have multiple inventories for different characters. How exactly is this done?
Title: Re: Multiple Inventories
Post by: Akumayo on Wed 04/08/2004 00:31:30
Okay, here is how to do it!!!

Making two Inventories

  If you have a GUI, and it has to buttons, one says Inventory, one says Spellbook.  Make sure that your INVENTORY GUI will fit across the whole screen.  Now, if you click on Inventory, then run script GUIOn(INVENTORY);  Here is the tricky part, create another character named SPELLS, put him in a blank room with no background.  If you click on Spellbook, the run script SetPlayerCharacter(SPELLS);  GUIOn(INVENTORY);
Doing this will make it so that you have both a normal Inventory and a Spellbook inventory.

For adding Items:

For adding to the normal Inventory, just use the AddInventory command
For adding to the Spellbook, first set the player character to SPELLS, then use the AddInventory command.

Did I miss anything???
Title: Re: Multiple Inventories
Post by: Moox on Wed 04/08/2004 01:06:29
You could always use a character exactly the same as your player character  so you cant tell the difference
Title: Re: Multiple Inventories
Post by: Akumayo on Wed 04/08/2004 01:26:57
This is true, but I was thinking that the character SPELLS would be invisable.  I didn't mention that though...
Title: Re: Multiple Inventories
Post by: Babar on Wed 04/08/2004 11:15:23
I had didn't think of using seperate characters. Thanks for the help.
Title: Re: Multiple Inventories
Post by: Ashen on Wed 04/08/2004 11:36:22
QuoteFor adding to the Spellbook, first set the player character to SPELLS, then use the AddInventory command.
Or, create a function to do it for you, e.g.:

function AddSpell(int spell) {
   character[SPELLS].inv[spell] = 1; // add spell
   UpdateInventory();
}
Title: Re: Multiple Inventories
Post by: Ishmael on Wed 04/08/2004 17:17:52
Btw. http://www.agsforums.com/yabb/index.php?topic=6498.0
Title: Re: Multiple Inventories
Post by: Babar on Wed 04/08/2004 18:55:09
Yaiiiii....thanks for the link...I think. The absurd amount of detail that actually goes into this has put me off the spell idea. I will study the template by Scorporious, and maybe be able to do it later. Stupid me for not finding this topic. It had the EXACT same problem as I did.