12-04-2013, 09:08 PM
So, I added an additional "Fates" mode to the main GUI, with the goal being able to set Assist mode to prioritize/autoattack fate mobs or ones that are attacking me to stay alive. Since I'm self controlling, and I'll only be in one fate at a time, I don't care which fate the mob belongs to, only that it isn't 0. I can't find anything on this but I'm guessing that EntityList doesn't support negative versions of "=" like "fateid~=0" since my filter doesn't seem to work properly.
The code I have so far is:
My goal is to have the EntityList step-down from most acceptable to least acceptable targets, with the order being:
1) Lowest health, fate mobs targeting me.
2) Lowest health, mob targeting me.
3) Lowest health, fate mob.
I have the conditional fate~=0 in the EntityList for the first and last conditional however the only problem is that absolutely anything I click on qualifies into the first block for some reason so it's obviously not filtering like I expect. I have several debugs set up so that I could catch which conditional block it falls into and its always the first one.
Do I need to explicitly give it a fateid = <current fate I'm participating in>?
If so, is there a quick way I can do this?
Maybe there's something I'm missing.
Edit:
I ended up changing the code to check it after the fact in the EntityList:
I don't know that this approach is optimal but it seems to work well.
The code I have so far is:
Code:
elseif ( gAssistMode == "Fates" ) then
d("Fate mode detected")
local el = EntityList("lowesthealth,targetingme,alive,attackable,fateid~=0,maxdistance="..tostring(ml_global_information.AttackRange))
if ( el ) then
local i,e = next(el)
if (i~=nil and e~=nil) then
d("Target is lowest health in fate, targetingme.")
d(e.fateid)
target = e
end
else
el = EntityList("lowesthealth,targetingme,alive,attackable,maxdistance="..tostring(ml_global_information.AttackRange))
if ( el ) then
local i,e = next(el)
if (i~=nil and e~=nil) then
d("Target is lowest health targetingme.")
target = e
end
else
el = EntityList("nearest,alive,attackable,fateid~=nil,maxdistance="..tostring(ml_global_information.AttackRange))
if ( el ) then
local i,e = next(el)
if (i~=nil and e~=nil) then
d("Target is lowest health in fate.")
target = e
end
end
end
end
My goal is to have the EntityList step-down from most acceptable to least acceptable targets, with the order being:
1) Lowest health, fate mobs targeting me.
2) Lowest health, mob targeting me.
3) Lowest health, fate mob.
I have the conditional fate~=0 in the EntityList for the first and last conditional however the only problem is that absolutely anything I click on qualifies into the first block for some reason so it's obviously not filtering like I expect. I have several debugs set up so that I could catch which conditional block it falls into and its always the first one.
Do I need to explicitly give it a fateid = <current fate I'm participating in>?
If so, is there a quick way I can do this?
Maybe there's something I'm missing.
Edit:
I ended up changing the code to check it after the fact in the EntityList:
Code:
elseif ( gAssistMode == "Fates" ) then
d("Fate mode detected")
local el = EntityList("lowesthealth,alive,attackable,maxdistance="..tostring(ml_global_information.AttackRange))
if ( el ) then
local i,e = next(el)
if (i~=nil and e~=nil) then
if (e.fateid~=0 and e.targetingme) then
d("Target is lowest health in fate, targetingme.")
d(e.fateid)
target = e
elseif (e.targetingme) then
d("Target is targeting me, so fight back.")
d(e.fateid)
target = e
elseif (e.fateid~=0) then
d("Target is in FATE, kill it.")
d(e.fateid)
target = e
end
end
I don't know that this approach is optimal but it seems to work well.