GUI, Inventory & Menu: Difference between revisions

no edit summary
m (→‎Adding score/hotspot info to the big grey status bar: Descriptions Module -> Description Module)
*>Ashen
No edit summary
Line 175: Line 175:


This is most likely to happen if you've started a game using the 'Empty' template. This starts a game with NO existing sprites - which includes the ones needed by the default Inventory GUI. You'll need to import three sprites to be used for the 'Look at', 'Use' and 'OK' buttons. Then, right-click them, select 'Change sprite number ...' and renumber them to 2041, 2042 and 2043 respectively.
This is most likely to happen if you've started a game using the 'Empty' template. This starts a game with NO existing sprites - which includes the ones needed by the default Inventory GUI. You'll need to import three sprites to be used for the 'Look at', 'Use' and 'OK' buttons. Then, right-click them, select 'Change sprite number ...' and renumber them to 2041, 2042 and 2043 respectively.
==Checking if the player has a certain Inventory Item==
''I want an interaction to happen only when the player has an Inventory Item (like a key to open a door) OR something not to happen when the player has an Item. How do I do that?''
Simply use the [http://www.bigbluecup.com/manual/Character.InventoryQuantity.htm InventoryQuantity] property, e.g.:
  if (player.InventoryQuantity[iKey.ID] == 0) Display("You don't have the key.");
Or:
  if (player.InventoryQuantity[iStolen.ID] != 0) Display("You can't go in there carrying Stolen goods.");
If you want to stop the player from taking an Item multiple times (like taking someting out of a drawer), you're better using a variable. If you use InventoryQuantity and the player can lose the Item later in the game, they'll be able to go back and pick it up again.
'''Note:'''
* The InventoryQuantity property was introduced in V2.7. Before that, use teh ''character[].inv'' array.
[[Category:AGS Beginners' FAQ]]
[[Category:AGS Beginners' FAQ]]
Anonymous user