Upon trying to play the game as a dark elf master the game seems to throw a bunch of errors upon any action, which can be seen here
https://pomf2.lain.la/f/w7f2sxh1.png
(could not copy the text as curses wasn't found on my system).
I was able to fix the bug due to some checks, however I can't submit a patch due to it being in the lua.
Namely two values were null in get_level_school
__tmp_spells[s]
__spell_school[s]
I was able to fix it by turning the code into
-- Change this fct if I want to switch to learnable spells
function get_level_school(s, max, min)
local lvl, sch, index, num, bonus
local allow_spell_power = TRUE
lvl = 0
num = 0
bonus = 0
-- No max specified ? assume 50
if not max then
max = 50
end
if not min then
min = 1
end
-- Do we pass tests?
if __tmp_spells[s] then
if __tmp_spells[s].depend then
if __tmp_spells[s].depend() ~= TRUE then
return min, "n/a"
end
end
end
if (not __spell_school[s]) then
return min, "n/a"
end
for index, sch in __spell_school[s] do
local r, s, p, ok = 0, 0, 0, 0
the parts of the code that were called before this look like
function get_level(s, max, min)
if type(s) == "number" then
-- Ahah shall we use Magic device instead ?
if get_level_use_stick > -1 then
return get_level_device(s, max, min)
else
local lvl, na = get_level_school(s, max, min)
return lvl
end
else
return get_level_power(s, max, min)
end
end
-- Get the amount of mana(or power) needed
function get_mana(s)
return spell(s).mana + get_level(s, spell(s).mana_max - spell(s).mana, 0)
end
add_hooks
{
-- Reduce the mana by four times the cost of the spell
[HOOK_CALC_MANA] = function(msp)
if player.inertia_controlled_spell ~= -1 then
msp = msp - (get_mana(player.inertia_controlled_spell) * 4)
if msp < 0 then msp = 0 end
return TRUE, msp
Has this error occurred before? How best should I submit a patch for this?
Upon trying to play the game as a
dark elf masterthe game seems to throw a bunch of errors upon any action, which can be seen herehttps://pomf2.lain.la/f/w7f2sxh1.png
(could not copy the text as curses wasn't found on my system).
I was able to fix the bug due to some checks, however I can't submit a patch due to it being in the lua.
Namely two values were null in
get_level_schoolI was able to fix it by turning the code into
the parts of the code that were called before this look like
Has this error occurred before? How best should I submit a patch for this?