Dont hate me--- Suggestion-- Inventory variables.

Started by Joseph DiPerla, Tue 17/06/2008 21:37:31

Previous topic - Next topic

Joseph DiPerla

I know this can be done already by creating several characters and using their inventories to be displayed in a certain inventory window. But it gets too sloppy, particularly if you have four characters who use 3 different inventories. Plus it could get confusing when scripting it.

My suggestion would be to be able to add Inventory type numbers to an inventory object. For instance, so I have a key. Under the type for it I would put a 1 in it. For a magic potion, I would put a 2 in there. For a gun, I would put a 3  etc.. So basically I have defined for myself that 1 is a normal item, 2 is a magic item and 3 is a weapon.

So if I want an inventory window to display weapons, I would then put in its properties for inventory type to display a 3.

And perhaps some scripting options to change inventory type to display for an Inventory window and to change the type of an inventory as well?

Would this be possible? Would offer some cleaner organization for our games.
Joseph DiPerla--- http://www.adventurestockpile.com
Play my Star Wars MMORPG: http://sw-bfs.com
See my Fiverr page for translation and other services: https://www.fiverr.com/josephdiperla
Google Plus Adventure Community: https://plus.google.com/communities/116504865864458899575

GarageGothic

#1
You could make a custom "type" property for the inventory item and then filter items with the appropriate value when filling up your inventory window.

Edit: A long time ago I wrote some code for sorting the inventory here. The only difference you want to make is to avoid  the bubble sort part (assuming you want to keep them in the order they were picked up). And then add a conditional check that only writes them back to the inventory window if the type property is the right value.
You'll want to keep the contents of the array so that you can restore the full inventory when the user closes the window or changes the filter mode. Also be aware that you will have to add your own function for new inventory items being added/removed (for instance during inventory combination puzzles) while the filtered inventory is being displayed, as the new items are not part of your stored list. If you read the full inventory back to the inventory window last-to-first, you could just let your own AddItem function add the new items at the end of the array, and your RemoveItem set those items that were removed to an invalid value (e.g. -1)  and don't add those back.

Joseph DiPerla

Good idea. I guess I can use the Property function. Only problem would be on how to filter it in the inventory window. There's no option to filter items with a certain property and I found no help or scripting option on this in the manual. How would you go about this?
Joseph DiPerla--- http://www.adventurestockpile.com
Play my Star Wars MMORPG: http://sw-bfs.com
See my Fiverr page for translation and other services: https://www.fiverr.com/josephdiperla
Google Plus Adventure Community: https://plus.google.com/communities/116504865864458899575

GarageGothic

Check my edit that I wrote while you posted.

Joseph DiPerla

I guess I can try to use that. But if Chris could implement the feature, it would be a lot less confusing and a lot cleaner to use as well. The less coding I do, the less the errors :) I suck at coding in C++/C#/Java syntax.
Joseph DiPerla--- http://www.adventurestockpile.com
Play my Star Wars MMORPG: http://sw-bfs.com
See my Fiverr page for translation and other services: https://www.fiverr.com/josephdiperla
Google Plus Adventure Community: https://plus.google.com/communities/116504865864458899575

Pumaman

Is this something that other people would find useful?

GarageGothic

#6
I think it's a bit silly to spend time implementing something into the engine that could be done as a module in about half an hour. But by all means, if it's trivial to implement a filter-by-property function for inventory windows, I'm sure a lot of people - especially those making RPGs - would find it useful.

SMF spam blocked by CleanTalk