Damage hooks for summons

All development conversation and discussion takes place here

Moderator: Moderator

Post Reply
Message
Author
Razakai
Uruivellas
Posts: 889
Joined: Tue May 14, 2013 3:45 pm

Damage hooks for summons

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

Razakai
Uruivellas
Posts: 889
Joined: Tue May 14, 2013 3:45 pm

Re: Damage hooks for summons

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

Doctornull
Sher'Tul Godslayer
Posts: 2402
Joined: Tue Jun 18, 2013 10:46 pm
Location: Ambush!

Re: Damage hooks for summons

#3 Post 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)
...
Check out my addons: Nullpack (classes), Null Tweaks (items & talents), and New Gems fork.

grayswandir
Uruivellas
Posts: 708
Joined: Wed Apr 30, 2008 5:55 pm

Re: Damage hooks for summons

#4 Post by grayswandir »

Or you can just do 'T_TALENT_NAME' instead of self.T_TALENT_NAME.
Addons: Arcane Blade Tweaks, Fallen Race, Monk Class, Weapons Pack
Currently working on Elementals. It's a big project, so any help would be appreciated. :)

Razakai
Uruivellas
Posts: 889
Joined: Tue May 14, 2013 3:45 pm

Re: Damage hooks for summons

#5 Post by Razakai »

Huh, that's interesting to know for the future. Got it working now, thanks.

Post Reply