Adventure Game Studio

AGS Support => Beginners' Technical Questions => Topic started by: jamesreg on Mon 21/09/2009 23:18:28

Title: Active inventory Item in a window
Post by: jamesreg on Mon 21/09/2009 23:18:28
How would I go about taking the currently active inventory item and be able to display it in a seperate small window like next to a character portrait or something like that and have it change anytime you change the active inventory item.
Title: Re: Active inventory Item in a window
Post by: Matti on Tue 22/09/2009 00:13:02
Make A GUI or character and change its spriteslot/view according to the active inventory item.
Title: Re: Active inventory Item in a window
Post by: lsb on Tue 22/09/2009 10:41:59
i believe it's (INVSHR) for that, isn't it?
Title: Re: Active inventory Item in a window
Post by: Khris on Tue 22/09/2009 14:05:09
INVSHR...?

// above rep_ex
InventoryItem*oai;  // old active inv

// inside rep_ex
 if (player.ActiveInventory != oai) {   // only change when necessary, not every game loop
   oai = player.ActiveInventory;
   if (oai == null) bAI.NormalGraphic = 0; // remove button image
   else bAI.NormalGraphic = bAI.Graphic;  // set button image to active inv item's sprite
 }


(Assuming there's a non-clickable GUI with a button called "bAI" used to display the inv item.
If the button will still react to mouse hovering / clicking [I haven't tested this], changing the GUI's .BackgroundGraphic instead might be a better idea.)

Edit: Aha! Never seen this before, hehe

Quote from: manualThe default option is the Sierra-style pop-up inventory window, which is popped up by clicking on the Inventory icon on the icon bar. You can also have the current inventory item displayed in its own button on the icon bar by creating a button on the GUI and setting its text to (INV) which stretches the item picture to the button size, or (INVNS) which draws the inventory item picture straight onto the button with no resizing. Finally, (INVSHR) , probably the best option, will draw it at actual size if it will fit, or shrink it if not.