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

heal if more then one person needs healing

hazard

Well-Known Member
Joined
Sep 16, 2010
Messages
1,854
Reaction score
55
What I am trying to do is make my CC cast Tranquility only when three or more people are below 30% health.

I am not sure what to add? where !unit.IsMoreThan 3

Code:
        private WoWPlayer NeedAoEHeals()
        {
            return (from unit in ObjectManager.GetObjectsOfType<WoWPlayer>(true, true)
                    orderby unit.HealthPercent ascending
                    where !unit.Dead
                    where !unit.IsGhost
                    where unit.Distance < 40
                    where unit.HealthPercent < 30
                    select unit).FirstOrDefault();
        }
 
What I am trying to do is make my CC cast Tranquility only when three or more people are below 30% health.

I am not sure what to add? where !unit.IsMoreThan 3

Code:
        private WoWPlayer NeedAoEHeals()
        {
            return (from unit in ObjectManager.GetObjectsOfType<wowplayer>(true, true)
                    orderby unit.HealthPercent ascending
                    where !unit.Dead
                    where !unit.IsGhost
                    where unit.Distance < 40
                    where unit.HealthPercent < 30
                    select unit).FirstOrDefault();
        }
go into Amplify and look up my WillChain method, it actually counts the number of people around, so it should give you some idea of what to do.

</wowplayer>
 
go into Amplify and look up my WillChain method, it actually counts the number of people around, so it should give you some idea of what to do.

There is a large number of files and im not to sure where to look?
 
I think this is what he was reffering to:

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;
            }
        }

From: Methods.cs
 
OK I have made this but not sure how to link it to the tranquillity?

Code:
        private List<WoWUnit> adds = new List<WoWUnit>();

        private List<WoWUnit> MultiHeal()
        {
            List<WoWUnit> addList = ObjectManager.GetObjectsOfType<WoWUnit>(false).FindAll(unit =>
                        unit.Guid != Me.Guid &&
                        unit.Distance < 40 &&
                        unit.HealthPercent < 30 &&
                        !unit.IsFriendly &&
                        !unit.IsPet &&
                        !Styx.Logic.Blacklist.Contains(unit.Guid));

            if (addList.Count >= 3)
            {
            }
            return addList;
        }

My tranquillity sections starts as shown below however this throws up errors in Visual:

