Wednesday, 12 September 2007

Change PC or NPC name

RandomName()
Generates a random name.
SetFirstName works on PC or NPC - probably also on a placeable or item

string sCreatureTag="n_gerana";
void main(string sCreatureTag)
{
object oVictim = GetNearestCreature(0,0);//haven't sorted this one yet
oVictim = GetObjectByTag(sCreatureTag);
string sNewname = RandomName();

//All names I've got so far are male sounding so
//if female add an 'a'
if (1==GetGender(oVictim))
{
sNewname = sNewname +"a";
}
SetFirstName (oVictim,sNewname);
sNewname = RandomName();
SetLastName(oVictim,sNewname);
}

No comments: