Page 1 of 1

How to superload a timed effect like CUT

Posted: Mon Oct 28, 2013 12:55 pm
by MisiuPysiu
Hi,

i want to superload the

Code: Select all

on_timeout
function of the CUT effect, adding lines similar to the waters of life effect:

Code: Select all

	on_timeout = function(self, eff)
		if self:attr("purify_poison") then self:heal(eff.power)
		else DamageType:get(DamageType.NATURE).projector(eff.src, self.x, self.y, DamageType.NATURE, eff.power)
		end
	end,
is there any clean and nice way of doing this?

Cheers

Re: How to superload a timed effect like CUT

Posted: Mon Oct 28, 2013 11:07 pm
by HousePet
There sure is.

Put something like this in the appropriate superload file.

Code: Select all

TemporaryEffects.tempeffect_def.EFF_DAMAGE_SHIELD.on_overload = function(self, eff, overload)
		-- Explode
		local tg = {type="ball", range=0, selffire=false, radius=overload, talent=t}
		self:project(tg, self.x, self.y, DamageType.PHYSICAL, self.damage_shield_absorb)		
end
Obviously change the effect id and everything else.

Re: How to superload a timed effect like CUT

Posted: Tue Oct 29, 2013 9:39 am
by MisiuPysiu
Hey HousePet,

Thanks for the answer, I will try it. I assume this method works also when the function i like to overload is already defined in the master file. In this case its

Code: Select all

on_timeout
, which already has a definition for the CUT effect.

Cheers

Re: How to superload a timed effect like CUT

Posted: Tue Oct 29, 2013 10:38 pm
by HousePet
Yep, you can add a new function or overwrite an existing one with this method.