Adventure Game Studio

AGS Support => Beginners' Technical Questions => Topic started by: Monsieur OUXX on Mon 06/08/2007 14:39:15

Title: test if player has an object in inventory
Post by: Monsieur OUXX on Mon 06/08/2007 14:39:15
Hello,

I'm feeling REALLY stupid about this... I've been looking for more than 20 minutes in the forum but i can't find the answer to my really really really stupid question. the answer is probably obvious but I don't know what keyword I could use for a successfull search.

I just can't remember how to test if the player has an object in his inventory or not...
Title: Re: test if player has an object in inventory
Post by: Ashen on Mon 06/08/2007 15:04:02
Use the Character.InventoryQuantity (http://www.adventuregamestudio.co.uk/manual/Character.InventoryQuantity.htm) property, e.g.:

if (player.InventoryQuantity[iKey.ID] == 0) Display("You don't have the key.");


I know this has been asked before (http://www.adventuregamestudio.co.uk/yabb/index.php?topic=31940.0), odd that nothing turned up in your search.

EDIT:
Actually, since it's been asked a few times now: BFAQ'd (http://americangirlscouts.org/agswiki/GUI%2C_Inventory_%26_Menu#Checking_if_the_player_has_a_certain_Inventory_Item)