Findeh 34 Posted August 19, 2017 Author Share Posted August 19, 2017 Well, this is a nice thing. Thank you. Tested it, it seems like it's triggered when target is dead. So if you got 2 target, buffs will be triggered when you have killed one, but still got one to kill. Link to comment https://wrobot.eu/forums/topic/6494-alot-of-questions-about-fightclass-and-api/?page=2#findComment-30876 Share on other sites More sharing options...
Apexx 60 Posted August 19, 2017 Share Posted August 19, 2017 // Return Number of Hostile Units Attacking in Specified Range private int HostileUnitsInRange(float range) { int hostileUnitsInRange = ObjectManager.GetUnitAttackPlayer().Count(u => u.GetDistance <= range); return hostileUnitsInRange; } Try something like the following (Will check if no unit is attacking you within 30 yards): wManager.Events.FightEvents.OnFightEnd += delegate { if (HostileUnitsInRange(30) == 0) Buff(); }; Findeh 1 Link to comment https://wrobot.eu/forums/topic/6494-alot-of-questions-about-fightclass-and-api/?page=2#findComment-30886 Share on other sites More sharing options...
Findeh 34 Posted August 19, 2017 Author Share Posted August 19, 2017 Thank you once again for your advices. Don't know why but if i'm placing OnFightEnd it's ruin skinning. Did it this way. Buff() code block used all the time (no condition), but every buff is used with like 6 different conditions. Still not perfect, but atleast it buffs before combat as well now. I have tryed as well to make bot stop moving if we are inside the buff section and we need to buff, but it looks wierd, not like it supose to be. He starts to move alittle wierd shaking :) Link to comment https://wrobot.eu/forums/topic/6494-alot-of-questions-about-fightclass-and-api/?page=2#findComment-30898 Share on other sites More sharing options...
Findeh 34 Posted September 4, 2017 Author Share Posted September 4, 2017 Good day, guys. Have tried to solve some existing bot problems by listening an events. The idea is, for example,, when bot need to regen, do something. So i've tried to listen in loop like this: Spoiler while (_isLaunched) { try { #region Events EventsLuaWithArgs.OnEventsLuaWithArgs += delegate (LuaEventsId id, List<string> args) { #region PLAYER_REGEN_ENABLED if (id == LuaEventsId.PLAYER_REGEN_ENABLED) { Lua.LuaDoString("blah-blah-blah"); } #endregion }; #endregion { catch(Exception) { // Panic } Thread.Sleep(500); } But it's do nothing, and, to be honest, i don't understand how it works, so can't get what am i doing wrong and it how to fix this. Maybe the problem is like: "everithing wrong", sorry for that, i'm writing shit-code not on purpos, just because of my stupidity. Link to comment https://wrobot.eu/forums/topic/6494-alot-of-questions-about-fightclass-and-api/?page=2#findComment-31571 Share on other sites More sharing options...
iMod 99 Posted September 4, 2017 Share Posted September 4, 2017 (edited) 1. Don't subscribe to events in a loop 2. Don't use delegates if you don't understand them until you did some research about them(just a recommendation) This looks like you just copied the code without to knowledge what it does you (need) to use it in the initialize method. Just put it infront of the "While" and you should be fine. Edited September 4, 2017 by iMod Findeh 1 Link to comment https://wrobot.eu/forums/topic/6494-alot-of-questions-about-fightclass-and-api/?page=2#findComment-31573 Share on other sites More sharing options...
Findeh 34 Posted September 5, 2017 Author Share Posted September 5, 2017 Thank you for your answer. Yes, it's your code that i don't understand. :) As well as c# in general, lol Will try to rework it today as you said, thank you. I'll come back later if it still will not work. Link to comment https://wrobot.eu/forums/topic/6494-alot-of-questions-about-fightclass-and-api/?page=2#findComment-31610 Share on other sites More sharing options...
Findeh 34 Posted September 5, 2017 Author Share Posted September 5, 2017 Okay, it's not working. Not the code itself, it works perfectly. Thank you. But not the events. They are not what i expected. PLAYER_REGEN_ENABLED happens after every combat, even if you don't need to regen, so it's not like "Am i need to regen?" more like "Lets check do i ned it or not" So any action that happenf with condition id==PLAYER_REGEN_ENABLED will happen after every combat. But will not happen after resurection or bot satart. The problem is, you may need regen not only after combat. For example after you have buffed or healed or casted something while run or just have resurected. That's what i'd like to check. The only solution that i can imagine right now is to check in a loop: is your current mana less then you regenerate mana setting? And same for health. And if it's true, force-regen somehow. Don't know how. Any advices maybe? Link to comment https://wrobot.eu/forums/topic/6494-alot-of-questions-about-fightclass-and-api/?page=2#findComment-31617 Share on other sites More sharing options...
iMod 99 Posted September 5, 2017 Share Posted September 5, 2017 (edited) 1 hour ago, Findeh said: Okay, it's not working. Not the code itself, it works perfectly. But not the events. They are not what i expected. PLAYER_REGEN_ENABLED happens after every combat, even if you don't need to regen, so it's not like "Am i need to regen?" more like "Lets check do i ned it or not" So any action that happenf with condition id==PLAYER_REGEN_ENABLED will happen after every combat. But will not happen after resurection or bot satart. The problem is, you may need regen not only after combat. For example after you have buffed or healed or casted something while run. That's what i'd like to chek. The only solution that i can imagine right now is to check in a loop is your current mana less then you regenerate mana setting. And same for health. And if it's true, force-regen somehow. Don't know how. http://wowprogramming.com/docs/events/PLAYER_REGEN_ENABLED There is no wow event that will tell you what you have to do. Those events have nothing todo with the bot it self, that a raw wow events. You can't reg if you are infight if i'm not wrong o.O just take a look at the event list at the site above and i bet you will find some that will match your needs. Edit: Make sure you use the website with archive.org together to get valid outputs for your game version. Edited September 5, 2017 by iMod Link to comment https://wrobot.eu/forums/topic/6494-alot-of-questions-about-fightclass-and-api/?page=2#findComment-31618 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