Page 1 of 1

ActBase Callback Damage Bug

Posted: Sun Nov 02, 2014 12:41 am
by StarKeep
When dealing damage inside an ActBase callback, the game will incorrectly use the talent itself as the source of damage, instead of the Actor who activated it.

Example code works fine if it's moved into a 'do_effect' function, and called via superload, but doesn't properly work as a straight up callback.

Note that calling the 'do_effect' function from a callback also has this same issue.

Edit; this apparently happens with other callbacks.
Same issue is happening to Spellsword's damage procs.

Exp is correctly awarded to the caster of the talent, but due to it being attributed to the talent itself, no #'s pop up for the player, nor does it actually say the source of the damage in the game-log, which could cause some confusion in fights against a class/race which shares a talent with the player.

Code: Select all

local tg = self:getTalentTarget(t)
	self:project(tg, self.x, self.y, function(px, py, tg, self)
		local target = game.level.map(px, py, Map.ACTOR)
		if target and self:reactionToward(target) < 0 then
			if not target.dead then
				DamageType:get(DamageType.DARKNESS).projector(self, target.x, target.y, DamageType.DARKNESS, t.getDamage(self, t))
			end
		end
	end)
(Target code, if it matters)

Code: Select all

target = function(self, t)
	return {type="ball", range=0, selffire=false, radius=2}
end,

Re: ActBase Callback Damage Bug

Posted: Sun Nov 02, 2014 10:07 am
by 0player
In the callback machinery, .__projecting_for is ALWAYS hooked to a talent when calling a callback of a talent.
If you wish to override this, you can, I think, simply set it to nil in your code before doing damage.