I want an NPC to get all Friendly/unfriendly units around him/her i took the following from the Hodir.cpp
Code:
std::list<Unit*> TargetList;
Trinity::AnyUnfriendlyUnitInObjectRangeCheck checker(me, me, 100.0f);
Trinity::UnitListSearcher<Trinity::AnyUnfriendlyUnitInObjectRangeCheck> searcher(me, TargetList, checker);
me->VisitNearbyObject(100.0f, searcher);
for (std::list<Unit*>::iterator itr = TargetList.begin(); itr != TargetList.end(); ++itr)
{
Unit* target = *itr;
//Do stuff here
}
Am i right in thinking the above code gets all unfriendly units in 100 yards of the Unit and runs through them in the for loop as target. Do i can put things where i put the comment to do to targets?
If the above is true i'm assuming switching AnyUnfriendlyUnitInObjectRangeCheck to AnyFriendlyUnitInObjectRangeCheck
would do the same but with un friendly targets. What about Neutral targets (Yellow but attackable. Like those found in starting areas so they dont auto attack you) What would they fall under seen as AnyNeutalUnitInObjectRangeCheck doesn't exist?