Game Development Community

Dynamic Inventory

by Greyfort · in Torque 3D Public · 12/04/2011 (4:05 pm) · 2 replies

engine: T3D

I am attempting to make a Dynamic Inventory thats what I think they call it. I would like a inventory that uses 2d icons 32x32 pixels for the smallest icons that represent the 3d object in the world. Lets start small a daggers small Inv_icon_size 32x32. In short its similar the Never Winter Nights 1 inventory:

I am unsure exactly how to implement this in a gui. With gui editor I see I can make a drag n drop control, yet im un sure how to go about checking for icon sizes and inventory space with in the torque script. I see the torque script is a invisible inventory, or I haven�t found the Gui yet.
some here http://www.garagegames.com/community/forums/viewthread/16538 mentioned something about NWScript as far as storing data with an object.

Any Ideas on how to go about implementing a Gui like this?

#1
01/08/2012 (6:41 pm)
Though I don't have an answer, your query is on an interesting topic, being new to T3D. I'll be interested to see if anyone has some ideas in the context of TorqueScript, so will probably check this thread to what comes about : ) See your post has hung around for awhile with out a bite : (
#2
01/09/2012 (6:51 am)
Quote: im un sure how to go about checking for icon sizes

If you want to find out the size of an icon, you can call getExtent(), which returns the X and Y size of the icon. You can also call setExtent(), or simply set the extent like so: iconName.extent = "X Y";

Quote:and inventory space with in the torque script

Well, depends on how you're managing space. Not being familiar with NWN1, I'm not sure how it did it, but two main ways of managing space in inventories is to either use the "slot method", which is fairly straightforward, or using the icon size in a grid to determine if it can "fit" in the inventory space. If you mean the latter, then you can set up the grid as a 2D array, and then check the grid positions in the array where you want to drop an item to see if they're occupied, and if they are, you don't insert the item there, and if not, you do. The array itself can be the inventory system, and that allows you to hold a lot of information in there (icon name, item name, size, quantity, etc).

So all of that is fairly easy to do.