The basic script works fine. It goes through the list of afflictions until it finds the highest priority affliction the target currently has and removes it.
Code: Select all
local cure_priority = 1
function target_usedcure(cure)
local aff_check = opiate[cure_priority]
if
table.contains(target_affs, aff_check) == true
then
table.remove(target_affs, tonumber(table.index_of(target_affs, aff_check)))
cure_priority = 1
else
cure_priority = cure_priority + 1
target_usedcure()
end
end
Code: Select all
function target_usedcure()
local aff_check = [b]opiate[/b][cure_priority]
Code: Select all
function target_usedcure(cure)
local aff_check = cure[cure_priority]