Register a free account today to become a member! Once signed in, you'll be able to participate on this site by adding your own topics and posts, as well as connect with other members through your own private inbox!
Query the GameObjectManager with the restrictions that you are looking for. Plenty of Combat Routines have code that does this that you can look through.
From Magitek:
Code:
target =
(from unit in GameObjectManager.GetObjectsOfType<BattleCharacter>()
where unit.Location.Distance(Core.Player.Location) < Magitek.WindowSettings.TargetDistance
where unit.ObjectId == (selection.GameObject as BattleCharacter).CurrentTargetId
select unit).FirstOrDefault();