Advertisement

rpg invenotry question

Started by January 04, 2001 03:40 PM
4 comments, last by tenchimusakiryoko 24 years ago
hey, im making a text rpg and I was wondering how i would make it so that when someone buys something or finds something, it appears in their inventory. Thanks. "Good,evil,I got the gun" Ash- Evil Dead
"Good,evil,I got the gun"Ash- Evil Dead
Which language are you using?

in c++ create a class containing a linked list of strings
with add and remove methods.Then just add the text to this
then do an output method to output the strings.

in VB just create a dynamic array or just a list box.

or just have a static array in any language and insert or
overwrite the entries after all a charachter can only carry
so many items.

Hope its of some help.
Advertisement
Read this: Creating Inventories

You may also want to look at (all) the other development articles.


"NPCs will be inherited from the basic Entity class. They will be fully independent, and carry out their own lives oblivious to the world around them ... that is, until you set them on fire ..."
"When you are willing to do that which others are ashamed to do, therein lies an advantage."
"NPCs will be inherited from the basic Entity class. They will be fully independent, and carry out their own lives oblivious to the world around them ... that is, until you set them on fire ..." -- Merrick
For C++, I think a Linked-List is the way to go for large inventories, e.g a Bag of Holding, and use an array for the main inventory screen. Also use Classes for complex items, and structs for simpler items.

For VB, use the record and data-base controls, because they''re like a Linked-List, and list boxes for static stuff etc...
I never got to linked lists, I was thinking of using an array for my game. Would that work?
Peon
It''ll work. Just slower and wastes memory. Did you check out that link I gave you?


"NPCs will be inherited from the basic Entity class. They will be fully independent, and carry out their own lives oblivious to the world around them ... that is, until you set them on fire ..."
"When you are willing to do that which others are ashamed to do, therein lies an advantage."
"NPCs will be inherited from the basic Entity class. They will be fully independent, and carry out their own lives oblivious to the world around them ... that is, until you set them on fire ..." -- Merrick

This topic is closed to new replies.

Advertisement