Inv. problem using RON template

Started by Kineferous, Sat 22/10/2005 19:29:54

Previous topic - Next topic

Kineferous

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

Janik

#1
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.
Play pen and paper D&D? Then try DM Genie - software for Dungeons and Dragons!

Candle

#2
Nice work around Janik, I was wondering how to fix that.

Here is a template with the fix.
http://www.mytempdir.com/221743

Kineferous

Worked like a charm. Thanks!

~ Kin

SMF spam blocked by CleanTalk