JASS:
library DamageDetection initializer onInit requires RegisterPlayerUnitEvent
globals
private constant integer DETECTION_ID = 'A001'
private constant integer DETECTION_BUFF = 'B000'
private trigger trig = CreateTrigger()
private integer array spells
private integer index = 0
endglobals
/**
* When the ability is learned for the first time, the damage detection ability
* is added to the unit.
*/
public function RegisterSpell takes integer abilityId returns nothing
if (abilityId != 0) then
set spells[index] = abilityId
set index = index + 1
endif
endfunction
/**
* Register an on-attack event.
*/
public function RegisterAttack takes code onAttack returns nothing
call TriggerAddCondition(trig, Condition(onAttack))
endfunction
private function CheckSkill takes nothing returns nothing
local integer abilityId
local integer i
if (GetLearnedSkillLevel() == 1 and GetUnitAbilityLevel(GetTriggerUnit(), DETECTION_ID) == 0) then
set abilityId = GetLearnedSkill()
for i = 0 to (index - 1)
if (spells[i] == abilityId) then
call UnitAddAbility(GetTriggerUnit(), DETECTION_ID)
return
endif
endfor
endif
endfunction
private function CheckAttack takes nothing returns boolean
if (GetUnitAbilityLevel(udg_GDD_DamagedUnit, DETECTION_BUFF) > 0) then
call UnitRemoveAbility(udg_GDD_DamagedUnit, DETECTION_BUFF)
call TriggerEvaluate(trig)
endif
return false
endfunction
private function onInit takes nothing returns nothing
local trigger t = CreateTrigger()
call TriggerAddCondition(t, Condition(function CheckAttack))
call TriggerRegisterVariableEvent(t, "udg_GDD_Event", EQUAL, 0.0)
call RegisterPlayerUnitEvent(EVENT_PLAYER_HERO_SKILL, function CheckSkill)
set t = null
endfunction
endlibrary
Hello guys I need help with this trigger, this line is causing an error '' Syntax Error, unexpected: ''i''?

if (DamageDetection___spells == abilityId) then
call UnitAddAbility(GetTriggerUnit(), DamageDetection___DETECTION_ID)
return