Adventure Game Studio

AGS Support => Advanced Technical Forum => Topic started by: bx83 on Sat 03/03/2018 04:22:35

Title: Can I check the graphic of *only* an inventory item?
Post by: bx83 on Sat 03/03/2018 04:22:35
I'd like to write something like this:


if (cCharacter.HasInventory(iItem) && this item we've been talking about is iItem and iItem.Graphic==123) {
...


If I just say this, the second part of the expression is not necessarily associated with a item actually in your inventory -- in fact, does it just mean 'the graphic of the general item', and not the one you may/may not have?

Confused :/
Title: Re: Can I check the graphic of *only* an inventory item?
Post by: bx83 on Sat 03/03/2018 04:23:18
Basically, do I have to invoke Inventory* or somesuch thing?
Title: Re: Can I check the graphic of *only* an inventory item?
Post by: Crimson Wizard on Sat 03/03/2018 10:10:53
Quote from: bx83 on Sat 03/03/2018 04:22:35
If I just say this, the second part of the expression is not necessarily associated with a item actually in your inventory -- in fact, does it just mean 'the graphic of the general item', and not the one you may/may not have?

In AGS there is no difference between "general item" and item in someones inventory. Multiple characters may "have" same item, and it works like they have "references" to that item in their inventories, because if you modify a "general item" in any way (like change its graphic), it will be modified for every owner too.

For that reason items have only one graphic, and only one.
Code (ags) Select

if (iItem.Graphic==123)

This is working code, regardless of whether iItem is in character's inventory or not.

PS. This is really not an "advanced technical" question.
Title: Re: Can I check the graphic of *only* an inventory item?
Post by: bx83 on Sat 03/03/2018 10:37:08
Okay, I'm elucidated.
PS sorry, was complex to me :p