I wrote this after I noticed that SPAWN_GROUP and SPAWN_NPC were both broken. The following code will allow you to spawn an npc_type at the specified x, y, z coord and heading.
Insert the following block under the else if block of SPAWN_GROUP in
WesQuests.cpp.
Quote:
else if (strstr(strupr(command),"NPCTYPESPAWN") != NULL) {
if (tt2 || ti2 || td) {
if (sep.IsNumber(1)) {
const NPCType* tmp = 0;
if ((tmp = database.GetNPCType(atoi(sep.arg[1]))))
{
// tmp->fixedZ = 1;
NPC* npc = new NPC(tmp, 0, atoi(sep.arg[2]), atoi(sep.arg[3]), atoi(sep.arg[4])/10, atoi(sep.arg[5]));
entity_list.AddNPC(npc);
}
else
{
Message(0, "ERROR: NPC Type %i not found. Please petition a GM.", atoi(sep.arg[1]));
}
}
else {
Message(0, "ERROR: NPCTYPESPAWN Used incorrectly. Please petition a GM.");
}
}
}
|
Here's an example quest script using this function:
Code:
TRIGGER_TEXT:Bring on the first Challenge:{
SHOUT:Come forth, wolf of the night!
NPCTYPESPAWN 3 1056.52 -45.71 5.00 65.00
}
That will spawn npc_type 3 (Savage Wolf in my case) at the specified location.