You don't use GetAttacker(). You should use GetDamageSource() (I think... look in the JASS Editor). That's the right event-response for the Unit Is Damaged event.
function Trig_HeroAttackCounter_Conditions takes nothing returns boolean
return GetUnitTypeId( GetAttacker() ) == 'Huth'
endfunction
function Trig_HeroAttackCounter_Actions takes nothing returns nothing
set udg_HeroattackCounter = udg_HeroattackCounter + 1
if udg_HeroattackCounter == 10 then
set udg_HeroattackCounter = 0
endif
endfunction // this is a trigger which counts the heros attacks
//==== Init Trigger HeroAttackCounter ====
function InitTrig_HeroAttackCounter takes nothing returns nothing
set gg_trg_HeroAttackCounter = CreateTrigger()
call TriggerRegisterAnyUnitEventBJ (gg_trg_HeroAttackCounter, EVENT_PLAYER_UNIT_ATTACKED)
call TriggerAddCondition(gg_trg_HeroAttackCounter, Condition(function Trig_HeroAttackCounter_Conditions))
call TriggerAddAction(gg_trg_HeroAttackCounter, function Trig_HeroAttackCounter_Actions)
endfunction
function HSC takes nothing returns boolean
return GetUnitTypeId( GetAttacker() ) == 'Huth' and udg_HeroattackCounter == 10
endfunction
function HSA takes nothing returns nothing
local real x = GetUnitX ( GetTriggerUnit ( ) )
local real y = GetUnitY ( GetTriggerUnit ( ) )
call DestroyEffect ( AddSpecialEffect("Abilities\\Spells\\Human\\ThunderClap\\ThunderClapCaster.mdl" , x , y ) )
call DestroyEffect ( AddSpecialEffect("Abilities\\Spells\\Human\\Resurrect\\ResurrectTarget.mdl" , x , y ) )
call UnitDamageTarget ( GetAttacker ( ) , GetTriggerUnit ( ) , GetHeroStr ( GetAttacker ( ) , false ) * 0.08 , true , false , ATTACK_TYPE_HERO , DAMAGE_TYPE_NORMAL , WEAPON_TYPE_WHOKNOWS )
endfunction
function HSE takes nothing returns nothing
local trigger t = CreateTrigger()
call TriggerRegisterAnyUnitEventBJ (t, EVENT_PLAYER_UNIT_ATTACKED) // EVENT_UNIT_DAMAGED wont work,that is a unitevent while this function takes a playerunitevent,there is some difference.
// actually there is a way to make the unit takes damage generic . . .
call TriggerAddCondition(t, Condition(function HSC))
call TriggerAddAction(t, function HSA)
set t = null
endfunction
your previous trigger leaked so much. this will be okay.
EDIT :
@Daelin : as i said
TriggerRegisterAnyUnitEventBJ takes a playerunitevent as an argument,while unit takes damage is a unitevent , so it wont work with it.