in this skill i wanted to damage per second the whole unit nearby the casting unit however this trigger wont damage them. plss help
JASS:
scope PE initializer init
globals
private constant integer SPELL_ID = 'A001'
private constant string SPELL_EFFECT_INDIVIDUAL = "Abilities\\Weapons\\PoisonSting\\PoisonStingTarget.mdl"
private constant damagetype DAMAGE_TYPE = DAMAGE_TYPE_POISON
private constant real SPELL_AOE = 550.
private constant real SPELL_INTERVAL_POISON = 0.5
private constant real SPELL_DURATION_POISON = 20.
private constant integer SPELL_BUFF_ID = 'B000'
private constant attacktype SPELL_TYPE = ATTACK_TYPE_MAGIC
endglobals
private function getPoisonDamage takes integer level returns real
return 1. * level
endfunction
private function getDamage takes integer level returns real
return 100. * level
endfunction
private function groupp1 takes nothing returns boolean
if 0 != GetUnitAbilityLevel(GetEventTargetUnit(), SPELL_BUFF_ID) then
return true
else
return false
endif
endfunction
private function groupp2 takes nothing returns boolean
if 0 == GetUnitAbilityLevel(GetEventTargetUnit(), SPELL_BUFF_ID) then
return true
else
return false
endif
endfunction
private function group1 takes nothing returns nothing
local unit u = GetTriggerUnit()
local widget t = GetEnumUnit()
local integer level = GetUnitAbilityLevel(u, SPELL_ID)
call DisplayTimedTextToPlayer(Player(0),0.,0.,20.,"ttttt")
call UnitDamageTarget(u, t, getPoisonDamage(level), true, false, SPELL_TYPE, DAMAGE_TYPE, WEAPON_TYPE_WHOKNOWS)
call DestroyEffect(AddSpecialEffectTarget(SPELL_EFFECT_INDIVIDUAL,t,"chest"))
endfunction
private function poison takes nothing returns nothing
local group g = CreateGroup()
call DisplayTimedTextToPlayer(Player(0),0.,0.,20.,"twttt")
call GroupEnumUnitsInRect(g, bj_mapInitialPlayableArea, Filter(function groupp1))
call ForGroup(g, function group1)
call DestroyGroup(g)
set g = null //Has to be cleaned
endfunction
private function group2 takes nothing returns nothing
local widget targ = GetEnumUnit()
local unit u = GetTriggerUnit()
local real x = GetUnitX(u)
local real y = GetUnitY(u)
local timer t = CreateTimer()
local integer level = GetUnitAbilityLevel(u, SPELL_ID)
call UnitDamageTarget(u,targ, getDamage(level), true, false, SPELL_TYPE, DAMAGE_TYPE, WEAPON_TYPE_WHOKNOWS)
call TimerStart(t,SPELL_INTERVAL_POISON, true, function poison)
endfunction
private function action takes nothing returns nothing
local group g = CreateGroup()
call GroupEnumUnitsInRect(g, bj_mapInitialPlayableArea, Filter(function groupp2))
call ForGroup(g, function group2)
call DestroyGroup(g)
set g = null
endfunction
private function init takes nothing returns nothing
local trigger t = CreateTrigger()
call TriggerRegisterAnyUnitEventBJ(t, EVENT_PLAYER_UNIT_SPELL_EFFECT)
call TriggerAddAction(t, function action)
call Preload(SPELL_EFFECT_INDIVIDUAL)
endfunction
endscope