- Joined
- Jul 19, 2007
- Messages
- 939
I have imported the "Voodoo Restoration" from DOTA from a spellpack into my map but it doesn't work at all... No units are healed when I activate it and yes I have checked the RAW-Code of ability and buff and it's correct. Also I want it to ONLY heal organic units.
JASS:
//TESH.scrollpos=12
//TESH.alwaysfold=0
scope VoodooRestoration initializer Init
globals
private constant integer AbilId = 'A0MT'
private constant integer BuffId = 'B08E'
private timer T = CreateTimer()
private unit U
private integer I
endglobals
private struct data
unit u
player p
integer lvl
trigger t
static method Stop takes nothing returns nothing
local integer lvl = GetUnitAbilityLevel(U,AbilId)
call UnitRemoveAbility(U,AbilId)
call UnitAddAbility(U,AbilId)
call SetUnitAbilityLevel(U,AbilId,lvl)
endmethod
method onDestroy takes nothing returns nothing
call DestroyTriggerEx(.t)
set U = .u
call TimerStart(T,0.,false,function data.Stop)
endmethod
endstruct
private function Filt takes nothing returns boolean
local data d = I
local unit targ = GetFilterUnit()
local real r
if not IsUnitEnemy(targ,d.p) and GetWidgetLife(targ)>.405 and GetUnitAbilityLevel(targ,BuffId)>0 then
set r = (8.+d.lvl*8.)/ 3.
call SetUnitState(targ,UNIT_STATE_LIFE,GetUnitState(targ,UNIT_STATE_LIFE)+r)
endif
set targ = null
return false
endfunction
private function Effects takes nothing returns boolean
local data d = GetTriggerData(GetTriggeringTrigger())
local group g
local real r
if GetTriggerEventId()==EVENT_UNIT_ISSUED_ORDER then
if GetIssuedOrderId()==852178 then
call d.destroy()
endif
else
set g = NewGroup()
set I = d
call GroupEnumUnitsInRange(g,GetUnitX(d.u),GetUnitY(d.u),350.,Condition(function Filt))
call ReleaseGroup(g)
set r = (d.lvl*6+2.)/3.
call SetUnitState(d.u,UNIT_STATE_MANA,GetUnitState(d.u,UNIT_STATE_MANA)-r)
if GetUnitState(d.u,UNIT_STATE_MANA)<r then
call IssueImmediateOrder(d.u,"unimmolation")
endif
endif
return false
endfunction
private function Actions takes nothing returns nothing
local data d = data.create()
set d.u=GetTriggerUnit()
set d.p = GetOwningPlayer(d.u)
set d.lvl = GetUnitAbilityLevel(d.u,AbilId)
set d.t=CreateTrigger()
call TriggerRegisterTimerEvent(d.t,0.33,true)
call TriggerRegisterUnitEvent(d.t,d.u,EVENT_UNIT_ISSUED_ORDER)
call TriggerAddCondition(d.t,Condition(function Effects))
call SetTriggerData(d.t,d)
endfunction
private function Conds takes nothing returns boolean
if GetSpellAbilityId()==AbilId then
call Actions()
endif
return false
endfunction
private function Init takes nothing returns nothing
local trigger t=CreateTrigger()
call TriggerRegisterAnyUnitEventBJ(t,EVENT_PLAYER_UNIT_SPELL_EFFECT)
call TriggerAddCondition(t,Condition(function Conds))
endfunction
endscope
