PDA

View Full Version : Making lastname work


Scorpious2k
01-14-2004, 04:32 AM
NPC_types has a column called lastname. The lastname text goes under the NPC's name in parenthesis (like you see with the merchants and bankers). In current releases of EQEmu, it isn't implemented.

Here is how to make it work.

First, you will need to change the definition to the table. lastname needs to be changed so it can no longer be NULL. If you don't do this, your zone server will crash. Use the following mysql line to make the change:

alter table npc_types modify lastname varchar(32) NOT NULL default '';

Once this is done, you are ready to change the code. In common/database.cpp Database::DBLoadNPCTypes change the line that reads

MakeAnyLenString(&query, "SELECT id,name,level,race,class,hp,gender,texture,helmtex ture,size,loottable_id, merchant_id, banish, mindmg, maxdmg, npcspecialattks, npc_spells_id, d_meele_texture1,d_meele_texture2, walkspeed, runspeed,fixedz,hp_regen_rate,mana_regen_rate,aggr oradius,bodytype,npc_faction_id,face FROM npc_types");//WHERE zone='%s'", zone_name

to read

MakeAnyLenString(&query, "SELECT id,name,level,race,class,hp,gender,texture,helmtex ture,size,loottable_id, merchant_id, banish, mindmg, maxdmg, npcspecialattks, npc_spells_id, d_meele_texture1,d_meele_texture2, walkspeed, runspeed,fixedz,hp_regen_rate,mana_regen_rate,aggr oradius,bodytype,npc_faction_id,face,lastname FROM npc_types");//WHERE zone='%s'", zone_name

then a few lines below that you will find

tmpNPCType.mana_regen = atoi(row[23]);
tmpNPCType.aggroradius = (sint32)atoi(row[24]);
if (row[25] && strlen(row[25]))
tmpNPCType.bodytype = (int8)atoi(row[25]);
else
tmpNPCType.bodytype = 0;
tmpNPCType.npc_faction_id = atoi(row[26]);
tmpNPCType.luclinface=atoi(row[27]);

insert this line after that

strncpy(tmpNPCType.lastname, row[28], 32);

Now, in zone/mob.cpp Mob::FillSpawnStruct you will find the line

strcpy(ns->spawn.last_name, ns->spawn.last_name);

this should be changed to

strcpy(ns->spawn.last_name, lastname);

And that should do it.

Shawn319
01-14-2004, 06:19 AM
but whats the purpose of lastname now? we use _'s to show more than one word names.


Guard_Xama00

Scorpious2k
01-14-2004, 06:51 AM
but whats the purpose of lastname now? we use _'s to show more than one word names.

True, this puts it in "()" under the name - for NPC's

Guard_Xama
(King's Guard)

Mattmeck
(Newbie Slayer)

mattmeck
01-14-2004, 10:16 AM
!!!! :shock:

Scorpious2k
01-15-2004, 04:15 AM
!!!! :shock:

Sorry Matt... that was intended as an example only. I know you wouldn't hurt a hair on a newbie's head in real life....