ToME: the Tales of Maj'Eyal

Everything about ToME
It is currently Wed Dec 19, 2018 11:45 am

All times are UTC




Post new topic Reply to topic  [ 5 posts ] 
Author Message
PostPosted: Fri Nov 06, 2015 2:52 pm 
Offline
Uruivellas

Joined: Tue May 14, 2013 3:45 pm
Posts: 838
I have a throwing knife talent that uses stacks on a temporary effect to simulate ammo. To make it simple, I wanted it to restore knives while resting, via the following callback:

Code:
   callbackOnRest = function(self, t)
      local reload = self:callTalent(self.T_THROWING_KNIVES, "getReload")
      local max = self:callTalent(self.T_THROWING_KNIVES, "getNb")
      self:setEffect(self.EFF_THROWING_KNIVES, 1, {stacks=reload, max_stacks=max })
   end,


However, what instead happens is that when you hit the rest key, even if there are mobs nearby and you only rest for 0 turns it still restores your stacks to maximum. What am I doing wrong?


Top
 Profile  
 
PostPosted: Fri Nov 06, 2015 9:45 pm 
Offline
Uruivellas

Joined: Fri Oct 10, 2014 4:00 pm
Posts: 872
Have you verified that it's not a problem with those getReload and getNb methods? Also, I would recommend changing getNb to a more descriptive name.


Top
 Profile  
 
PostPosted: Sun Nov 08, 2015 9:15 pm 
Offline
Uruivellas

Joined: Tue May 14, 2013 3:45 pm
Posts: 838
Yeah, the same bit of code is used elsewhere so it's fine. What I did notice is that it seems to trigger twice on a 0 turn rest - e.g. when it's supposed to reload 2 daggers per turn, just hitting rest once returns 4.


Top
 Profile  
 
PostPosted: Sun Nov 08, 2015 11:43 pm 
Offline
Perspiring Physicist

Joined: Sun Sep 09, 2012 7:43 am
Posts: 5780
Does it have a state variable notifying if it is triggering on rest initiated or on rest ended/interupted?

_________________
My feedback meter decays into coding. Give me feedback and I make mods.


Top
 Profile  
 
PostPosted: Mon Nov 09, 2015 10:16 am 
Offline
Uruivellas

Joined: Tue May 14, 2013 3:45 pm
Posts: 838
Nope! Looking at it now I think that's the issue, that it's prob just calling the reload without checking whether the rest is in progress etc. Shame there isn't many examples of on rest callbacks in the code.


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 2 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