ActBase Callback Damage Bug

Where bugs go to lie down and rest

Moderator: Moderator

Post Reply
Message
Author
StarKeep
Uruivellas
Posts: 703
Joined: Sun Feb 03, 2013 12:29 am
Location: Turtlemire

ActBase Callback Damage Bug

#1 Post 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,
Last edited by StarKeep on Thu Nov 13, 2014 1:15 am, edited 2 times in total.
<mex> have you heard the good word about archmage?
<mex> I'm here to tell you about your lord and savior shalore archmage
<mex> have you repented your bulwark sins yet?
<mex> cornac shall inherit the Eyal

0player
Uruivellas
Posts: 717
Joined: Fri May 24, 2013 4:27 pm

Re: ActBase Callback Damage Bug

#2 Post 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.

Post Reply