Adventure Game Studio

AGS Support => Beginners' Technical Questions => Topic started by: Monsieur OUXX on Thu 16/08/2018 15:09:17

Title: [SOLVED] how do you access inventory objects by index?
Post by: Monsieur OUXX on Thu 16/08/2018 15:09:17
EDIT: (that's frustrating, lately I find the solution to my problems the exact second after I post and it's too late to take it back)
Solved: array inventory does not exist until you create at least one inventory item in the editor.

Spoiler

Um, that's embarrassing for me: how do you do inventory[id] in the latest AGS? I can't find array inventory anywhere. I tried the help, I tried player.inventory, game.inventory...
[close]
Title: Re: [SOLVED] how do you access inventory objects by index?
Post by: Crimson Wizard on Thu 16/08/2018 15:54:01
This is a known issue, because AGS script cannot declare static array of 0 size. The only way to solve this for the future is to declare array property and use that instead (e.g. Game.InventoryItems[]).