- Joined
- Feb 22, 2006
- Messages
- 960
I wrote this little spell... and it don't want to work
what did i wrong, because i can't see anything wrong
what did i wrong, because i can't see anything wrong
JASS:
struct holystruct
unit target
real life
integer counter
integer countertwo = 0
method onDestroy takes nothing returns nothing
set this.target = null
set this.countertwo = 0
endmethod
endstruct
function hlCondition takes nothing returns boolean
return GetSpellAbilityId() == 'A000'
endfunction
function holytimer takes nothing returns nothing
local timer t = GetExpiredTimer()
local holystruct Dat = GetHandleInt(t,"struct")
local effect sfx
local real life
set sfx = AddSpecialEffectTarget("Abilities\\Spells\\Human\\HolyBolt\\HolyBoltSpecialArt.mdl",Dat.target,"origin")
set life = GetUnitState(Dat.target,UNIT_STATE_LIFE)
call SetUnitState(Dat.target,UNIT_STATE_LIFE,life+Dat.life)
call BJDebugMsg("Heal")
call DestroyEffect(sfx)
set Dat.countertwo = Dat.countertwo + 1
if (Dat.countertwo >= Dat.counter) then
call DestroyTimer(t)
call holystruct.destroy(Dat)
endif
set t = null
endfunction
function hlActions takes nothing returns nothing
local holystruct Dat = holystruct.create()
local timer t = CreateTimer()
local unit u = GetTriggerUnit()
local unit tar = GetSpellTargetUnit()
local integer counter = (4+(GetUnitAbilityLevelSwapped('A000',u)*1))
set Dat.target = tar
set Dat.counter = counter
set Dat.life = (GetHeroInt(u,true))
call TimerStart(t,1.00,true,function holytimer)
call SetHandleInt(t,"struct",Dat)
set u = null
set tar = null
endfunction
function InitTrig_HolyLight takes nothing returns nothing
local trigger HL = CreateTrigger()
call TriggerRegisterAnyUnitEventBJ(HL,EVENT_PLAYER_UNIT_SPELL_EFFECT)
call TriggerAddCondition(HL,Condition(function hlCondition))
call TriggerAddAction( HL, function hlActions )
set HL = null
endfunction