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

Runes of Magic/Radiant Arcana (http://www.runesofmagic.com)
Post Reply
Message
Author
ou81too
Posts: 12
Joined: Fri Jul 23, 2010 2:21 pm

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

#1 Post by ou81too » Wed Sep 22, 2010 10:03 am

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?

ou81too
Posts: 12
Joined: Fri Jul 23, 2010 2:21 pm

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

#2 Post by ou81too » Wed Sep 22, 2010 10:04 am

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?

User avatar
rock5
Posts: 12173
Joined: Tue Jan 05, 2010 3:30 am
Location: Australia

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

#3 Post by rock5 » Thu Sep 23, 2010 2:21 am

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.
  • Please consider making a small donation to me to support my continued contributions to the bot and this forum. Thank you. Donate
  • I check all posts before reading PMs. So if you want a fast reply, don't PM me but post a topic instead. PM me for private or personal topics only.
  • How to: copy and paste in micromacro
    ________________________
    Quote:
    • “They say hard work never hurt anybody, but I figure, why take the chance.”
          • Ronald Reagan

User avatar
rock5
Posts: 12173
Joined: Tue Jan 05, 2010 3:30 am
Location: Australia

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

#4 Post by rock5 » Thu Sep 23, 2010 9:42 am

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.
  • Please consider making a small donation to me to support my continued contributions to the bot and this forum. Thank you. Donate
  • I check all posts before reading PMs. So if you want a fast reply, don't PM me but post a topic instead. PM me for private or personal topics only.
  • How to: copy and paste in micromacro
    ________________________
    Quote:
    • “They say hard work never hurt anybody, but I figure, why take the chance.”
          • Ronald Reagan

Post Reply

Who is online

Users browsing this forum: Ahrefs [Bot], Google [Bot] and 2 guests