if (pc_target->dispz > (pc_target2->dispz +10)) return; if (pc_target->dispz < (pc_target2->dispz -10)) return;
void npcattacktarget(int target2, int target){	if (target==target2) return;	if (target < 0 || target2<0 || target>cmem || target2>cmem) return;	P_CHAR pc_target  = MAKE_CHARREF_LR(target);	P_CHAR pc_target2 = MAKE_CHARREF_LR(target2);	if (!(line_of_sight(-1,pc_target2->pos, pc_target->pos, WALLS_CHIMNEYS+DOORS+FLOORS_FLAT_ROOFING))) return; //From Leviathan - Morrolan	playmonstersound(DEREF_P_CHAR(pc_target), pc_target->id1, pc_target->id2, SND_STARTATTACK);	int i;	unsigned int cdist=0 ;	if (pc_target->dead || pc_target2->dead) return;	if (pc_target->targ!=-1)		cdist=chardist(DEREF_P_CHAR(pc_target), pc_target->targ);	else cdist=30;	if (cdist>chardist(DEREF_P_CHAR(pc_target), DEREF_P_CHAR(pc_target2)))	{		pc_target->targ = DEREF_P_CHAR(pc_target2);		pc_target->attacker = pc_target2->serial;		pc_target->setAttackFirst();	}	if (pc_target2->targ!=-1)		cdist=chardist(DEREF_P_CHAR(pc_target2), pc_target2->targ);	else cdist=30;	if ((cdist>chardist(DEREF_P_CHAR(pc_target), DEREF_P_CHAR(pc_target2)))&&		((!(pc_target2->npcaitype==4)||(!((pc_target2->targ==-1)))))) // changed from 0x40 to 4, LB	{		pc_target2->targ=DEREF_P_CHAR(pc_target);		pc_target2->attacker = pc_target->serial;		pc_target2->resetAttackFirst();	}	pc_target->unhide();	pc_target->disturbMed();	pc_target2->unhide();	pc_target2->disturbMed();	if (pc_target->isNpc())	{		if (!(pc_target->war)) npcToggleCombat(DEREF_P_CHAR(pc_target));		pc_target->setNextMoveTime();	}	if ((pc_target2->isNpc())&&!(pc_target2->npcaitype==4)) // changed from 0x40 to 4, LB	{		if (!(pc_target2->war)) npcToggleCombat(DEREF_P_CHAR(pc_target2));		pc_target2->setNextMoveTime();	}	 	sprintf((char*)temp, "You see %s attacking %s!", pc_target2->name, pc_target->name);	for (i=0;i<now;i++)		{		 if (inrange1p(currchar[i], DEREF_P_CHAR(pc_target))&&perm[i])		 {			  pc_target->emotecolor1=0x00;			  pc_target->emotecolor2=0x26;			  npcemote(i, DEREF_P_CHAR(pc_target2), (char*)temp,1);		 }	}}