Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

DarkBASIC Professional Discussion / Advice on item system, for rpgs... New to pro.. Vetran of Classic

Author
Message
The Lone Programmer
23
Years of Service
User Offline
Joined: 29th Jan 2003
Location: California, USA
Posted: 22nd Oct 2003 07:08
Hi guys,
I have come from classic, and I need some small bits of help. I had a menu system going down with classic but it was kinda horrible. It wasnt error free.

What do you guys suggest for making an inventory item system for an item menu. One where as your items decrease and increase depending on use and gain.

I absolutely do not understand the stacking and queues in the help menus and code banks.

Please give me examples that explain deeply..

Thanks
Nicolas

*Current Project: Untitled RPG
*Working With: Vash the Stampede 815
*Future Number: Eleventy
Ian T
23
Years of Service
User Offline
Joined: 12th Sep 2002
Location: Around
Posted: 22nd Oct 2003 07:38
That really depends. Do you want an adventure style item interface that merely lists items? A 3d one ala Tomb Raider? A roguelike inventory style ala ADOM? An RPG style system ala Gothic? A complex RPG style system ala Morrowind?

There are a lot of options and many different ways to go about it; with more specifics it'd be easier to help .

--Mouse: Famous (Avatarless) Fighting Furball

A very nice %it, indeed.
The Lone Programmer
23
Years of Service
User Offline
Joined: 29th Jan 2003
Location: California, USA
Posted: 22nd Oct 2003 08:25
You get 20 empty spots in your menu list. They all start off as empty. Every time you get any item from there it replaces the empty nearest to the top. You get items upon buying and finding, or receiving from monsters. You lose items by clicking on the item and using it.

Like a final fantasy menu system, or chrono trigger. Something like that.

My dbc menu system used functions which really made things worse. Didn't come out how I would have liked. I am sure DBP functions are better, but I am also sure there are even easier ways.

Mouse,
Have you made an RPG, or some kind of game that has an inventory. What did you use?

Thanks for the help
Nicolas

*Current Project: Untitled RPG
*Working With: Vash the Stampede 815
*Future Number: Eleventy
Van B
Moderator
23
Years of Service
User Offline
Joined: 8th Oct 2002
Location: Sunnyvale
Posted: 22nd Oct 2003 17:14
Hehe, I've been through this idea so many times I should really write a paper on it .

Okay, for an RPG, you need a really flexible system, because ideally, each character will have an inventory too, and you don't really want a big clunky inventory system that will do nothing but hamper your progress, so I suggest the following.

Firstly, you need an array for the position of each item. Like you'd have Item_x(n) and Item_z(n), maybe Item_y(n) too if your working on a 3D map. You would use this for positioning your items too, so if the inventory changes, you'd update the position of each item object, and hide any object that is in someones inventory. You would have several other item arrays, like the quantity of a particular item, a description - and if your brave, a properties string. The properties string would be used to tell your engine what the item does, so a key might have the property string 'KEYOOR4', then you'd parse this string when using the item, or if you use an item that replenishes health, it might look like 'H+10:QTY-1', like Health+10, and reduce quantity, this would allow for magic items that don't deplete too, it's really a matter of how much you want to do with the parser.

Anyway, let's say you have 100 items, and their locations stored in arrays and descriptions etc etc. The whole idea is that you store the inventory of every character inside the arrays, so each item is unique and can only be in one place at a time. You would use a negative number on one of the locations to denote that it's in an inventory. To be sure that your following this, I'll give an example.

Item 1, a key at location x100,y0,z100

Say your player, character 1 was at the same location and wanted to collect the key, you'd set the location to x-1,y1,z-1, so x-1 means that it's in an inventory now, and y1 means it's in character 1's inventory.

Now the player walks to position x32,y0,z32 and drops the key - you'd simply set the location to the players location, and that's it back out of the inventory and on the ground again. If there was a thief nearby (lets call him character 15), he might want it - so he'd walk over and collect it in the same way, x-1,y15,z-1 becomes the new location of the key.

Once items are used, you can set the location to an abyss, like x-10000,y-10000,z-10000 - the chances are that your engine would miss these items anyway, but it's a good way to avoid annoying code because it's all done with arrays. Items could be moved around really easily, swapped for other items etc etc - once you have the system in place the world is your lobster.

Despite really easy inventory management, you can use the same system for viewing the inventory, viewing other character inventory, swapping items - everything to do with inventory can be done really easily with this system, including collision detection, physics, gravity - all with minimal, easy coding. You'd simply loop through your items when you have to, and update those that are not in an inventory, perhaps even have a trigger for when items are on the ground, that way if you wanted gravity, you could do something like:

* Drop item, so location is set to character location, and Y is set to character location plus drop height. An extra array, Item_falling(n) is set to 1, this is the fall rate.

* For every item with a fall rate that isn't 0, you'd increase the fall rate and adjust the Y position.

* When it hit's the ground set it's fall rate to 0.

Doing it this way will mean less lag, because it'd only be updating exactly what items it has to. You could even throw items if you had an X and Z speed array, so a character could go up a tower and throw an item out of the window to another character on the ground, still with fairly easy handling.

HTH.


Van-B

The Lone Programmer
23
Years of Service
User Offline
Joined: 29th Jan 2003
Location: California, USA
Posted: 23rd Oct 2003 04:30
Hmmm,
You look like you really know what your talking about, but your describing what it would be like for a 3D game. I am not making a 3D game, and I have absolutely no experience in it.

2D is a little more simple.
You buy an item and it increases your pile by 1. You find an item and it increases your pile by 1. You sell, use or drop an item and it decreases your pile by 1.

Items would be set by arrays. And item positions would be set by the
for x=? to ?
????
next x

Well at least thats the positioning approach ive been using. Well I may be wrong.

How do I use the type commands with arrays, cause isnt that how you get multiple things in your array?

Well get back to me.
Nicolas

*Current Project: Untitled RPG
*Working With: Vash the Stampede 815
*Future Number: Eleventy
Van B
Moderator
23
Years of Service
User Offline
Joined: 8th Oct 2002
Location: Sunnyvale
Posted: 23rd Oct 2003 13:28
Don't worry about 2D/3D, the method only really needs 2 axis, just use X and Z instead of X and Y to store the -1 flag and the character number.

I think you'd be better off reading the manual or help files to get to grips with types, I'm too old to change my coding habits so I don't use them, not yet anyway - until I need them.

I will try and get a little demo together before the weekend, maybe make a sorta tutorial for item handling if I have time.


Van-B

Login to post a reply

Server time is: 2026-07-26 05:22:30
Your offset time is: 2026-07-26 05:22:30