Author Topic: Can I check the graphic of *only* an inventory item?  (Read 383 times)

bx83

  • Get 'Er Doooooone
I'd like to write something like this:

Code: Adventure Game Studio
  1. if (cCharacter.HasInventory(iItem) && this item we've been talking about is iItem and iItem.Graphic==123) {
  2. ...

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

  • Get 'Er Doooooone
Re: Can I check the graphic of *only* an inventory item?
« Reply #1 on: 03 Mar 2018, 04:23 »
Basically, do I have to invoke Inventory* or somesuch thing?

Crimson Wizard

  • AGS Project Tracker Admins
    • Best Innovation Award Winner 2013, for spearheading the AGS 3.3.0 project
    •  
    • Lifetime Achievement Award Winner
    •  
    • Crimson Wizard worked on a game that was nominated for an AGS Award!
      Crimson Wizard worked on a game that won an AGS Award!
Re: Can I check the graphic of *only* an inventory item?
« Reply #2 on: 03 Mar 2018, 10:10 »
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: Adventure Game Studio
  1. if (iItem.Graphic==123)
  2.  
This is working code, regardless of whether iItem is in character's inventory or not.

PS. This is really not an "advanced technical" question.
« Last Edit: 03 Mar 2018, 10:39 by Crimson Wizard »

bx83

  • Get 'Er Doooooone
Re: Can I check the graphic of *only* an inventory item?
« Reply #3 on: 03 Mar 2018, 10:37 »
Okay, I'm elucidated.
PS sorry, was complex to me :p