Adventure Game Studio

AGS Support => Beginners' Technical Questions => Topic started by: remelic on Wed 25/07/2007 10:08:49

Title: Problem with getting inventory items.
Post by: remelic on Wed 25/07/2007 10:08:49
Hi there, new to AGS Forums. Not so new to AGS however this question might sound. But I cant find a way to see if the player actually has an item or not.
It would be nice to have a function like:

bool character.HasInventory(InventoryItem *Id);

to tell the programmer strait out.

So how would the pro's do this in our current version of AGS?

Title: Re: Problem with getting inventory items.
Post by: GarageGothic on Wed 25/07/2007 10:20:47
This exists already in the form of Character.InventoryQuantity[]. That's how the pro's would do it :)

Example:

if (player.InventoryQuantity[iShovel.ID] > 0) player.Say("Wow, I have a shovel!");
Title: Re: Problem with getting inventory items.
Post by: remelic on Wed 25/07/2007 11:08:54
 ;D wow, dont I feel like a noob. Well of course. Thanks.

I was looping through all the inventory items checking for matching names and I thought the InventoryQuantity routine was for inventory items with more then one of the same item. heh.

Thanks again.
Title: Re: Problem with getting inventory items.
Post by: Khris on Wed 25/07/2007 11:22:00
Isn't it supposed to be spelled "pros"? :=