View Single Post
  #4  
Old 04-22-2004, 04:59 AM
Scorpious2k's Avatar
Scorpious2k
Demi-God
 
Join Date: Mar 2003
Location: USA
Posts: 1,067
Default

In case you wanted some more things to play with, here is something being tested on our server and destined for cvs when testing is complete...

modification to the signal() command to signal all npcs of the same id

in parser.cpp Parser::ExCommands change this

Code:
			else if (!strcmp(strlwr(command),"signal")) 
			{	// signal(npcid) - generates EVENT_SIGNAL on specified npc
				int snpc=atoi(arglist[0]);
				if (snpc<1)
				{
					printf("signal() bad npcid=%i\n",snpc);
				}
				else
				{
					Mob* signalnpc;
					signalnpc=entity_list.GetMobByNpcTypeID(snpc);
					if (signalnpc==0)
					{
						printf("signal() npcid not found=%i\n",snpc);
					}
					else
					{
						signalnpc->signaled=true;
					}
				}
			}
to this:

Code:
			else if (!strcmp(strlwr(command),"signal")) 
			{	// signal(npcid) - generates EVENT_SIGNAL on specified npc
				int snpc=atoi(arglist[0]);
				if (snpc<1)
				{
					printf("signal() bad npcid=%i\n",snpc);
				}
				else
				{
					Mob* signalnpc=0;

					entity_list.SignalMobsByNPCID(snpc);

				}
			}
in entity.cpp after EntityList::ClearFeignAggro add this

Code:
void EntityList::SignalMobsByNPCID(int32 snpc)
{
	LinkedListIterator<Mob*> iterator(mob_list);

	iterator.Reset();
	while(iterator.MoreElements())
	{
		if (iterator.GetData()->GetNPCTypeID() == snpc)
		{
			iterator.GetData()->signaled=true;
		}
		iterator.Advance();
	}
}
and in entity.h before this

Code:
	void	CountNPC(int32* NPCCount, int32* NPCLootCount, int32* gmspawntype_count);
	void	DoZoneDump(ZSDump_Spawn2* spawn2dump, ZSDump_NPC* npcdump, ZSDump_NPC_Loot* npclootdump, NPCType* gmspawntype_dump);
	void    RemoveEntity(int16 id);
	void	SendPetitionToAdmins(Petition* pet);
	void	SendPetitionToAdmins();
add this

Code:
	void	SignalMobsByNPCID(int32 snpc);
__________________
Maybe I should try making one of these servers...
Reply With Quote