Sleepwalker 1 Posted February 12, 2021 Share Posted February 12, 2021 I'd like to use Swipe in cat form when there's a certain amount of mobs in range but I can't seem to find any api information on how to accomplish that. I've attached the base I've been using below if you have any suggestions. Thanks! dRotation - Feral.cs Link to comment https://wrobot.eu/forums/topic/12837-use-certain-spell-when-a-certain-number-of-mobs-are-in-range/ Share on other sites More sharing options...
Zan 99 Posted February 12, 2021 Share Posted February 12, 2021 https://wrobot.eu/forums/topic/2097-condition-hostile-unit-near-target-never-true/?tab=comments#comment-9858 Link to comment https://wrobot.eu/forums/topic/12837-use-certain-spell-when-a-certain-number-of-mobs-are-in-range/#findComment-61224 Share on other sites More sharing options...
Sleepwalker 1 Posted February 12, 2021 Author Share Posted February 12, 2021 8 minutes ago, Zan said: https://wrobot.eu/forums/topic/2097-condition-hostile-unit-near-target-never-true/?tab=comments#comment-9858 It looks more related to non C# profiles but I'm unsure exactly how I'd implement that code into my fight class Link to comment https://wrobot.eu/forums/topic/12837-use-certain-spell-when-a-certain-number-of-mobs-are-in-range/#findComment-61225 Share on other sites More sharing options...
Zan 99 Posted February 13, 2021 Share Posted February 13, 2021 2 hours ago, Sleepwalker said: It looks more related to non C# profiles but I'm unsure exactly how I'd implement that code into my fight class ObjectManager.GetWoWUnitHostile...... Link to comment https://wrobot.eu/forums/topic/12837-use-certain-spell-when-a-certain-number-of-mobs-are-in-range/#findComment-61226 Share on other sites More sharing options...
Sleepwalker 1 Posted February 13, 2021 Author Share Posted February 13, 2021 12 hours ago, Zan said: ObjectManager.GetWoWUnitHostile...... Implementing this code into the fight class base I'm using doesn't appear to work, wrobot just throws up errors. I've attached the fight class below and an image with said error, thanks again for your help. dRotation -feral2.cs Link to comment https://wrobot.eu/forums/topic/12837-use-certain-spell-when-a-certain-number-of-mobs-are-in-range/#findComment-61227 Share on other sites More sharing options...
Apexx 60 Posted February 13, 2021 Share Posted February 13, 2021 (edited) Here's what I use to check attackers in range: public static int GetAttackerCountInRange(float yards) { int EnemyCountInRange = ObjectManager.GetUnitAttackPlayer().Count(t => t.IsAlive && t.IsValid && t.IsAttackable && t.InCombat && t.GetDistance <= yards); if (EnemyCountInRange > 0) { Logging.WriteDebug($"Enemy attacking count = {EnemyCountInRange}"); return EnemyCountInRange; } return 0; } Edited February 13, 2021 by Apexx Sleepwalker 1 Link to comment https://wrobot.eu/forums/topic/12837-use-certain-spell-when-a-certain-number-of-mobs-are-in-range/#findComment-61230 Share on other sites More sharing options...
Sleepwalker 1 Posted February 13, 2021 Author Share Posted February 13, 2021 3 hours ago, Apexx said: Here's what I use to check attackers in range: public static int GetAttackerCountInRange(float yards) { int EnemyCountInRange = ObjectManager.GetUnitAttackPlayer().Count(t => t.IsAlive && t.IsValid && t.IsAttackable && t.InCombat && t.IsTargetingMeOrMyPetOrPartyMember && t.GetDistance <= yards); if (EnemyCountInRange > 0) { Logging.WriteDebug($"Enemy attacking count = {EnemyCountInRange}"); return EnemyCountInRange; } return 0; } Can you show how you've implemented this? I'm pretty nooby when it comes to c#. I've tried putting the code in its own spot then calling GetAttackerCountInRange in the swipe spell however I run into an error saying this: in reference to your third line. Link to comment https://wrobot.eu/forums/topic/12837-use-certain-spell-when-a-certain-number-of-mobs-are-in-range/#findComment-61231 Share on other sites More sharing options...
Marsbar 228 Posted February 13, 2021 Share Posted February 13, 2021 This should be enough as your if statement: if (Swipe.KnownSpell && Swipe.IsSpellUsable && Swipe.IsDistanceGood && ObjectManager.Me.ComboPoint <= 3 && ObjectManager.GetWoWUnitAttackables().Count(u => u.Position.DistanceTo(ObjectManager.Target.Position) <= 8 && u.Guid != ObjectManager.Pet.Guid) >= 3) Sleepwalker 1 Link to comment https://wrobot.eu/forums/topic/12837-use-certain-spell-when-a-certain-number-of-mobs-are-in-range/#findComment-61232 Share on other sites More sharing options...
Sleepwalker 1 Posted February 13, 2021 Author Share Posted February 13, 2021 20 minutes ago, Marsbar said: This should be enough as your if statement: if (Swipe.KnownSpell && Swipe.IsSpellUsable && Swipe.IsDistanceGood && ObjectManager.Me.ComboPoint <= 3 && ObjectManager.GetWoWUnitAttackables().Count(u => u.Position.DistanceTo(ObjectManager.Target.Position) <= 8 && u.Guid != ObjectManager.Pet.Guid) >= 3) I get the same error every time, I really appreciate all the help I'm receiving. The error looks the same as everyone elses suggestion though, .Count cannot be used like a method. Link to comment https://wrobot.eu/forums/topic/12837-use-certain-spell-when-a-certain-number-of-mobs-are-in-range/#findComment-61233 Share on other sites More sharing options...
Marsbar 228 Posted February 13, 2021 Share Posted February 13, 2021 Oh lol dude, add a using System.Linq; to the usings at the top of the file Sleepwalker 1 Link to comment https://wrobot.eu/forums/topic/12837-use-certain-spell-when-a-certain-number-of-mobs-are-in-range/#findComment-61234 Share on other sites More sharing options...
Zan 99 Posted February 13, 2021 Share Posted February 13, 2021 12 minutes ago, Sleepwalker said: I get the same error every time, I really appreciate all the help I'm receiving. The error looks the same as everyone elses suggestion though, .Count cannot be used like a method. Go download VS Community Edition and add WRobot references while writing in C# Sleepwalker 1 Link to comment https://wrobot.eu/forums/topic/12837-use-certain-spell-when-a-certain-number-of-mobs-are-in-range/#findComment-61235 Share on other sites More sharing options...
Sleepwalker 1 Posted February 13, 2021 Author Share Posted February 13, 2021 20 minutes ago, Marsbar said: Oh lol dude, add a using System.Linq; to the usings at the top of the file I can't believe it was something so simple hahah! I can tweak around with more things now at least thanks so much! I just gotta figure out how to stop the other spells casting now instead of swipe but I'm sure I can figure that out. Edit: I just used an else if statement in the swipe spell and it works perfectly, so now it'll cast swipe if 3 targets and shred if it's less than that. Thanks so much! 9 minutes ago, Zan said: Go download VS Community Edition and add WRobot references while writing in C# Yeah makes a lot of sense, I've just been a bit of a fool and stuck to using NP++ for a while now, I'll swap over to that thank you again also. Link to comment https://wrobot.eu/forums/topic/12837-use-certain-spell-when-a-certain-number-of-mobs-are-in-range/#findComment-61236 Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now