When trying to cast a spell on a Trust NPC by name rather than with the it as the current target, sometimes GearSwap would prevent the spell from being cast. The issue is persistent on a given Trust NPC once it starts. It appears as though the wrong instance of the Trust NPC would be picked up as the spell target.
Command used for testing: /ma "Cure IV" Tenzen
With GearSwap unloaded, I was able to successfully cast magic on Trust NPCs. I was able to duplicate the result of having a spell be prevented from casting while using a completely fresh Character_JOB.lua file with nothing in it.
Code that I added to that file that fixes the problem:
function init()
trusts = S{}
for _,spell in pairs(gearswap.res.spells) do
if (spell.type == 'Trust') then
trusts:add(spell.en)
end
end
end
init()
function pretarget(spell)
if trusts:contains(spell.target.name) then
local pt_targ = get_party_member(spell.target.name)
if (pt_targ ~= nil) then
change_target(tostring(pt_targ.mob.id))
end
end
end
function get_party_member(name)
for _,member in pairs(windower.ffxi.get_party()) do
if (type(member)=='table') and (member.name == name) then
return member
end
end
return nil
end
When trying to cast a spell on a Trust NPC by name rather than with the it as the current target, sometimes GearSwap would prevent the spell from being cast. The issue is persistent on a given Trust NPC once it starts. It appears as though the wrong instance of the Trust NPC would be picked up as the spell target.
Command used for testing:
/ma "Cure IV" Tenzen
With GearSwap unloaded, I was able to successfully cast magic on Trust NPCs. I was able to duplicate the result of having a spell be prevented from casting while using a completely fresh Character_JOB.lua file with nothing in it.Code that I added to that file that fixes the problem: