Adventure Game Studio

AGS Support => Advanced Technical Forum => Topic started by: Captain Mostly on Thu 05/06/2003 21:19:25

Title: duplicate inv items
Post by: Captain Mostly on Thu 05/06/2003 21:19:25
is there any way to tell the inventory to display duplicate items seperatly (i.e. not show the item just once in the inventory list if it appears twice or more)?

If not, would it be possible to build into a custom GUI a feature that displays "X2" next to items you have twice (or "X3" or 4 or however many the player has)...
Title: Re:duplicate inv items
Post by: Proskrito on Thu 05/06/2003 21:50:49
Do you mean as the coins in MI2 or the orichalcum bullets in FOA? if so, if i.e. your coins inventory is #6, you could modify the amount of coins by modifying the variable character[EGO].inv[6], like, if you wantto add 60 coins to the inventory, you could write: character[EGO].inv[6]+=60; , and then , when you look to the inventory object, write something like: Display("I have %d coins",character[EGO].inv[6]); and it would say the coins you have.
If you werent asking that, i think you should make different inventory items for each one.
Title: Re:duplicate inv items
Post by: Scummbuddy on Thu 05/06/2003 21:52:47
You could just create another inventory item with the same graphic.  The coding does not follow the name used, just the inventory number it corresponds with on the inventory screen.
Title: Re:duplicate inv items
Post by: Captain Mostly on Thu 05/06/2003 22:17:11
thanks for the help... it's all so tricky though!
Title: Re:duplicate inv items
Post by: Captain Mostly on Thu 05/06/2003 22:18:58
is it possible to have part of a GUI that displays a number when the pointer is over an inventory object?

i.e.

if I had 15 peas, and I pointed to them in the inventory, would it be possible to have a GUI label display the number of peas I had automatically, without me having to click?
Title: Re:duplicate inv items
Post by: Proskrito on Thu 05/06/2003 23:12:52
yes, it would be something like:

(within the repeatedly_execute function):
string buffer;
StrFormat(buffer,"%d",character[EGO].inv[GetInvAt(mouse.x,mouse.y)]);
SetLabelText(GUI,label#,buffer);

(or this, that is the same but a bit cleaner:)

int invitem,invitemamount;
string buffer;
invitem=GetInvAt(mouse.x,mouse.y);
invitemamount=character[EGO].inv[invitem];
StrFormat(buffer,"%d",invitemamount]);
SetLabelText(GUI,label#,buffer);

change label# with the label you want to display it

Note that the "normal" inventory items will display a "1"
Title: Re:duplicate inv items
Post by: Pumaman on Fri 06/06/2003 16:24:53
A feature like this was requested by Chrille a while back, I've added it to the tracker now to make sure it doesn't get forgotten:

http://www.agsforums.com/tracker.php?action=detail&id=68