MUD stands for Multi-User Display, but I think everyone pretty much uses as a name for a console RPG or role playing game. - cerin
Printable View
MUD stands for Multi-User Display, but I think everyone pretty much uses as a name for a console RPG or role playing game. - cerin
Umm...
Just call rand() every time you need a random number...
Also, a common problem is not seeding the generator.
Heres what I do:
You can have a random character by doing this:Code:while(1)
{
srand(time(NULL));
var = rand() % LIMIT;
cout << var;
}
Just make an array of string sthat the shopkeeper would say and call msg[rand() % NUMMESSAGES];Code:char string[5] = "abcde";
cout << string[rand() % 5];
That should make it a bit easier for you. Hope it helps.
-Blizz