Addon Help: Checking Buffs on player

All development conversation and discussion takes place here

Moderator: Moderator

Post Reply
Message
Author
Micbran
Sher'Tul
Posts: 1154
Joined: Sun Jun 15, 2014 12:19 am
Location: Yeehaw, pardner

Addon Help: Checking Buffs on player

#1 Post by Micbran »

So, for the on_pre_use function that can be defined for a talent, it obviously returns a boolean But, I was wondering how do you check if the player has a certain buff/debuff on them? And a little bit more than that, how can you check how many stacks of that buff/debuff are on and then shove all that in the on_pre_use function? Thanks in advance.
A little bit of a starters guide written by yours truly here.

darkgod
Master of Eyal
Posts: 10750
Joined: Wed Jul 24, 2002 9:26 pm
Location: Angolwen
Contact:

Re: Addon Help: Checking Buffs on player

#2 Post by darkgod »

Code: Select all

if self:hasEffect(self.EFF_FOO) then ...
Has for how many stacks you'll have to check the particular effect code; they dont have all stacks (most dont)
[tome] joylove: You can't just release an expansion like one would release a Kraken XD
--
[tome] phantomfrettchen: your ability not to tease anyone is simply stunning ;)

stinkstink
Spiderkin
Posts: 543
Joined: Sat Feb 11, 2012 1:12 am

Re: Addon Help: Checking Buffs on player

#3 Post by stinkstink »

I like to add the following function to effects that are going to have their number of charges checked:

Code: Select all

getCharges = function(self, eff) return eff.cur_charges end,
That way when I want to check if the effect is active and how many stacks are applied, I can just use

Code: Select all

local charges = self:callEffect("EFF_EFFECT_NAME", "getCharges") or 0

Nagyhal
Wyrmic
Posts: 282
Joined: Tue Feb 15, 2011 12:01 am

Re: Addon Help: Checking Buffs on player

#4 Post by Nagyhal »

That's a fantastic bit of ToME shorthand, stinkstink!

Zireael
Archmage
Posts: 449
Joined: Tue Jun 18, 2013 7:24 pm

Re: Addon Help: Checking Buffs on player

#5 Post by Zireael »

Nagyhal wrote:That's a fantastic bit of ToME shorthand, stinkstink!
I concur, this is excellent!

Post Reply