Page 1 of 1
shielding from a specific damage source - CUTs and WOUNDs
Posted: Tue Oct 29, 2013 11:04 am
by MisiuPysiu
Hi there,
I want to create a talent, which will shield the actor from damage from a specific source like cuts, so if the target is bleeding, only the bleeding damage is absorbed by the shield.
I tried to bind the Actor:takeHit hook:
Code: Select all
class:bindHook("Actor:takeHit", function(self, data)
if self:hasEffect(self.EFF_FURY_OF_BLOOD) and (data.subtype.wound or data.subtype.cut) then
local eff = self:hasEffect(self.EFF_FURY_OF_BLOOD)
data.value = self.tempeffect_def[self.EFF_FURY_OF_BLOOD].do_onTakeHit(self, eff, value)
end
end)
of course this doesnt work, data.subtype doesnt return the value I need. Is there any other possibility of making such a check?
Cheers
Re: shielding from a specific damage source - CUTs and WOUND
Posted: Tue Oct 29, 2013 10:41 pm
by HousePet
Maybe add your check to the on_timeout function for all the bleeding effects?
I haven't looked into the possibility of checking if a damage hit comes from a timed effect properly.
Re: shielding from a specific damage source - CUTs and WOUND
Posted: Wed Oct 30, 2013 12:44 am
by Hachem_Muche
For 1.0.5 there's a new variable that you can use to see how damage is being done.
Timed effects (like bleeding), projectiles, and other sources that don't come directly from an actor will set the src.__project_source variable. This points to the data table (not definition) for the damage vehicle. (src is the actor that originated the effect.)
So, if you're using the "DamageProjector:final" hook (triggered in damage_types.lua), to test for bleeding (EFF_CUT), use src and src.__projector_source to find the information on the effect. In this case src.__projector_source.effect_id will let you look up the effect definition in engine.interface.ActorTemporaryEffects[id] to let you determine if it's a bleeding effect (or whatever you're looking for). You can then take appropriate action (probably reducing the dam variable, see damage_types.lua).
Re: shielding from a specific damage source - CUTs and WOUND
Posted: Wed Oct 30, 2013 7:56 am
by MisiuPysiu
Hey Hachem_Muche,
I will look into that. I'm working in the latest beta (or git version) so the solution you proposed can work. I will try it out.
Thanks a lot!
Cheers

Re: shielding from a specific damage source - CUTs and WOUND
Posted: Thu Oct 31, 2013 11:10 am
by MisiuPysiu
Ha!
its working!
Code: Select all
game.logPlayer(self, "DamageProjector test...")
-- damage type
if data.src.__project_source then
game.logPlayer(self, "DamageProjector. __project_source.effect_id: %s", data.src.__project_source.effect_id)
if data.src.__project_source.effect_id == data.src.EFF_CUT then
game.logPlayer(self, "DamageProjector. __project_source.effect_id: ITS a CUT!!!!!")
end
end
Cheers

Re: shielding from a specific damage source - CUTs and WOUND
Posted: Thu Oct 31, 2013 5:17 pm
by Hachem_Muche
Good Deal!
