Hello,

I am incredibly excited to offer the 3d GameStudio community a flexible inventory system for lite-c. I'm usually pretty humble about my code, but I think that this is something special. Here are some of the features:

  • You can pop open multiple inventory bags and move items from bag to bag.
  • You can drag bags around and the panel layers are handled automatically for you. For example, if you have a few bags that overlap, clicking the one in the center will bring it forward.
  • The system supports callbacks so your code can tell what's going on.
  • It's easy to use. You don't need to touch the inventory code at all.
  • "Slot types", such as weapon slots, are supported.


Here's a youtube video showing it in action, although the arrow pointer doesn't show up in my video:

http://www.youtube.com/watch?v=r6tv3YM1SYg

I've created a demo that you can download at:

http://www.indiegamejobs.com/temp/inventory_demo.zip

The demo uses images from World of Warcraft because I didn't have any inventory images handy. Obviously, don't use those images in games. In the demo, press 'a' to open bag1. Press 's' to open bag2. Press 'd' to open bag3. Press 1 or 2 to add items to the inventory. Press z to close the demo.

Here's a excerpt from the demo lite-c:

Code:

item_sand = inv_create_item(1,0,"item1.pcx","item1.pcx");
item_wool = inv_create_item(2,0,"item2.pcx","item2.pcx");

// Create bag 1

bag = inv_create_bag(1,"pack.pcx");
inv_set_bag_drag_region(bag,5,3,128,18);
inv_set_bag_close_region(bag,129,0,148,19);

inv_add_slot_to_bag(bag,1,0,"slot_bg.pcx",9,38);
inv_add_slot_to_bag(bag,2,0,"slot_bg.pcx",44,38);
inv_add_slot_to_bag(bag,3,0,"slot_bg.pcx",78,38);
inv_add_slot_to_bag(bag,4,0,"slot_bg.pcx",112,38);

inv_insert_item_into_bag(bag,item_wool);



Documentation can be found on the wiki here: http://www.coniserver.net/wiki/index.php/Inventory.c_docs

I'm going to keep working on the inventory as I build out my game. However, it should be usable as-is. I've posted the main files on the wiki too so that people can continue the project if I get too wrapped up with my day job. Here's the wiki page:

http://www.coniserver.net/wiki/index.php/Clone45%27s_Inventory_Framework

A special thanks to everyone who takes the time to answer questions on these forums. You are awesome!

- Bret