Page 1 of 1

Damage hooks for summons

Posted: Sat Nov 01, 2014 9:46 am
by Razakai
Code: http://pastebin.com/twXVw79E

So, one of my talents in my addon does 2 things - allows your blight damage to inflict random debuffs, and also allows your carrion worm summons to do the same with any of their attacks. The player part works fine (the 'pestilent blight' effect in hooks) but the summon part does not, despite being virtually identical. Even if I replace the call to the Worm Blight effect with something simple like inflicting Blind, it still fails, so I presume the error lies with the hooks. I've checked and the worms do get the Worm Blight talent assigned at birth, so I'm not sure what's going wrong. Any ideas?

Re: Damage hooks for summons

Posted: Sat Nov 01, 2014 10:47 am
by Razakai
In order to test it, I forced it by changing the call to whether the worm knew Rotting Disease instead (an existing talent), which 'fixed' it. So the problem is where it checks if the worm knows Worm Blight. However, I also got this error. Not sure where I should define 't' as it works fine for the above talent.

Code: Select all

stack traceback:
	[C]: in function 'error'
	/engine/interface/ActorTalents.lua:153: in function </engine/interface/ActorTalents.lua:135>
Lua Error: /engine/interface/ActorTalents.lua:175: /engine/interface/ActorTalents.lua:153: /engine/interface/ActorTalents.lua:853: attempt to index local 't' (a nil value)
stack traceback:
	/engine/interface/ActorTalents.lua:853: in function 'callTalent'
	/hooks/reaver-tweaks/load.lua:30: in function </hooks/reaver-tweaks/load.lua:15>
	[string "return function(l, self, data) local ok=false..."]:1: in function 'triggerHook'
	/data/damage_types.lua:422: in function 'projector'
	/mod/class/interface/Combat.lua:528: in function 'attackTargetWith'
	/mod/class/interface/Combat.lua:202: in function 'attackTarget'
	/data/talents/misc/misc.lua:71: in function </data/talents/misc/misc.lua:51>
	[C]: in function 'xpcall'
	/engine/interface/ActorTalents.lua:148: in function </engine/interface/ActorTalents.lua:135>
	At [C]:-1 
	At [C]:-1 error
	At /engine/interface/ActorTalents.lua:175 bumpInto
	At /mod/class/Actor.lua:3370 attack
	At /engine/interface/ActorLife.lua:41 check
	At [string "return function(self, x, y, what, ...) local ..."]:1 checkAllEntities
	At /engine/interface/ActorAI.lua:63 aiCanPass
	At /engine/interface/ActorAI.lua:85 runAI
	At /engine/ai//talented.lua:64 doAI
	At /mod/class/NPC.lua:61 act
	At /engine/GameEnergyBased.lua:126 tickLevel
	At /engine/GameEnergyBased.lua:62 tick
	At /engine/GameTurnBased.lua:46 tick
	At /mod/class/Game.lua:1181 
 ----------------  Stack Dump ----------------
--------------- Stack Dump Finished ---------------

Re: Damage hooks for summons

Posted: Sat Nov 01, 2014 7:29 pm
by Doctornull
NPCs don't have all talent short names (e.g. target.T_WHATEVZ) defined.

I've had to do things like:

Code: Select all

local Talents = require "engine.interface.ActorTalents"
local t = actor:getTalentFromId(Talents.T_WHATEVZ)
...

Re: Damage hooks for summons

Posted: Sat Nov 01, 2014 8:22 pm
by grayswandir
Or you can just do 'T_TALENT_NAME' instead of self.T_TALENT_NAME.

Re: Damage hooks for summons

Posted: Sun Nov 02, 2014 12:12 pm
by Razakai
Huh, that's interesting to know for the future. Got it working now, thanks.