EQEmulator Forums

EQEmulator Forums (https://www.eqemulator.org/forums/index.php)
-   Archive::Development (https://www.eqemulator.org/forums/forumdisplay.php?f=621)
-   -   Code snippet for truly random pet names (https://www.eqemulator.org/forums/showthread.php?t=4927)

Drawde 01-27-2003 01:30 AM

Code snippet for truly random pet names
 
I noticed that pet names were actually selected from a hard-coded list, so I thought it might be worth adding a random name generator. I haven't tested this snippet, but it should work. I'm not sure the list of syllables is 100% complete, someone with more experience of pet classes in EQ will probably know!

(edit: added blank final syllable as suggested)

const char* Mob::GetRandPetName() {
char* petreturn = 0;
char namesyl1[10][6] = {
"Ga","Ge","Go","Gi","Ja","Jo","Je","Ji","Ka","Ke", "Ko","Ki","La","Le","Lo","Li","Va","Ve","Vo","Xa", "Xe","Xo","Za","Ze","Zo"
};
char namesyl2[10][6] = {
"b","ban","bar","bek","bob","k","n","nar","nan","n ek","r","ran","rar","rek","s","sar","sek","sob",
};
char namesyl3[4][6] = {
"ab","er","n","tik",""
};

sprintf(petreturn,"%s%s%s",namesyl1[rand() % 77],namesyl2[rand() % 77],namesyl3[rand() % 4]);

// printf("Using %s\n", petreturn);
return petreturn;
}

O6scured 01-27-2003 09:43 AM

I may be a begginner at C++ but I think ur missing an open { for that very last } drawde

fnemo 01-27-2003 10:15 AM

All {..} are fine. None missing.

Edgar1898 01-27-2003 10:16 AM

Quote:

const char* Mob::GetRandPetName() {
Quote:

return petreturn;
}

O6scured 01-27-2003 10:22 AM

yea my bad, wasnt paying enough attention sorry

bbbill_42 01-31-2003 07:50 AM

Goner
 
very cute, just add a blank entry for the last suffix so you can have pets like goner and zoner.

bill

bbbill_42 01-31-2003 12:22 PM

nm, i see now, we can even have good old Gann at our side (nameless joke, not funny)

bill


All times are GMT -4. The time now is 07:58 AM.

Powered by vBulletin®, Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.