hello everyone! I am a beginner in programming. I am making an RPG game that mostly resemble ragnarok but text based.
my problem is on item database. i need something like a function in main/class(i don't really know) that determine the item and implement it to the character only by the id number of a specific item that is read from a text document. i already have played around with file handling and was successful. could you please help me? it's not a project or anything but it is really important to me. thanks for the reply.^_^
you would have to do something like this, first declare an array for item ids, item names, and whatever else. It would be a good idea to have seperate arrays for weapons and items. (im not to specific here):
const int NUM_ITEMS = (NUMBER OF TOTAL ITEMS HERE)
1 2 3 4 5
int i = 0;
ifstream inFile;
for (i = 0, i < NUM_ITEMS; i++)
inFile >> id_num[i] >> weapon_name[i] >> weapon_str[i]
That would take care of assigning ids and all that to an array.
If I thought about it more I could help you out but I'm extremely sleepy, just trying to point you in the right direction.
thanks again! I'm gonna look at it in further detail later. research thoroughly for forums that might have covered id_numbers with file handling. and pray for some idea that will go into my head. thanks again!
ragnarok has an item_db text document that contains like this:
i want to recreate this item database by saving the values read from the .txt to variables on my program. when ID_NO is called(like equipping it/etc..), it will load the the rest of the info into the program just by the ID_NO itself. any ideas where the process of identifying the item through ID_NO be? i partially thought about putting it into the character class, main , other functions. but still not clear on the idea.
thanks for the reply! your help is always welcome and appreciated. ^_^