EQEmulator Forums

EQEmulator Forums (https://www.eqemulator.org/forums/index.php)
-   Archive::Development (https://www.eqemulator.org/forums/forumdisplay.php?f=621)
-   -   WesQuests.cpp - NPCTYPESPAWN (https://www.eqemulator.org/forums/showthread.php?t=3631)

Xarslik 10-28-2002 10:40 AM

WesQuests.cpp - NPCTYPESPAWN
 
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.

Zafar 10-28-2002 10:51 AM

Re: WesQuests.cpp - NPCTYPESPAWN
 
Thanks for that info, neer knew you could pass strings to that command like that. (never thought of it)

Quote:

Originally Posted by Xarslik
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.


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.



All times are GMT -4. The time now is 05:54 PM.

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