GUI, Inventory & Menu: Difference between revisions

m
no edit summary
mNo edit summary
 
(17 intermediate revisions by 9 users not shown)
Line 1: Line 1:
{{deprecated}}
==Getting rid of that big gray status bar at the top==
==Getting rid of that big gray status bar at the top==
''When I test my game, there is this gray box at the very top of the screen that I can't get rid of. I don't want it there. What is it, and how do I get rid of it?''
''When I test my game, there is this gray box at the very top of the screen that I can't get rid of. I don't want it there. What is it, and how do I get rid of it?''
Line 37: Line 39:
'''Example:''' You have @SCORE@ out of @TOTALSCORE@ possible points.<br><br>
'''Example:''' You have @SCORE@ out of @TOTALSCORE@ possible points.<br><br>
The Properties window also allows you to align the text to the left, right, or centre, as well as change its font and colour.</blockquote>
The Properties window also allows you to align the text to the left, right, or centre, as well as change its font and colour.</blockquote>
And there you have it.
It may also be helpful to use the [[Description Module]].


==Using a specific inventory item on a hotspot to trigger an action==
==Using a specific inventory item to trigger an action==
''I need a specific inventory item to trigger an action when interacting it with a hotspot. So far, I can only see is to set it so that any item can be used with the hotspot.''
''I need a specific inventory item to trigger an action when interacting it with a hotspot/object/character/other item. So far, I can only see how to set it so that any item can be used.''


If you're using the Interaction Editor, choose "'''Conditional - if inventory item is used'''" action under the "'''Use inventory item on hotspot'''" interaction.
If you're using the Interaction Editor, choose "'''Conditional - if inventory item is used'''" action under the "'''Use inventory item on (whatever)'''" interaction.


Otherwise, if you're using scripting only, use the following code:
Otherwise, if you're using scripting only, use the following code (in AGS V2.62):


   if (player.activeinv == 31) {
   if (player.activeinv == 31) {
Line 51: Line 53:


This will detect whether the player's current inventory item selected is #31, and if so, the code between the braces is run. Take out the // comments if you want.
This will detect whether the player's current inventory item selected is #31, and if so, the code between the braces is run. Take out the // comments if you want.
In AGS V2.7 and higher, use the following code:
  if (player.ActiveInventory==iItem){
    // Place code here
  }
This will detect whether the player's current inventory item selected is iItem.
Rather than using the item numbers, AGS now uses '''script O-Names''': usually ''i'' followed by the item name for inventory items(so, if the item is called ''Key'' the script O-Name will be ''iKey''), which are  shown on the 'Inventory Items' window of the editor).


==Customizing graphics of AGS default GUIs; Creating your own GUIs==
==Customizing graphics of AGS default GUIs; Creating your own GUIs==
Line 84: Line 95:
''How would I go about creating my own custom inventory GUI? I don't much like the default AGS one. OR, I have a problem creating my own inventory GUI. HELP!''
''How would I go about creating my own custom inventory GUI? I don't much like the default AGS one. OR, I have a problem creating my own inventory GUI. HELP!''


Everything you need to know about custom inventory GUIs can be found in [http://www.bigbluecup.com/yabb/index.php?topic=10946.0 this thread].
Everything you need to know about custom inventory GUIs can be found in [http://www.adventuregamestudio.co.uk/forums/index.php?topic=10946.0 this thread].


==Inventory items don't show up==
==Inventory items don't show up==
Line 130: Line 141:


First off, that setting is deceptively named "'''Foreground colour'''" in the AGS Editor, under GUI Properties. Also remember that AGS treats Color #0 (zero) as transparent, so set the GUI's Foreground Color to "0" to get rid of it, or a different pallette color number to change it.
First off, that setting is deceptively named "'''Foreground colour'''" in the AGS Editor, under GUI Properties. Also remember that AGS treats Color #0 (zero) as transparent, so set the GUI's Foreground Color to "0" to get rid of it, or a different pallette color number to change it.
NOTE: As of AGS V2.7, this setting has been renamed "'''Border Color'''".


==Making your GUI modal==
==Making your GUI modal==
Line 147: Line 160:


==Changing AGS's default speech/narrator dialog boxes to your own==
==Changing AGS's default speech/narrator dialog boxes to your own==
''How would I change AGS's default black-and-white dialog boxes into something more colourful? I want to cusomtize the narrator/speech GUIs!''
''How would I change AGS's default black-and-white dialog boxes into something more colourful? I want to customize the narrator/speech GUIs!''


This is found in the AGS manual, albeit a bit hidden:
This is found in the AGS manual, albeit a bit hidden:
Line 159: Line 172:
</blockquote>
</blockquote>


[[Category:AGS Beginners' FAQ]]
 
=="Error: InventoryScreen: one or more of the inventory screen graphics have been deleted"==
''Every time I try to open my Inventory GUI I get this error. What's going on here?''
 
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.adventuregamestudio.co.uk/manual/ags49.htm#character.inventoryquantity 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 the ''character[].inv'' array.
 
[[Category:Beginner Tutorials]]
310

edits