Weapon Inventory and how to script weapons.

You’re welcome of course.

One thing you could try to really get a “feel” for what happens in this case is make a simple script that is just one cell of your inventory. Put this into a script that you can access through an “inventory API” that does certain things to a cell.

These functions might be:

“Set the type of item”
“Query the type and quantity of item in this cell”
“Add 1 item to this cell.”
“Add N number of items to this cell.”
“Remove N item from this cell.”

Then you can have properties in the cell that say “I can hold only 1 item” or “I can hold up to 30 items” inside a particular cell.

Make some test buttons on a screen to do the above items, and also print out what’s in the cell.

If you get that going you have done a huge amount of the work.

After that you need the aggregate collection of these things. That would have its own API, perhaps things that say:

“Give me a blank cell, I have something for you” (you get a cell, you call the above set type, set quantity)
“Find me a cell with N number of items of type X”

That’s breaking the problem down into steps.

1 Like