Problem with superloading damage_types.lua

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

Problem with superloading damage_types.lua

#1 Post by MisiuPysiu »

Hey,

I'm working on my first addon ever.
At one point i have to superload the damage_types.lua file to get an effect similar to elemental_harmony (when damaged, get a buff)

Code: Select all

local _M                    = loadPrevious(...)

local base_setDefaultProjector = _M.setDefaultProjector

function _M:setDefaultProjector(src, x, y, type, dam, tmp, no_martyr)
-- Do stuff "before" loading the original file
    base_setDefaultProjector(self, src, x, y, type, dam, tmp, no_martyr)
-- Do stuff "after" loading the original file
	if not target.dead and dam > 0 and target:attr("might_in_pain") and not target:hasEffect(target.EFF_MIGHT_IN_PAIN) and type == "BLEED"
	then
	target:setEffect(target.EFF_MIGHT_IN_PAIN, target:callTalent(target.T_MIGHT_IN_PAIN, "getDuration"), {power=target:attr("might_in_pain"), type=type, no_ct_effect=true})			
	end

--  	if not target.dead and dam > 0  then
	--	target:setEffect(target.EFF_MIGHT_IN_PAIN, target:callTalent(target.T_MIGHT_IN_PAIN, "getDuration"), {power=target:attr("might_in_pain"), type=type, no_ct_effect=true})	
--		target:setEffect(target.EFF_CUT, 5, power=1000)	
--	end

end

return _M
sadly the code doesn't seem to be working, in fact it doesn't seem to be run at all. I tried the commented code (get a big CUT effect after beeing damaged) and it never went off.

I'm grateful for every suggestion.

Cheers.

darkgod
Master of Eyal
Posts: 10750
Joined: Wed Jul 24, 2002 9:26 pm
Location: Angolwen
Contact:

Re: Problem with superloading damage_types.lua

#2 Post by darkgod »

Dont superload it :)

Just make a nwe file in your data folder and load it in your ToME:load hook like that:

Code: Select all

	local DamageType = require "engine.DamageType"
	DamageType:loadDefinition("/data-myaddon/damage_types.lua")
[tome] joylove: You can't just release an expansion like one would release a Kraken XD
--
[tome] phantomfrettchen: your ability not to tease anyone is simply stunning ;)

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

Re: Problem with superloading damage_types.lua

#3 Post by MisiuPysiu »

yeah,

I did eventually use the hook for setDefaultProjector and it worked very nice:)
The code still throws a heap of errors but its only a matter of time when this is fixed.

Cheers:)

Post Reply