best method for an rpg inventory

This forum is currently in read-only mode.
From the Asset Store
Best car suspension with spring effect and very cool terrain generation.
  • so for something similar to diablo (not the grid storage thing, just the random items) what would be the best storage method for a database? text files or an array?

    you have a variety of different objects that have a long list of possible variable changes, new skills more damage, poisoning ext. yet you have relatively simple objects such as potions and scrolls all being stored in(what i amuse to be)just one array.

    would it be better to have the objects id number stored in an array and have the actual object effects referenced in a text file witch tell what exactly the said object dose.(if thats possible.)

    Or have a huge array with a long y/z length to accommodated all possible actions that gets checked

    and populate the inventory array with this info when needed.

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • I think it may be best to use arrays. One guy here showed me a simple diablo like inventory before. Sorry but I forgot who gave it lol! And I don't have the file anymore so... sorry.

  • I think it could work if you do this way:

    Array1 contains all possible prefixes

    Array2 contains all possible suffixes

    Array3 contains all weapons

    Array4 starts empty

    When the enemy drops a weapon, gamble for a random weapon from Array3, at a 50% chance, gamble for a prefix from Array 1 and a suffix from Array2

    Store those results on Array4. So Array4 would look like this:



    1,3:of Doom

    And on your inventory system, call for the weapon n# 1 from array 4 and that will be "Dark Sword of Doom"

    But that's just the tip of the iceberg of course...

    If you want, look for "LoD Kompendium v12" on google, they have the complete information on how D2 drop mechanics work, and a lot of other stuff too

  • I hate to bring it up again, but your best bet for a fully featured inventory system would be to use the S(uperstructure) plugin. Might be a hassle to learn at first, but it surely pays off in the long run.

    Also this older answer to a similar thread has links to several different inventory examples:

  • thanks for the reply's.

    i was kinda thinking thee 4 arrays system originally ,thanks for the search tips 7soul.

    but apparently there's a whole host of ways to go about it.

    I've seen the Superstructure plugin before but wasn't working on anything it applied to at the time

    forgot it existed, guess ill give it a shot. i hate to see all the work i did so fare be for nothing though. oh well apparently that's just how programing goes.

  • there is a method for this type of inventory pixelrebirth made.. take a look:

    Oh since we're in a sharing mood:

    It's not NPC but still RPG-related. So this might interest some reading this. TheJanMan might already have it though.

  • That method works amazingly well too! I've used it a few times now.

  • I would recommend looking into Python.

    It depends on what you're doing, but if I understand what you're going for, you might have the most flexibility in the long run just using simple Python data structures (e.g. lists). They can easily be converted to text, which in turn can be converted back into data structures, so testing and visualizing the contents of something like an inventory would be easy even before a front end viewer is implemented. Likewise editing the inventory for testing purposes could be done by editing human readable text.

    I had put off using python in Construct for quite a while, and in retrospect I should have started in with it much earlier. It turns out it's much easier to use than I had anticipated.

    Tutorial: A very simple Python-in-Construct intro tutorial on the forums.

    Scirra Wiki: The Construct Wiki page on Python: ... _Scripting

    Reference: A pretty good reference and documentation site for Python:

    The above site might be a good place to start learning python if you're not already familiar with it, (but wait till after doing the tutorial at the first link I provided).

    Anyway, if you decide that you want to try using Python I recommend using the reference site above to read a little about the basics, like syntax, operators, if/then/else, loops, and functions, and then just start building stuff. And when you need to know more, look it up on a case by case basis.

    In your case, you'll probably be using lists and dictionaries.

    One bit of advice though, is that you'll want to write down in one place the names of all global variables and functions you've created, so you don't have to go hunt them down to remember what they were named.

    And if you've never done traditional text-based programming before, don't worry. If you can use Construct, then you can use Python in Construct.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)