Inventory System, ala Deus Ex.

Doomsayer

Newbie
Joined
Apr 27, 2005
Messages
42
Reaction score
0
I'm learning coding, and my first task as given by my mod leader, I need to make an inventory system, similar to the one in Deus Ex (Here's a link for those who don't know what I'm talking about http://www.macledge.com/Reviews00/deus-ex/inventory.gif). Now, I have no clue how to do this (I personally think this is a big project for me, but he says it's no rush to finish).

The idea is, that when you pick up a weapon (Actually, I need to learn how to script that too, pick-up-on-click), a sprite is added to your grid-based inventory. That sprite can be moved around as need be, but also needs to be able to be dragged to a "toolbar" on the bottom (Need to learn how to do that too, apparantly. Wait, why am I the ONLY coder on the team?). Um... does anyone know how to do that? Or at least have some ideas? I would be forever indebted to you if you did. Thank you.
 
One answer - difficult. Although I have some source code here that explains how to do it regardless of engine.

Turning the oject into a sprite should be simple enough, so I won't walk you through that. Calculating inventory space, however, is a little harder. The way the X-Com games did it was by each object, in a code sense, only existing on one tile in the inventory. However, a number in the object would state the size of it, so all of the squares in the "size" region become illegal targets for a "put away" command. The object usually existed as the top left corner.

As far as I know, that's also how Diablo and Deus Ex handled it, too.

-Angry Lawyer
 
Angry Lawyer came and once again has thrown down a lightning bolt of coding fury from the heavens and said taketh and eat... and your coding will be successful.
 
It's not that hard. The way I did it (well, not exactly inventory but something very similar), is modifiy VGUI2 and add some of my own elements, derived from panels and buttons. There is a separate vgui_controls project in the src sdk, if you modify that project you can make a custom vgui_controls.lib and add new elements to vgui (to exist alongside Panel,Frame, etc) Add functionality you need, add some extra variables to store things like gridposition, and you'll be able to use text resource files to add new inventory elements.

HUD coding is not that hard, but be prepared for a lot of tedious work.
 
Back
Top