How to superload a timed effect like CUT

All development conversation and discussion takes place here

Moderator: Moderator

Post Reply
Message
Author
MisiuPysiu
Archmage
Posts: 379
Joined: Tue Nov 11, 2003 10:54 am
Location: Wroclaw/Poland

How to superload a timed effect like CUT

#1 Post 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

HousePet
Perspiring Physicist
Posts: 6215
Joined: Sun Sep 09, 2012 7:43 am

Re: How to superload a timed effect like CUT

#2 Post 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.
My feedback meter decays into coding. Give me feedback and I make mods.

MisiuPysiu
Archmage
Posts: 379
Joined: Tue Nov 11, 2003 10:54 am
Location: Wroclaw/Poland

Re: How to superload a timed effect like CUT

#3 Post 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

HousePet
Perspiring Physicist
Posts: 6215
Joined: Sun Sep 09, 2012 7:43 am

Re: How to superload a timed effect like CUT

#4 Post by HousePet »

Yep, you can add a new function or overwrite an existing one with this method.
My feedback meter decays into coding. Give me feedback and I make mods.

Post Reply