Problem with getting inventory items.

Started by remelic, Wed 25/07/2007 10:08:49

Previous topic - Next topic

remelic

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?

You should have turned right instead.

GarageGothic

#1
This exists already in the form of Character.InventoryQuantity[]. That's how the pro's would do it :)

Example:

Code: ags
if (player.InventoryQuantity[iShovel.ID] > 0) player.Say("Wow, I have a shovel!");

remelic

 ;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.
You should have turned right instead.

Khris

Isn't it supposed to be spelled "pros"? :=

SMF spam blocked by CleanTalk