What's new
  • Visit Rebornbuddy
  • Visit Panda Profiles
  • Visit LLamamMagic
  • Visit Resources
  • Visit Downloads
  • Visit Portal

Don't know how to get this done....

Mahlesseh

New Member
Joined
Mar 18, 2011
Messages
78
Reaction score
0
Can anyone tell me if and how i can get this code to get the numbers of unfriendly players measured from Me.CurrentTarget? :confused:

Code:
        public int GetNumUnFriendlyPlayersInRange(int range)
        {
            List<WoWPlayer> unfriendlyPlayerList = new List<WoWPlayer>();
            List<WoWPlayer> playersList = ObjectManager.GetObjectsOfType<WoWPlayer>(false);
            foreach (WoWPlayer thing in playersList)
            {
                if (thing.Distance > range ||
                    thing.IsTotem ||
                    thing.Dead ||
                    thing.IsFriendly ||
                   !thing.IsPlayer
                   )
                {
                    continue;
                }
                unfriendlyPlayerList.Add(thing);
            }
            return unfriendlyPlayerList.Count();
        }

I have tried and tried and tried......
 
Can anyone tell me if and how i can get this code to get the numbers of unfriendly players measured from Me.CurrentTarget? :confused:

Code:
        public int GetNumUnFriendlyPlayersInRange(int range)
        {
            List<WoWPlayer> unfriendlyPlayerList = new List<WoWPlayer>();
            List<WoWPlayer> playersList = ObjectManager.GetObjectsOfType<WoWPlayer>(false);
            foreach (WoWPlayer thing in playersList)
            {
                if (thing.Distance > range ||
                    thing.IsTotem ||
                    thing.Dead ||
                    thing.IsFriendly ||
                   !thing.IsPlayer
                   )
                {
                    continue;
                }
                unfriendlyPlayerList.Add(thing);
            }
            return unfriendlyPlayerList.Count();
        }

I have tried and tried and tried......

It would help if you could tell us how your code fragment is failing. Here is an (untested) alternative implementation for you to try....
Code:
public int GetNumUnFriendlyPlayersInRange(int range)
{
    return (ObjectManager.GetObjectsOfType&lt;WoWUnit&gt;(true, false)
                 .Count(target => target.IsPlayer
                                   && target.IsHostile
                                   && !target.IsDead
                                   && (target.Distance <= range)));
}


cheers,
chinajade
 
Hey, thanks for the reply. The code fragment is failing me because it gives me the number of hostile players in the range measured from Me. I was wondering if it is possible to give me the numbers of hostile players measured from my current target.

I am trying to design a pull-code that will hold if the friendly/unfriendly ratio is off. It would be ideal if i could measure from the currenttarget, since that is the spot that is important, If you catch my drift :p
 
Hey, thanks for the reply. The code fragment is failing me because it gives me the number of hostile players in the range measured from Me. I was wondering if it is possible to give me the numbers of hostile players measured from my current target.

I am trying to design a pull-code that will hold if the friendly/unfriendly ratio is off. It would be ideal if i could measure from the currenttarget, since that is the spot that is important, If you catch my drift :p

here is my WillChain method, you need to give it the wow unit you wanna check, and how many mobs are with in 8 yards of the mob defined.
i developed this method when i was developing Iblis, this method was made in order to check when to cast chain lighting or chain heal. so if i wanted really effective chaining , i would have the hits at 3.

since you wanna make sure there are no mobs next to the mob you give it a value of 0. it will return true if there are more then 0 mobs in range. so to use it your going to have to make it invert it.
!WillChian(0,Me.CurrentTarget);

make sure you give me credit for the code.
Code:
//only works with mobs, not players, need a new one for pvp. 
        public static bool WillChain(int Hits, WoWPoint TargetLocal)
        {
            List<WoWUnit> hitList = new List<WoWUnit>();
          
        
                List<WoWUnit> enemyList = ObjectManager.GetObjectsOfType<WoWUnit>(false).FindAll(unit =>
                        unit.Attackable &&
                        !unit.IsFriendly &&
                        !unit.Combat &&
                        unit != Me &&
                        unit != Me.CurrentTarget);
                foreach (WoWUnit Plr in enemyList)
                {
                    if (TargetLocal.Distance(Plr.Location) < 8)
                    {
                        hitList.Add(Plr);
                    }

                }

            if (hitList.Count > Hits)
            {
                Log("Found Targets {0} near CurrentTarget", hitList.Count.ToString());
                hitList.Clear();
                return true;
    


            }
            else
            {
                hitList.Clear();
                return false;
            }
        }
 
Wow! Thanks a million man! :D Woot! Going to try it out right away ;) Will credit for sure man, if i manage to get it all together that is :D
 
Back
Top