I have a question regarding checking the success of a certain action. More particularly, I have coded an instruction so, if my necro climbs to the top of the aggro ladder and takes damage, he automatically casts Feign Death.
Unfortunately, as we all know, FD sometimes fails randomly, and I would like to code a parachute instruction so if it fails, the necro stands up and casts again:
Code:
local mq = require('mq')
local FD = "Feign Death"
local function cast(spell)
mq.cmdf('/cast %s', spell)
mq.delay(100)
end
local function stand()
mq.cmdf('/stand')
mq.delay(100)
end
local function condition()
local Class = mq.TLO.Me.Class.ShortName()
local Feigning = mq.TLO.Me.Feigning()
local SpellReady = mq.TLO.Me.SpellReady
local CombatMobs = mq.TLO.Me.XTarget()
local PctHPs = mq.TLO.Me.PctHPs()
local Aggro = mq.TLO.Me.PctAggro()
if Class == 'NEC' and CombatMobs > 0 and PctHPs < 100 and Aggro == 100 and not Feigning and mq.TLO.Me.SpellReady(FD)() then
cast(FD)
mq.cmd('/g Casting ', FD)
mq.delay(3000)
---CHECK IF FEIGN DEATH HAS FAILED
if Class == 'NEC' and not Feigning then
stand()
cast(FD)
mq.cmd('/g Casting again ', FD)
mq.delay(1000)
end
mq.delay(1000)
end
end
So, as you can see, I add a second IF inside the main IF to check if the necro is indeed Feigning after having cast FD. However, that is not really an elegant solution because 1) I need to delay(3000) to check the Feigning status (while I might be taking a beating from the mob), and 2) If FD fails a second time, then I am screwed
Any other way to better express that FD status check? THANKS!