MrBottie 4 Posted October 11, 2016 Share Posted October 11, 2016 Hi, I'm tweaking my c# rogue class and I want to know how I can target the lowest hostile unit in a 10 yard range and Mark For Death on him when MFD is available. When i use Interact.InteractGameObject(unit.GetBaseAddress, true); after getting the unit, the game crashes :( Thx in advance! Link to comment https://wrobot.eu/forums/topic/4086-c-target-lowest-health-in-range-after-target-is-dead/ Share on other sites More sharing options...
iMod 99 Posted October 11, 2016 Share Posted October 11, 2016 if (ObjectManager.Me.TargetObject.IsDead && ObjectManager.Me.TargetObject.HaveBuff("Mark For Death") && new Spell("MFD ").IsSpellUsable) { // Settings int range = 10; WoWObjectType objectType = WoWObjectType.Unit; // Get target WoWUnit unit = ObjectManager.GetWoWUnitHostile().OrderBy(o => o.HealthPercent).FirstOrDefault(u => u.Type == objectType && u.IsAlive && (u.GetDistance <= range) && u.IsAttackable); if (unit != null) { Interact.InteractGameObject(unit.GetBaseAddress); } } You need to correct the spell names but something like this should work i took it out of my library so maybe something is missing and it is not tested like this. Hope that was something that will answer your question o.O Link to comment https://wrobot.eu/forums/topic/4086-c-target-lowest-health-in-range-after-target-is-dead/#findComment-18936 Share on other sites More sharing options...
MrBottie 4 Posted October 11, 2016 Author Share Posted October 11, 2016 38 minutes ago, iMod said: if (ObjectManager.Me.TargetObject.IsDead && ObjectManager.Me.TargetObject.HaveBuff("Mark For Death") && new Spell("MFD ").IsSpellUsable) { // Settings int range = 10; WoWObjectType objectType = WoWObjectType.Unit; // Get target WoWUnit unit = ObjectManager.GetWoWUnitHostile().OrderBy(o => o.HealthPercent).FirstOrDefault(u => u.Type == objectType && u.IsAlive && (u.GetDistance <= range) && u.IsAttackable); if (unit != null) { Interact.InteractGameObject(unit.GetBaseAddress); } } You need to correct the spell names but something like this should work i took it out of my library so maybe something is missing and it is not tested like this. Hope that was something that will answer your question o.O Not entirely sure how to add this in my spellstate list in C#... Last time i used Interact.InteractGameObject(unit.GetBaseAddress, true); and this crashed the game :-( Link to comment https://wrobot.eu/forums/topic/4086-c-target-lowest-health-in-range-after-target-is-dead/#findComment-18942 Share on other sites More sharing options...
iMod 99 Posted October 11, 2016 Share Posted October 11, 2016 27 minutes ago, MrBottie said: Not entirely sure how to add this in my spellstate list in C#... Last time i used Interact.InteractGameObject(unit.GetBaseAddress, true); and this crashed the game :-( With what kind of error? ;) Well you can create a method that targets what you want and use it in the spellstate engine. For the automate target you could write a small plugin that targets for you. Link to comment https://wrobot.eu/forums/topic/4086-c-target-lowest-health-in-range-after-target-is-dead/#findComment-18947 Share on other sites More sharing options...
MrBottie 4 Posted October 12, 2016 Author Share Posted October 12, 2016 14 hours ago, iMod said: With what kind of error? ;) Well you can create a method that targets what you want and use it in the spellstate engine. For the automate target you could write a small plugin that targets for you. private readonly Spell MarkedforDeath = new Spell("Marked for Death"); States = new List<State> { ... new SpellState("Marked for Death", 23, context => testMarkForDeath() == 1, false, true, false, false, false, false, false, false, 0, true, false, false, false, false, false, wManager.Wow.Helpers.FightClassCreator.YesNoAuto.Yes, "Combopoints Instant (Talent)", "none", true, true, false), ... } public int testMarkForDeath() { int mfd = 0; Logging.WriteFight("MFD TEST"); if (ObjectManager.Me.TargetObject.IsDead && MarkedforDeath.IsSpellUsable && ObjectManager.Me.HaveBuff("Blade Flurry")) { // Settings int range = 10; WoWObjectType objectType = WoWObjectType.Unit; // Get target WoWUnit unit = ObjectManager.GetWoWUnitHostile().OrderBy(o => o.HealthPercent).FirstOrDefault(u => u.Type == objectType && u.IsAlive && (u.GetDistance <= range) && u.IsAttackable); if (unit != null) { Logging.WriteFight("AOE UNIT FOUND"); Interact.InteractGameObject(unit.GetBaseAddress); } mfd = 1; } return mfd; } Can you tell me why it's not doing what I want? :) So when I'm doing AOE damage I want it to target the lowest Health mob of the pack and put MFD on his head when it's available... Link to comment https://wrobot.eu/forums/topic/4086-c-target-lowest-health-in-range-after-target-is-dead/#findComment-18980 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