substance
New Member
- Reaction score
- 34
Im making a unit that when he attacks an ally he will damage them like normal but then instantly heal them for the same amount he damaged them x 2.
My problem is 'GetEventDamage()' doesnt work with EVENT_PLAYER_UNIT_ATTACKED, not to mention 'on attack' isnt a good method anyway
So that leaves me with EVENT_UNIT_DAMAGED, but that only works for a specific unit. So what can i do?
**oh and what ability can i base a 'Heal over time' spell, I tied unholy frenzy with changing the 'damage' to a negative value but that doesnt work and 'rejuvenation' is funky.**
JASS:
function Trig_MedicAttack_Conditions takes nothing returns boolean
return GetUnitTypeId(GetAttacker()) == 039;E00W039;
endfunction
function Trig_MedicAttack_Actions takes nothing returns nothing
local unit attacker = GetAttacker()
local unit attackee = GetTriggerUnit()
local real damage = GetEventDamage()
if IsUnitAlly(attackee,GetOwningPlayer(attacker)) then
call SetUnitState(attackee, UNIT_STATE_LIFE, GetUnitState(attackee, UNIT_STATE_LIFE) + damage * 2)
endif
endif
endfunction
//===========================================================================
function InitTrig_MedicAttack takes nothing returns nothing
set gg_trg_MedicAttack = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_MedicAttack, EVENT_PLAYER_UNIT_ATTACKED )
call TriggerAddCondition( gg_trg_MedicAttack, Condition( function Trig_MedicAttack_Conditions ) )
call TriggerAddAction( gg_trg_MedicAttack, function Trig_MedicAttack_Actions )
endfunction
My problem is 'GetEventDamage()' doesnt work with EVENT_PLAYER_UNIT_ATTACKED, not to mention 'on attack' isnt a good method anyway
So that leaves me with EVENT_UNIT_DAMAGED, but that only works for a specific unit. So what can i do?
**oh and what ability can i base a 'Heal over time' spell, I tied unholy frenzy with changing the 'damage' to a negative value but that doesnt work and 'rejuvenation' is funky.**