Adventure Game Studio

AGS Support => Beginners' Technical Questions => Topic started by: Akril15 on Sun 05/06/2011 23:34:30

Title: Sierra-style inventory window behaves like LucasArts inventory window - solved
Post by: Akril15 on Sun 05/06/2011 23:34:30
Sorry for posting here so persistently, but I've encountered a fairly problematic feature in my game.

I didn't realize this until now, but with a Sierra-style inventory window, if the player selects an inventory item and uses it on a hotspot, object or character in the scene behind the inventory GUI, the game will attempt to carry out whatever scripts are associated with the hotspot, object or character in question. In other words, even though the inventory GUI pauses the game when shown, it behaves like a LucasArts inventory GUI, which is always on the screen.

This can be a real problem in some cases. For example, if the player uses a certain inventory item on a hotspot in my game, the player character will walk to that location, an animation will play, and another GUI will open. However, if the player uses that item on the hotspot while the inventory window is open, the wait cursor appears and the game locks up.

I wasn't sure how I might go about fixing this problem. My first thought was to surround the inventory window with a nearly invisible background that covered the entire screen, preventing the player from interacting with anything behind the GUI. However, such a large transparent GUI makes the mouse move a bit sluggishly when the inventory is open. Are there any alternative methods I could possibly try?
Title: Re: Sierra-style inventory window behaves like LucasArts inventory window
Post by: Khris on Sun 05/06/2011 23:48:47
You can intercept clicks on the game when the inventory GUI is open:

// top of on_mouse_click
  if (gInventory.Visible && (button == eMouseLeft || button == eMouseRight)) return;


Now only clicks on the GUI or inventory items are processed.
Title: Re: Sierra-style inventory window behaves like LucasArts inventory window
Post by: Akril15 on Mon 06/06/2011 00:23:47
Thank you, Khris! That was all it took to fix things.