PDA

View Full Version : Trouble with mutliple spawn commands


m0oni9
04-03-2004, 07:57 PM
edit: Erased this post so someone didn't confuse changes.. see latest post in thread.

smogo
04-04-2004, 07:00 AM
Doesn't this override or break the fix described in this post ?
http://www.eqemulator.net/forums/viewtopic.php?t=13468&start=0&postdays=0&postorder=asc&highlight=

m0oni9
04-05-2004, 09:24 AM
Well, I found that the above change helped with spawning multiple mobs, but the message to those newly spawned mobs wasn't getting through. I thought that I had posted this last night (hope I included everything), but I guess not. Disregard the above change. This is what needs to be done:

changes to zone/embparser.cpp

about line 312, replace:

std::string cmd = "@quest::cmd_queue = (); package " + (std::string)(pkgprefix) + (std::string)(";");

with:
std::string cmd = "package " + (std::string)(pkgprefix) + (std::string)(";");
about line 325, replace this block of code
int numcoms = perl->geti("quest::qsize()");
for(int c = 0; c < numcoms; ++c)
{
char var[1024] = {0};
sprintf(var,"$quest::cmd_queue[%d]{func}",c);
std::string cmd = perl->getstr(var);
sprintf(var,"$quest::cmd_queue[%d]{args}",c);
std::string args = perl->getstr(var);
size_t num_args = std::count(args.begin(), args.end(), ',') + 1;
ExCommands(cmd, args, num_args, npcid, other, mob);
}
with:
static int c = 0;
while (c < perl->geti("quest::qsize()"))
{
char var[1024];
sprintf(var,"$quest::cmd_queue[%d]{func}",c);
std::string cmd = perl->getstr(var);
sprintf(var,"$quest::cmd_queue[%d]{args}",c);
std::string args = perl->getstr(var);
size_t num_args = 1;
if (!(!strcmp(cmd.c_str(), "say") ||
!strcmp(cmd.c_str(), "echo") ))
for (const char *c = args.c_str(); *c; c++)
if (*c == ',')
num_args++;

c++;
ExCommands(cmd, args, num_args, npcid, other, mob);
}

if (c)
perl->eval("@quest::cmd_queue = ();");
c = 0;
changes to zone/entity.cpp

about line 342, replace (first occurance):
parse->Event(EVENT_SPAWN, npc->GetNPCTypeID(), 0, npc->CastToMob(), 0);
with:
parse->Event(EVENT_SPAWN, npc->GetNPCTypeID(), 0, npc->CastToMob(), npc);

As far as the other change goes, the "CastToClient" error was because the of the last arg (0). Having it as-is, with npc should work.

smogo
04-18-2004, 01:34 PM
merged in, together with 0.5.6dr1 code, to CVS repository :
http://quests.eqemulator.net

Go to : Menu-> CVS web

eqemu files are in the eqemu module