Sustains with a targeter question

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

Sustains with a targeter question

#1 Post by Micbran »

If I make a sustain with a targeter, I.E. it selects an area and then does an effect on it once you activate it, but the player cancels the targeter by pressing esc. or whatever, would I be able to use forceUseTalent(MyTalent, {no_energy = true}) and then refund the player energy, thus giving them the turn back and turning the sustain off?
A little bit of a starters guide written by yours truly here.

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

Re: Sustains with a targeter question

#2 Post by stinkstink »

Couldn't you just use

Code: Select all

local tg = self:getTalentTarget(t)
local x, y, target = self:getTarget(tg)
if not x or not y or not target then return nil end
in the activate function to prevent it from being turned on without a target?

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

Re: Sustains with a targeter question

#3 Post by Micbran »

I wasn't sure if returning nil would prevent it from being turned on, since sustain activate functions usually return a table and not true like action functions do.
A little bit of a starters guide written by yours truly here.

Post Reply