P_CHAR npc = Npcs->AddNPCxyz( -1, spawnregion[r].npclists[counter], 0,x,y,z );
P_CHAR npc = Npcs->AddNPCxyz( -1, spawnregion[r].npclists[counter], 0,pos.x,pos.y,pos.z );
bool doregionspawn(int r)//Regionspawns{	//clConsole.send("doregionspawn: %i start current: %i\n",r,spawnregion[r].current);	if (spawnregion[r].current<=0) spawnregion[r].current=0;	if (spawnregion[r].current >= spawnregion[r].max || spawnregion[r].max == 0) return false;	int x = 0, y = 0, z = 0;	int counter;	if( spawnregion[r].totalnpclists > 0 )	{//		for( counter = 0; counter < spawnregion[r].totalnpclists; counter++ )		counter = rand()%spawnregion[r].totalnpclists;		{			Coord_cl pos;			if (FindSpotForItem(r, pos))			//if (FindSpotForItem(r, Coord_cl(x, y, z)))			{				P_CHAR npc = Npcs->AddNPCxyz( -1, spawnregion[r].npclists[counter], 0,x,y,z );				if (npc != NULL)				{					spawnregion[r].current++;					npc->spawnregion=r;					return true;				}			}		}	}	if( spawnregion[r].totalitemlists > 0 )	{//		for( counter = 0; counter < spawnregion[r].totalitemlists; counter++ )		counter = rand()%spawnregion[r].totalitemlists;		{			Coord_cl pos;			if (FindSpotForItem(r, pos))			{				char list[512];				sprintf( list, "%i", spawnregion[r].itemlists[counter] ); // morrolan				int num = Items->CreateRandomItem( list );				const P_ITEM pi = Items->CreateScriptItem( -1, num, 0 );				if (pi == NULL)					return false;				pi->moveTo(pos);				pi->spawnregion=r;				RefreshItem(pi);				spawnregion[r].current++;				return true;			}		}	}	if( spawnregion[r].totalnpcs>0 )	{//		for (counter=0; counter < spawnregion[r].totalnpcs; counter++)		counter = rand()%spawnregion[r].totalnpcs;		{			Coord_cl pos;			if (FindSpotForItem(r, pos))			{				P_CHAR npc = Npcs->AddNPCxyz( -1, spawnregion[r].npcs[counter], 0, pos.x, pos.y, pos.z );				if (npc != NULL)				{					spawnregion[r].current++;					npc->spawnregion=r;					return true;				}			}		}	}	return false;}