Jump to content

Alot of questions about FightClass and API


Recommended Posts

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
Share on other sites

// 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();
};

 

Link to comment
Share on other sites

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
Share on other sites

  • 3 weeks later...

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
Share on other sites

1. Don't subscribe to events in a loop:ph34r:
2. Don't use delegates if you don't understand them until you did some research about them(just a recommendation):wub:

This looks like you just copied the code without to knowledge what it does :rolleyes: you (need) to use it in the initialize method.
Just put it infront of the "While" and you should be fine.

Edited by iMod
Link to comment
Share on other sites

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
Share on other sites

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
Share on other sites

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 by iMod
Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...