player:hasDebuff

Runes of Magic/Radiant Arcana (http://www.runesofmagic.com)
Post Reply
Message
Author
WhiteTiger
Posts: 84
Joined: Tue Jun 22, 2010 8:06 am

player:hasDebuff

#1 Post by WhiteTiger » Thu Mar 24, 2011 5:42 pm

hi,
can anyone confirm if player:hasDebuff is working or not? or if its just me. cuz i tried this

Code: Select all

		if player:hasDebuff("Blind") then
			print("yes")
		end
and yeah I had the debuff on me, I got this response in micromacro:
blabla/pawn.lua:534: bad argument #1 to 'gmatch' (string expected, got nil)
apriciation for any help

WhiteTiger
Posts: 84
Joined: Tue Jun 22, 2010 8:06 am

Re: player:hasDebuff

#2 Post by WhiteTiger » Thu Mar 24, 2011 8:55 pm

nvm my post, could use player:hasBuff() instead

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

Re: player:hasDebuff

#3 Post by rock5 » Fri Mar 25, 2011 1:38 am

Except hasDebuff runs hasBuff. So if hasBuff works so should hasDebuff.

Code: Select all

function CPawn:hasDebuff(deBuff, count)
	return self:hasBuff(debuff, count)
end
  • 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

BlueNitro
Posts: 4
Joined: Tue Mar 15, 2011 9:54 am

Re: player:hasDebuff

#4 Post by BlueNitro » Fri Mar 25, 2011 10:05 am

I was trying to write a skill sequence for rogue depending on the debuffs on the target, and I found that it was not working for me either. So I executed the following code whenever my target had bleed. See attached screen shot also.

Code: Select all

target=player:getTarget();print(target:hasDebuff("Bleed"));

It would always return false when the target clearly had the debuff. I also tried using hasBuff since I see it is the same thing. I also tried it with other deBuffs like, Blind and Grievous Wound. Still returned false.

Below is my onPreSkillCast that I'm trying to get working in my profile.

Code: Select all

	<onPreSkillCast>
		player:update()

		local target = player:getTarget()

		if arg1 == "ROGUE_BLIND_STAB" and target:hasDebuff("Blind") then
    			return false

		elseif arg1 == "ROGUE_SHADOWSTAB" and target:hasDebuff("Bleed") then
    			return false

		elseif arg1 == "ROGUE_LOW_BLOW" and target:hasDebuff("Grievous Wound") then
    			return false

		elseif arg1 == "ROGUE_WOUND_ATTACK" and not target:hasDebuff("Grievous Wound") then
    			return false
		end

		return true
	</onPreSkillCast>
Attachments
hasDebuff.jpg

User avatar
lisa
Posts: 8332
Joined: Tue Nov 09, 2010 11:46 pm
Location: Australia

Re: player:hasDebuff

#5 Post by lisa » Fri Mar 25, 2011 10:18 am

you need to use

Code: Select all

arg1.Name
As an example

Code: Select all

	<onPreSkillCast><![CDATA[

      		if( arg1.Name == "WARRIOR_SURPRISE_ATTACK" ) then
local cooldown, remaining = RoMScript("GetSkillCooldown(4,7);")
      			if remaining > 3 then 
      			return false
      			end
local target = player:getTarget()
           		if 60 > distance(player.X, player.Z, target.X, target.Z) then
               		return false -- doesn't use the skill
           		end
       		return true
       		end

	]]></onPreSkillCast>
Remember no matter you do in life to always have a little fun while you are at it ;)

wiki here http://www.solarstrike.net/wiki/index.php?title=Manual

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

Re: player:hasDebuff

#6 Post by rock5 » Fri Mar 25, 2011 10:38 am

Ah I found the problem. I misspelt the buff variable when I passed it to the hasBuff function. Should be

Code: Select all

function CPawn:hasDebuff(debuff, count)
	return self:hasBuff(debuff, count)
end
Fixed in rev 583.
  • 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
lisa
Posts: 8332
Joined: Tue Nov 09, 2010 11:46 pm
Location: Australia

Re: player:hasDebuff

#7 Post by lisa » Fri Mar 25, 2011 11:16 am

lol you and your typo's ;)
Remember no matter you do in life to always have a little fun while you are at it ;)

wiki here http://www.solarstrike.net/wiki/index.php?title=Manual

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

Re: player:hasDebuff

#8 Post by rock5 » Fri Mar 25, 2011 11:26 am

Where were you? Why didn't you catch me up on that one?
  • 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

BlueNitro
Posts: 4
Joined: Tue Mar 15, 2011 9:54 am

Re: player:hasDebuff

#9 Post by BlueNitro » Fri Mar 25, 2011 11:41 am

Thank you very much for the response.

I updated to 583 and changed to arg1.Name. It's still not working. I even verified that the debuff variable's name is correct when passing to hasBuff in hasDebuff function.

So I tried it at the command line and it's returning false with hasDebuff and hasBuff when my target has the debuffs.

Code: Select all

        RomBot command line
Type in 'q' (without quotes) to quit.
Command> target = player:getTarget();print(target:hasDebuff("Bleed"));
false
Command> target = player:getTarget();print(target:hasDebuff("Bleed"));
false
Command> target = player:getTarget();print(target:hasDebuff("Grievous Wound"));
false
Command> target = player:getTarget();print(target:hasBuff("Bleed"));
false
Command>

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

Re: player:hasDebuff

#10 Post by rock5 » Fri Mar 25, 2011 11:47 am

Forgot to say. You need to do a player:update after targeting the mob or the bot wont know you have a target.

Try;

Code: Select all

player:update() target = player:getTarget() print(target:hasDebuff("Bleed"))
  • 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

BlueNitro
Posts: 4
Joined: Tue Mar 15, 2011 9:54 am

Re: player:hasDebuff

#11 Post by BlueNitro » Fri Mar 25, 2011 12:19 pm

Thanks Rock, update() made it work. And thanks Lisa, for letting me know I need to use "Name".

User avatar
lisa
Posts: 8332
Joined: Tue Nov 09, 2010 11:46 pm
Location: Australia

Re: player:hasDebuff

#12 Post by lisa » Fri Mar 25, 2011 8:15 pm

rock5 wrote:Where were you? Why didn't you catch me up on that one?
lol I did actually notice it yet yesterday but thought nah Rock couldn't have done yet another typo lol
Remember no matter you do in life to always have a little fun while you are at it ;)

wiki here http://www.solarstrike.net/wiki/index.php?title=Manual

Post Reply

Who is online

Users browsing this forum: Ahrefs [Bot] and 3 guests