Page 1 of 1

[svn 5720] monsters attack repeatedly while lua errors

Posted: Sat Sep 29, 2012 3:36 am
by greycat
After entering Trollmire(3) I started getting Lua errors during almost every fight. Even after leaving Trollmire and going on to Zigur. I "reported" some of them at random. There were many, many, many, many more.

In some cases, a monster decided it would be cool to attack me repeatedly while I sit there helplessly. I did not get to do anything while this occurred, but apparently some tiny fraction of my retaliation damage seemed to hit the monster (I should have had WAY more). This happened at least twice, with the first monster dying to the retaliation. Here is the second one:

[LOG] Vog hits dread for #aaaaaa#8 physical#LAST#, #aaaaaa#8 physical#LAST#, #aaaaaa#8 physical#LAST#, #aaaaaa#8 physical#LAST#, #aaaaaa#8 physical#LAST#, #aaaaaa#8 physical#LAST#, #aaaaaa#8 physical#LAST# damage (total 54.60).
[LOG] Dread hits Vog for #aaaaaa#40 physical#LAST#, #aaaaaa#42 physical#LAST#, #aaaaaa#40 physical#LAST#, #aaaaaa#40 physical#LAST#, #aaaaaa#43 physical#LAST#, #aaaaaa#40 physical#LAST#, #aaaaaa#40 physical#LAST# damage (total 283.57).
[LOG] #{bold}#Dread killed Vog!#{normal}#
[LOG] #{bold}#Vog the level 12 dwarf wyrmic was battered to death by a dread on level 1 of Zigur.#{normal}#

Re: [svn 5720] monsters attack repeatedly while lua errors

Posted: Sat Sep 29, 2012 1:40 pm
by Sradac
This is happening to me as well.

By chance, what class are you? I was playing solipsist and I thought something with either feedback generation or damage psi instead of health was broken.

edit - nm, just saw dwarf wyrmic.

Re: [svn 5720] monsters attack repeatedly while lua errors

Posted: Sat Sep 29, 2012 1:50 pm
by Un67
Something like this also happened to me in the Heart of the Gloom with a Dwarf Corruptor as I fought the Withering Thing. There was at least one error each turn, sometimes just when I was resting in the area near where it was (of course I didn't know that at the time). I ended up getting killed by it at the end and there must have been at least maybe 20 or so error windows that popped up when that happened.

Re: [svn 5720] monsters attack repeatedly while lua errors

Posted: Sat Sep 29, 2012 1:58 pm
by Noel
Yeah, I just got lua-error'ed to death by this as well.

I think I've found the bug. svn 5717 ("fix meditation exp range") changed modules/tome/class/interface/Combat.lua, line 622:

Code: Select all

 	if hitted then for typ, dam in pairs(target.on_melee_hit) do
-		if dam > 0 then
+		if (type(dam) == "number" and dam > 0) or (dam.dam and dam.dam > 0) then
 			DamageType:get(typ).projector(target, self.x, self.y, typ, dam)
 		end
 	end end
If dam is a number and < 0, the first condition fails, and it tries to access dam.dam, which fails since dam is a number.

Should have something like this, separating the extraction of numeric damage from the actual condition. (This patch seems to work for me.)

Code: Select all

diff --git a/game/modules/tome/class/interface/Combat.lua b/game/modules/tome/cl
index 6a5a3bb..50280cd 100644
--- a/game/modules/tome/class/interface/Combat.lua
+++ b/game/modules/tome/class/interface/Combat.lua
@@ -619,7 +619,8 @@ function _M:attackTargetWith(target, weapon, damtype, mult, 
 
        -- Reactive target on hit damage
        if hitted then for typ, dam in pairs(target.on_melee_hit) do
-               if (type(dam) == "number" and dam > 0) or (dam.dam and dam.dam > 0) then
+               local mydam = type(dam) == "number" and dam or dam.dam
+               if (mydam > 0) then
                        DamageType:get(typ).projector(target, self.x, self.y, ty
                end
        end end

Re: [svn 5720] monsters attack repeatedly while lua errors

Posted: Wed Oct 03, 2012 7:18 pm
by darkgod
fixed thanks