Adventure Game Studio

AGS Support => Beginners' Technical Questions => Topic started by: Aviva on Sat 21/10/2017 09:15:52

Title: Using an inventory item on a GUI element
Post by: Aviva on Sat 21/10/2017 09:15:52
Hey people!

I am looking for a way to use an inventory item on a GUI element. The goal is to make the user select an inventory object and use it as a weapon against enemies. Any ideas?

(https://ibin.co/w800/3eWlG2QhK8RQ.png)
Title: Re: Using an inventory item on a GUI element
Post by: Khris on Sat 21/10/2017 09:40:21
If the GUI element is a button, just use its OnClick handler and in there, check
  if (mouse.Mode == eModeUseinv && player.ActiveInventory == iBlueCube) {

If the GUI element isn't a button, turn it into a button.

If that's not feasible, use on_event / eEventGUIMouseUp and GUIControl.GetAtScreenXY(mouse.x, mouse.y)
Title: Re: Using an inventory item on a GUI element
Post by: Aviva on Sat 21/10/2017 13:50:50
Works like a charm ;-D:-D Thanks Khris!