Page 1 of 1

Check for debuff; if present, wait until gone before proceed

Posted: Wed Sep 22, 2010 10:03 am
by ou81too
There are some mobs that put a debuff that causes slips/falls (e.g. Lakaso in Weeping Coast). Having this debuff causes the bot to slip/fall while in battle which may interrupt attacks and even the use of items (e.g. healing pots). Is there a way to check for this debuff after a battle; if present after a battle, then wait before proceeding?

Re: Check for debuff; if present, wait until gone before pro

Posted: Wed Sep 22, 2010 10:04 am
by ou81too
Nevermind. Found this other post. Thanks anyways.

edit:
Actually, I tried the code in the linked post,

Code: Select all

      local debuff = RoMScript("GetPlayerBuffLeftTime(GetPlayerBuff(1,'HARMFUL'))");
      if(debuff == nil) then
         debuff = 0;
      end
      while debuff ~= 0 do
         printf("Debuff:%s\n", debuff);
         yrest(1000);
         debuff = 0;
         debuff = RoMScript("GetPlayerBuffLeftTime(GetPlayerBuff(1,'HARMFUL'))");
         if(debuff == nil) then
            debuff = 0;
         end
      end
      printf("No Debuff, lets resume\n");
but if another mob attacks while in the check for debuffs, the bot does not fight back :( The bot seems to be stuck in debuff check loop. Am I missing something?

Re: Check for debuff; if present, wait until gone before pro

Posted: Thu Sep 23, 2010 2:21 am
by rock5
ou81too wrote:Actually, I tried the code in the linked post, but if another mob attacks while in the check for debuffs, the bot does not fight back :( The bot seems to be stuck in debuff check loop. Am I missing something?
I did some testing of GetPlayerBuff. No matter what values I used it always returned -1. I suspect this function has been disabled.

You could probably use "UnitDebuff()" but I can't test if it still works now because the servers are down.

If UnitBuff() and UnitDebuff() still work you also use the rombot equivilent.

Just run player:updateBuffs() then you can check if the variable player.Debuffs has any values. This, though, updates both buffs and debuffs so would be a bit slower.

A problem with that code, though, is it won't heal or apply buffs while it's waiting and probably wont fight back if attacked. It should probably call checkPotions() and checkSkills() in it's loop but an even better solution might be to use player:rest(). It fights back when attacked and uses potions and skills. Maybe you could use GetPlayerBuffLeftTime() then get player:rest() to rest that amount. Or maybe just use player:rest(300,300,"full"). That will basically rest after each battle until hp and mp are full before continuing.

Enough speculation, I'll try and help you with this after the servers come back.

Re: Check for debuff; if present, wait until gone before pro

Posted: Thu Sep 23, 2010 9:42 am
by rock5
Ok, maybe you could try something like this

Code: Select all

<onLeaveCombat>
   debuff = RoMScript("UnitDebuff('player',1)")
   while debuff ~= nil do
      player:rest(1)
      debuff = RoMScript("UnitDebuff('player',1)")
   end
   printf("No Debuff, lets resume\n");
</onLeaveCombat>
This should rest until all debuffs are gone, use potions and skills and fight back if attacked.