View Single Post
  #1  
Old 01-27-2003, 01:30 AM
Drawde
Dragon
 
Join Date: Jan 2002
Posts: 521
Default 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;
}
Reply With Quote