Get Units Within Range/On Aggro list

Im look for an NPC to get all units within X range (Both Other NPC’s and Players) Would the following get all Friendly players within 100 yards. Then Perform actions on each of them (if i added code to where I’ve noted //Do Stuff here)

[CODE] std::list<Unit*> TargetList;

        	Trinity::AnyUnfriendlyUnitInObjectRangeCheck checker(me, me, 100.0f);

        	Trinity::UnitListSearcher<Trinity::AnyUnfriendlyUnitInObjectRangeCheck> searcher(me, TargetList, checker);

       	for (std::list<Unit*>::iterator itr = TargetList.begin(); itr != TargetList.end(); ++itr)


            	Unit* target = *itr;

         	//Do stuff here



Would i then be able to get Friendly Units in the same way by switching AnyUnfriendlyUnitInObjectRangeCheck to AnyFriendlyUnitInObjectRangeCheck. Also what do neutral units fall under. For example Non-Hostile mobs that appear yellow but atatckable. Would they come under friendly or unfriendly i can seem to find a AnyNeutralUnitInObjectRangeCheck.

Also would the following grab all players on threatlist and perform actions

std::list<HostileReference*> ThreatList = me->getThreatManager().getThreatList();

                    	for (std::list<HostileReference*>::const_iterator itr = ThreatList.begin(); itr != ThreatList.end(); ++itr)

                    	if (Unit* target = ObjectAccessor::GetUnit(*me, (*itr)->getUnitGuid()))


                     	//Perform actions here


Should the above work is there any better method of doing the same thing?

Take a look at GridNotifiers.h to find your love.

Still don’t understand. Any chance you could give me an example to grab all Nearby players into a list?