Ok so I'm relatively new to C++, I'm writing a text-based RPG, similar to LoRD and running into a few problems.
First off, I use getch(), to pause the program and wait for key presses at certain points. Now in 90% of the program, it works fine. But at a couple points it does not. I see no difference in the 2 places. Maybe you can help, here is an example:
This Part Works:
int newgame() //Starting a New Game
{
playermaxlife=50, playermaxmana=5, playercurrentlife=50, playercurrentmana=5, playerlevel=1, playerexperience=0, playergold=5000000, playerarmor=1, playerweapon=1;
system("CLS");
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HA NDLE),FOREGROUND_BLUE | FOREGROUND_INTENSITY);
cout << "Welcome once again to Darkwood, " << playername << ".\n";
cout << '\n';
cout << "The town of Darkwood is in emmence danger.\n";
cout << "The Dragon of Darkwood is terrorizing the town, and slaughtering innocents.\n";
cout << "It is now you job to kill the Dragon, hopefully you will succeed, where so many have failed!\n";
cout << '\n';
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HA NDLE),FOREGROUND_GREEN | FOREGROUND_INTENSITY);
cout << "Hit Enter to go on...";
getch();
town();
}
This Part Does NOT:
int theanimaltrail()
{
system("CLS");
cout << "Check it out";
cout << "Hit Enter to return...";
getch();
town();
}
Any Clue?
Second:
I need a variable (weaponname) to be given a value that is a string (the name of the weapon) how do I do this?
All I wanna do is weaponname="a short sword"; but can't figure it out for the life of me.
I need to be able to change it at will, hence it being a variable, the name will change.
Thanx, for you help.
Darkflame
P.S. - Real quick. What's the RandomInteger function? I wanna do a random number between 1-6.



LinkBack URL
About LinkBacks


