Adventure Game Studio

AGS Support => Beginners' Technical Questions => Topic started by: on Sat 22/10/2005 19:29:54

Title: Inv. problem using RON template
Post by: on Sat 22/10/2005 19:29:54
Hi, all. I'm currently working on my first game and using the Reality-on-the-norm template. The inventory GUI is different from the default, so I think this might be where my problem lies. Here goes:

I want the player to pick up an object and have it placed in the inventory. Simple, right? That's what I thought. I created an inventory item (stone1) and I made it so when the player interacts with the stone, it disappears and places stone1 in the player's inventory panel. Well, when the player interacts with the object, the object disappears but when player clicks on the inventory panel, it says "You are currently holding nothing". Wondering if it was a bug, I tried making it so the stone1 showed up in the inventory when you start the game. That worked. But I can't get it to enter the inventory when you interact with it. Any ideas? Thanks in advance.

~ Kin
Title: Re: Inv. problem using RON template
Post by: Janik on Sat 22/10/2005 19:42:14
I ran into the same problem with the template. If you change the global script here:

Quotefunction show_inventory_window () {
  if(game.num_inv_items > 0) {      // ** CUSTOM INVENTORY WINDOW

to

Quote
  if(game.num_inv_items >= 0) {      // ** CUSTOM INVENTORY WINDOW

it will show the window, but for some reason game.num_inv_items seems to return 0 even if you have 1 item, so you don't get the "You are not carrying anything" message.

Edit:
Here's a better solution.
Go to the GUI named INVENTORY.
Select the box where inventory is displayed
In the properties, double-click Script Name and say "gInvWindow"
Your global code becomes:
Quote
  if(gInvWindow.ItemCount > 0) {      

And it works as intended. My guess is that since game.num_inv_items is now obsolete, it may have gotten broken slightly.
Title: Re: Inv. problem using RON template
Post by: Candle on Sat 22/10/2005 19:53:26
Nice work around Janik, I was wondering how to fix that.

Here is a template with the fix.
http://www.mytempdir.com/221743
Title: Re: Inv. problem using RON template
Post by: on Sat 22/10/2005 22:59:33
Worked like a charm. Thanks!

~ Kin