Code:
        private bool Tranquility()
        {
            WoWPlayer tar = MultiHeals();
            if (tar != null)
            {
 
OK I have made this but not sure how to link it to the tranquillity?

Code:
        private List<wowunit> adds = new List<wowunit>();

        private List<wowunit> MultiHeal()
        {
            List<wowunit> addList = ObjectManager.GetObjectsOfType<wowunit>(false).FindAll(unit =>
                        unit.Guid != Me.Guid &&
                        unit.Distance < 40 &&
                        unit.HealthPercent < 30 &&
                        !unit.IsFriendly &&
                        !unit.IsPet &&
                        !Styx.Logic.Blacklist.Contains(unit.Guid));

            if (addList.Count >= 3)
            {
            }
            return addList;
        }

My tranquillity sections starts as shown below however this throws up errors in Visual:

Code:
        private bool Tranquility()
        {
            WoWPlayer tar = MultiHeals();
            if (tar != null)
            {

The problem lies in your Tranquility code. The problem is due to you trying to convert a List into a single object (e.g. a wowplayer). As for how to link the MultiHeal to tranquility, then you could simply convert the function to a Boolean return value (e.g. if(addslist.Count) > 3 -> return true). And in your tranquility function check if multiheal is true.</wowunit></wowunit></wowunit></wowunit></wowunit>
 
OK I have made this but not sure how to link it to the tranquillity?

Code:
        private List<wowunit> adds = new List<wowunit>();

        private List<wowunit> MultiHeal()
        {
            List<wowunit> addList = ObjectManager.GetObjectsOfType<wowunit>(false).FindAll(unit =>
                        unit.Guid != Me.Guid &&
                        unit.Distance < 40 &&
                        unit.HealthPercent < 30 &&
                        !unit.IsFriendly &&
                        !unit.IsPet &&
                        !Styx.Logic.Blacklist.Contains(unit.Guid));

            if (addList.Count >= 3)
            {
            }
            return addList;
        }

My tranquillity sections starts as shown below however this throws up errors in Visual:

Code:
        private bool Tranquility()
        {
            WoWPlayer tar = MultiHeals();
            if (tar != null)
            {

Won't addList only work on enemy mobs?
You're using !unit.IsFriendly, so from what i would think, it won't work on friendly players?
</wowunit></wowunit></wowunit></wowunit></wowunit>
 
What are you exactly trying to do, ill be able to help you. pm me
 
i see what your trying to do,
if you go to druid/healz and have a look at my botbase code
you can learn alot there


You see this is how i get how many people i get on rejuv
Code:
        public static int RejuvCount()
        {
            return (int)(from Unit in ObjectManager.GetObjectsOfType<WoWPlayer>(false, true)
                         where !Unit.Dead
                         where Unit.IsFriendly
                         where !Unit.IsPet
                         where Unit.HasAura("Rejuvenation")
                         select Unit).Count();
        }
 
just put this together in notepad it SHOULD work
you see what your trying to return is a INT, and from a count

Code:
        public static int TranquilityCount()
        {
            return (int)(from Unit in ObjectManager.GetObjectsOfType< WoWPlayer >(true, true)
                         where !Unit.Dead
                         where !Unit.IsGhost
                         where Unit.IsFriendly
                         where Unit.Distance < 40
                         where Unit.HealthPercent < 30
                         select Unit).Count();
        }


so you can use it something like this
Code:
int TranqCount = TranquilityCount();

if (TranqCount >= 3)
{
    Do Whatever
}
 
Last edited:
I use A LOT of logic like this in my CC. this is basically the code your looking for:


This is Singular code:
Code:
                        Spell.Heal(
                                "Divine Hymn",
                                ret => StyxWoW.Me,
                                ret => Unit.NearbyFriendlyPlayers.Count(p =>
                                       p.HealthPercent <= 85 &&
                                       p.IsAlive &&
                                       p.DistanceSqr < 30 * 30) >= 3)


In any none behaviourtree CC it would look something like this:

Code:
                        if (Styx.WoWInternals.ObjectManager.GetObjectsOfType<wowplayer>(true, true).Where(p => p.HealthPercent <= 85 && p.IsAlive && p.DistanceSqr < 40 * 40 && p.IsInMyPartyOrRaid).Count() >= 3)
                        {
                            //Here we do spell casting.
                        }

.Count() >= 3 is whats doing the magic here, change that number till it suits your fit.
p.DistanceSqr < 40 * 40 checks that the unit is within a 40 yard radius.
Rest should be self explained.</wowplayer>
 
Last edited:
Not having much luck with either of these two codes. Just throwing up a large number of errors?
 
try adding refrences also

Code:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.InteropServices;
using System.Windows.Forms;
using System.Threading;
using System.Diagnostics;

using Styx;
using Styx.Combat.CombatRoutine;
using Styx.Helpers;
using Styx.Logic;
using Styx.Logic.BehaviorTree;
using Styx.Logic.Combat;
using Styx.Logic.Pathing;
using Styx.Logic.POI;
using Styx.WoWInternals.WoWObjects;
using TreeSharp;
using Action = TreeSharp.Action;
using Sequence = TreeSharp.Sequence;
using Styx.WoWInternals;



PUT THIS IN A CLASS


        public static int TranquilityCount()
        {
            return (int)(from Unit in ObjectManager.GetObjectsOfType< WoWPlayer >(true, true)
                         where !Unit.Dead
                         where !Unit.IsGhost
                         where Unit.IsFriendly
                         where Unit.Distance < 40
                         where Unit.HealthPercent < 30
                         select Unit).Count();
        }


so you can use it something like this
Code:
int TranqCount = TranquilityCount();

if (TranqCount >= 3)
{
    Do Whatever
}
 
or you can look in the archives for my druid healbot, "Kaboomkin" and use whatever i did back then, it was based off the will chain method and worked quite well
 
This is how i would do it (tested it, and i don't get any compiling errors):

PHP:
        private static bool NeedAoeHeal()
        {
            int count = ObjectManager.GetObjectsOfType(false, true).Where(u => !u.Dead && !u.IsGhost && u.Distance < 40 && u.HealthPercent < 30).Count();
            if (count >= 3)
            {
                return true;
            }
            return false;
        }
        private static void Tranquility()
        {
            if (NeedAoeHeal())
            {
                SpellManager.Cast("Tranquility");
            }
        }
Btw. don't copy-paste it, as it tends to remove the WoWPlayer part of GetObjectsOfType..
 
Still stuck on this! Can't believe how difficult this is turning out to be.

Code:
        private bool Tranquility()
        {
            WoWPlayer tar = NeedAoEHeals();

            if (HazzDruidSettings.Instance.SpecRestoration && CC("Tranquility") && !isAuraActive("Tranquility", tar) && HazzDruidSettings.Instance.UseTranquility && !HazzDruidSettings.Instance.UseCombat)
            {
                Logging.Write("Tranquility");
                Navigator.PlayerMover.MoveStop();
                C("Tranquility", tar);
                return true;
            }
            return false;
        }
 
I hope this isn't too useless but - I know FPSware Druid has an option on how many people to have to be low to use tranq, maybe looking at his code would give you an idea of how to accomplish it (not advocating code stealing, maybe just jogging the memory :P)
 
I hope this isn't too useless but - I know FPSware Druid has an option on how many people to have to be low to use tranq, maybe looking at his code would give you an idea of how to accomplish it (not advocating code stealing, maybe just jogging the memory :P)

Everybody's code is different. If I tried to just copy an paste it I would end up with just a large number of errors.
 
I get that - I just figured you might be able to see how he was accomplishing it, not to just copy it. :)
 
Back
Top