Can I check the graphic of *only* an inventory item?

Started by bx83, Sat 03/03/2018 04:22:35

Previous topic - Next topic

bx83

I'd like to write something like this:

Code: ags

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 :/

bx83

Basically, do I have to invoke Inventory* or somesuch thing?

Crimson Wizard

#2
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

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.

bx83

Okay, I'm elucidated.
PS sorry, was complex to me :p

SMF spam blocked by CleanTalk