ToME: the Tales of Maj'Eyal

Everything about ToME
It is currently Thu Apr 26, 2018 11:01 am

All times are UTC




Post new topic Reply to topic  [ 5 posts ] 
Author Message
PostPosted: Fri Jan 29, 2016 3:15 pm 
Offline
Sher'Tul

Joined: Sun Jun 15, 2014 12:19 am
Posts: 1141
Location: Yeehaw, pardner
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.


Top
 Profile  
 
PostPosted: Fri Jan 29, 2016 4:05 pm 
Offline
Master of Eyal

Joined: Wed Jul 24, 2002 9:26 pm
Posts: 10188
Location: Angolwen
Code:
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 ;)


Top
 Profile  
 
PostPosted: Sat Jan 30, 2016 12:28 pm 
Offline
Spiderkin

Joined: Sat Feb 11, 2012 1:12 am
Posts: 543
I like to add the following function to effects that are going to have their number of charges checked:
Code:
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:
local charges = self:callEffect("EFF_EFFECT_NAME", "getCharges") or 0


Top
 Profile  
 
PostPosted: Fri Aug 19, 2016 12:23 am 
Offline
Wyrmic

Joined: Tue Feb 15, 2011 12:01 am
Posts: 282
That's a fantastic bit of ToME shorthand, stinkstink!


Top
 Profile  
 
PostPosted: Wed Aug 24, 2016 8:53 am 
Offline
Archmage

Joined: Tue Jun 18, 2013 7:24 pm
Posts: 449
Nagyhal wrote:
That's a fantastic bit of ToME shorthand, stinkstink!


I concur, this is excellent!

_________________
Working on a T-Engine game
Veins of the Earth

Veins of the Earth ModDB page


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 5 posts ] 

All times are UTC


Who is online

Users browsing this forum: No registered users and 4 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group