Adventure Game Studio

AGS Support => Beginners' Technical Questions => Topic started by: Joacim Andersson on Mon 18/11/2024 23:25:36

Title: [RESOLVED] Can I get the index (position) of an InventoryItem in the inv list
Post by: Joacim Andersson on Mon 18/11/2024 23:25:36
Well, the subject pretty much say it all. I want to get the position in the inventory list an InventoryItem is at, the whole reason is that in my game when you use the item in a special way, it is supposed to change. So I want to replace it with another item, but let the new item be in the same position in the list.

I've searched through the help file but we no success.
Title: Re: Can I get the index (position) of an InventoryItem in the inventory list
Post by: eri0o on Tue 19/11/2024 03:01:10
You can use ItemAtIndex from the InventoryWindow you are using to check all the indexes until ItemCount, so you can know the index of your specific inventory item.
When you do player.AddInventory, the second parameter is the desired index.
Title: Re: Can I get the index (position) of an InventoryItem in the inventory list
Post by: Joacim Andersson on Tue 19/11/2024 09:19:24
Perfect, thank you!