-The last error was my fault (I had that part of code in my hero_manager.lua script, to choose the tunic depending on the hero I had, and I didn't test the simplified new code which was new and untested). It should work with your change.
-For the two first errors, first try with the code I have in my scripts:
in the action_icon.lua I have this function:
function action_icon:compute_icon_region_y()
local y
if action_icon.effect_displayed ~= nil then
-- Create an icon with the name of the current effect.
local effects_indexes = {
["validate"] = 1,
["next"] = 2,
["info"] = 3,
["return"] = 4,
["look"] = 5,
["open"] = 6,
["action"] = 7,
["lift"] = 8,
["throw"] = 9,
["grab"] = 10,
["stop"] = 11,
["speak"] = 12,
["change"] = 13,
["swim"] = 14,
["talk"] = 12,
["custom_lift"] = 8,
["custom_carry"] = nil,
["custom_jump"] = nil,
}
if effects_indexes[action_icon.effect_displayed] ~= nil then
action_icon.icon_region_y = 24 * effects_indexes[action_icon.effect_displayed]
end
end
end
and in the attack_icon.lua I have this function like this:
function attack_icon:compute_icon_region_y()
if attack_icon.effect_displayed ~= nil or not game:is_dialog_enabled() then
if attack_icon.effect_displayed == nil then
-- Show an empty icon.
attack_icon.icon_region_y = 0
elseif attack_icon.effect_displayed == "sword" then
-- Create an icon with the current sword.
attack_icon.icon_region_y = 96 + 24 * attack_icon.sword_displayed
elseif attack_icon.effect_displayed ~= nil then
-- Create an icon with the name of the current effect.
local effects_indexes = {
["save"] = 1,
["return"] = 2,
["validate"] = 3,
["skip"] = 4,
["custom_carry"] = 5,
["custom_jump"] = nil,
}
if effects_indexes[attack_icon.effect_displayed] ~= nil then
attack_icon.icon_region_y = 24 * effects_indexes[attack_icon.effect_displayed]
end
end
end
end
Tell me what you get with these new changes when you have time to test again. We are getting close to make it work (when we make the hud work, the rest will be a piece of cake).