View Single Post
  #3  
Old 04-05-2004, 09:24 AM
m0oni9
Hill Giant
 
Join Date: Dec 2003
Posts: 166
Default

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:

Code:
std::string cmd = "@quest::cmd_queue = (); package " + (std::string)(pkgprefix) + (std::string)(";");
with:
Code:
std::string cmd = "package " + (std::string)(pkgprefix) + (std::string)(";");
about line 325, replace this block of code
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:
Code:
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):
Code:
parse->Event(EVENT_SPAWN, npc->GetNPCTypeID(), 0, npc->CastToMob(), 0);
with:
Code:
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.
Reply With Quote