- Joined
- Sep 12, 2006
- Messages
- 5
hey. Im new to JASS, and i'm pretty confused about the whole thing... anyway - i've been trying to make a spell which damages a target unit over time, but it just wont work. Here it is:
function Trig_PoisonSting_Conditions takes nothing returns boolean
return GetSpellAbilityId() == 'A017'
endfunction
//===========================================================================
function InitTrig_PoisonSting takes nothing returns nothing
set gg_trg_PoisonSting = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_PoisonSting, EVENT_PLAYER_UNIT_SPELL_EFFECT )
call TriggerAddCondition( gg_trg_PoisonSting, Condition( function Trig_PoisonSting_Conditions ) )
endfunction
function PoisonSting takes nothing returns nothing
local unit caster = GetSpellAbilityUnit()
local unit target = GetSpellTargetUnit()
local integer dam = 25
local integer dur = 20
local integer seconds = 0
loop
exitwhen seconds==dur
if(IsUnitAliveBJ(target)!=true) then
endif
call UnitDamageTargetBJ(caster,target,dam,ATTACK_TYPE_CHAOS,DAMAGE_TYPE_ENHANCED)
set seconds=seconds+1
call TriggerSleepAction(1)
endloop
set seconds=0
set dam=0
set dur=0
set caster=null
set target=null
endfunction
(dont laugh, it might be full of bugs & leaks )
Can anyone help me with this??
function Trig_PoisonSting_Conditions takes nothing returns boolean
return GetSpellAbilityId() == 'A017'
endfunction
//===========================================================================
function InitTrig_PoisonSting takes nothing returns nothing
set gg_trg_PoisonSting = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_PoisonSting, EVENT_PLAYER_UNIT_SPELL_EFFECT )
call TriggerAddCondition( gg_trg_PoisonSting, Condition( function Trig_PoisonSting_Conditions ) )
endfunction
function PoisonSting takes nothing returns nothing
local unit caster = GetSpellAbilityUnit()
local unit target = GetSpellTargetUnit()
local integer dam = 25
local integer dur = 20
local integer seconds = 0
loop
exitwhen seconds==dur
if(IsUnitAliveBJ(target)!=true) then
endif
call UnitDamageTargetBJ(caster,target,dam,ATTACK_TYPE_CHAOS,DAMAGE_TYPE_ENHANCED)
set seconds=seconds+1
call TriggerSleepAction(1)
endloop
set seconds=0
set dam=0
set dur=0
set caster=null
set target=null
endfunction
(dont laugh, it might be full of bugs & leaks )
Can anyone help me with this??